Skip to content

Schema JSON

PDFMancer accepts a JSON document with an elements array.

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",
  "data": [
    ["Item", "Qty", "Price"],
    ["Widget", "2", "19.99"]
  ],
  "horizontal_align": "center"
}

Spacer

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

Page Break

json
{ "type": "pagebreak" }