• Objective: Use a python script to convert out .json payload files to .pdf.

  • Requirements: 

    • coding platform (i.e., Visual Studio Code, Google Colab, etc)

    • code language: python

    • Libraries: json, fpdf


import json
from fpdf import FPDF

def json_to_pdf(json_path, pdf_path):
    # Read JSON file
    with open(json_path, 'r') as f:
        data = json.load(f)
    # Convert JSON data to a pretty printed string
    json_str = json.dumps(data, indent=4)
    # Create a PDF instance
    pdf = FPDF()
    pdf.set_auto_page_break(auto=True, margin=15)
    pdf.set_font("Arial", size=12)
    # Split the string into lines
    lines = json_str.split('\n')
    # Add each line to the PDF
    for line in lines:
        pdf.multi_cell(0, 10, line)
    # Save the PDF to the specified path

# Usage example
json_path = '/Users/FLINKS/Downloads/python/GAD_Sample.json'
pdf_path = '/Users/FLINKS/Downloads/python/GAD_Sample PDF result.pdf'
json_to_pdf(json_path, pdf_path)

Other option - Client Dashboard:
It's also possible to extract a PDF with the KYC, IBV and Transaction data directly from the Client Dashboard.