Product and API guide

Designing in Generator

Start with a template

Create a template from Templates in your account, or open an existing template in Generator. Use Assets to add text, headings, tables, images or charts. Selecting an element on the canvas displays its settings in the Inspector.

Layout and available space

Use Layout for position, size and alignment, and Style for typography and padding. Flow placement follows document order; absolute placement is for elements that need a specific position. Prefer flow for growing reports and check page breaks with long data.

Size, margins and padding

A width of 100% fills the containing area, not the entire sheet. Page margins reduce the usable document area, while padding reduces space inside an element. Tables and charts inside columns are also constrained by the column width.

Do the same thing over the API

The editor writes the template definition through the same endpoint you can call yourself. Read the current definition, change it, and write it back with the version you read - so a change someone else published in the meantime cannot be overwritten by accident.

cURL
# 1 - Download the definition the editor works on
curl -s https://api.pdfgine.com/api/v1/templates/invoice \
  -H "X-PDFgine-Key: $PDFGINE_KEY" > invoice.json

# 2 - Edit the "definition" object inside invoice.json

# 3 - Write it back with the same version number
curl -X POST https://api.pdfgine.com/api/v1/templates \
  -H "X-PDFgine-Key: $PDFGINE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
        "code": "invoice",
        "name": "Invoice",
        "saveMode": "manual",
        "expectedVersion": 1,
        "changeReason": "Logo moved to the right margin.",
        "definition": { "page": { "size": "A4", "orientation": "portrait" }, "elements": [] }
      }'

expectedVersion is what makes this safe. If the template moved on, the write is refused with 409 and the response carries the current version; read again, reapply your change and write once more.

Saving and checking outputs

Save your changes, then check Preview and the PDF or Word output you need. A sample that fits on the canvas may create more pages with longer real data. Review headings, tables, chart labels and page breaks together before publishing.

Table Data Builder →

What usually goes wrong

  • What you see in the editor is the draft. Until you publish, every production render keeps using the older published version.
  • Sample data is shorter than real data. A layout that fits the canvas can overflow into a second page once a real customer name, address and thirty rows arrive.
  • 100% is the containing area, not the sheet. Margins and padding take their share before the element gets its width.
  • Absolute placement does not move out of the way. An element placed at fixed coordinates stays there while flow content grows past it; use flow for anything that can span pages.
  • Two people in the same template is a 409, not a merge. The write carries the version you started from and is refused if that version moved.