Generate PDF from JSON

Turn JSON data into a document worth sending.

Keep business data in your application and document layout in a JayCode blueprint. Bind them with expressions to generate personalized PDFs from the same reusable definition.

Your data and your layout have different jobs

Data goes in vars

Customer names, invoice lines, and other values belong in the job’s vars object.

Layout goes in the blueprint

Describe headings, paragraphs, tables, page layout, and styles using JayCode nodes.

Expressions connect them

Use {{ customerName }} in a content value to insert data from the job.

JayCode does not infer a finished layout from arbitrary JSON. The blueprint defines how your data becomes a document.

Start with a complete JSON example

This job includes its own blueprint, so it does not depend on a saved template slug. Change customerName to personalize the output.

Personalized receipt · JSON
{
  "lang": "JayCode",
  "type": "job",
  "outputFileName": "receipt-001.pdf",
  "blueprint": {
    "lang": "JayCode",
    "type": "blueprint",
    "body": [
      {
        "type": "heading",
        "level": 2,
        "value": "Receipt"
      },
      {
        "type": "paragraph",
        "value": "{{ 'Thank you, ' + customerName + '!' }}"
      }
    ]
  },
  "vars": {
    "customerName": "Jane Smith"
  }
}
Expected content

A heading reading “Receipt”, followed by “Thank you, Jane Smith!”. The blueprint controls the presentation; vars supplies the name.

Move from one example to reusable documents

  1. Save the blueprint

    Register the document definition and assign it a slug in the dashboard.

  2. Reference it in each job

    Replace the inline blueprint object with your saved slug and send new vars for each document.

  3. Add document logic

    Use expressions, data-driven content, and resources as your template grows.

Blueprint foundation · Jay expressions · Data-driven content

Before you integrate

Do I need HTML or CSS?

No. Define the document with JayCode’s JSON structure and styling properties. Existing HTML templates need to be recreated as blueprints.

Can I use arrays and calculated values?

Yes. Jay expressions support array access and arithmetic. Data-driven content lets you build repeated sections such as invoice lines.

Where can I see a larger example?

The invoice API page includes the production Prism payload with seller details, line items, and totals.

How do I receive the PDF?

Jobs run asynchronously. Handle the completion webhook and retrieve the PDF using its signed download URL. See the webhook integration guide.

Build your first document

Start with a blueprint. Make it yours.

Explore working examples, then connect a render job to your application.