Skip to content

Schema JSON

PDFMancer accepts a JSON document with an elements array.

Versioned Schema

Machine-readable schema endpoints:

  • Current metadata: GET /api/public/schema/current
  • Versioned schema: GET /api/public/schemas/document/v1.json

Use the published JSON Schema to validate client-side before calling render. For placeholder syntax rules, see Templating.

Document

json
{
  "elements": [
    { "type": "text", "value": "Hello" }
  ]
}

Elements

Text

json
{
  "type": "text",
  "value": "Invoice {{ invoice.number }}",
  "style": "BodyText",
  "text_align": "left",
  "max_width": "60%",
  "vertical_align": "top"
}

Heading

json
{
  "type": "heading",
  "value": "Invoice {{ invoice.number }}",
  "level": 2,
  "text_align": "left"
}

Divider

json
{
  "type": "divider",
  "thickness": 1,
  "color": "#D1D5DB",
  "spacing_before": 8,
  "spacing_after": 8
}

List

json
{
  "type": "list",
  "items": [
    "First line item",
    "Second line item"
  ],
  "ordered": false,
  "style": "BodyText"
}

Image

json
{
  "type": "image",
  "src": "https://example.com/logo.png",
  "width": 120,
  "height": 60,
  "horizontal_align": "left",
  "vertical_align": "top"
}

Row

json
{
  "type": "row",
  "elements": [
    { "type": "text", "value": "Left" },
    { "type": "text", "value": "Right" }
  ],
  "horizontal_align": "center"
}

Table

json
{
  "type": "table",
  "source": "lines",
  "columns": [
    { "label": "Concept", "value": "{{ item.concept }}" },
    { "label": "Qty", "value": "{{ item.quantity }}" },
    { "label": "Line Total", "value": "{{ item.line_total }}", "format": "currency" }
  ],
  "empty_message": "No data",
  "limit": 40,
  "horizontal_align": "left"
}

Supported table modes:

  1. Dynamic table (source + columns)
  • source must resolve to an array in input data.
  • columns[].value can use the loop alias item for each row.
  1. Static table (data)
  • Provide data as a matrix ([["header1","header2"],["row1col1","row1col2"]]).
  • Cell values can be strings, numbers, booleans, or null.
  1. Static columns (columns without source)
  • Renderer builds one data row from columns[].value using current context.

Spacer

json
{
  "type": "spacer",
  "height": 12
}

Page Break

json
{ "type": "pagebreak" }