Skip to content

Render a template with data

Use a template when each invoice, report, or label shares a layout. Keep the template and the sample data in separate files so you can check changes to either one.

Try the sample invoice

Install the PressJet CLI, then save invoice.template.json and invoice.data.json to the same directory. Run these commands there.

pressjet template check invoice.template.json invoice.data.json
pressjet template render invoice.template.json invoice.data.json invoice.pdf

Open invoice.pdf to see the populated invoice. Try changing one value in invoice.data.json and render again. In an application, repeat the second step with each record's data.

Publish a template to your own API

If you operate a template-enabled server, callers can supply data by sending {"version":1,"data":{...}} to POST /v1/templates/{id}/render. See deployment and template activation. For template syntax, validation, and authoring with an agent, see the template authoring guide.