Getting Started

Create your first PDF template and generate a PDF via API.

Concepts

  • Template — HTML/Handlebars + optional CSS, sample JSON, and optional Data Pipeline.
  • Code Editor — Primary way to build templates.
  • Data Pipeline — Optional JSON spec to transform data before rendering.
  • API Key — Used to call the PDF generation endpoint securely.

1) Create a Template

  1. Go to Templates.
  2. Click "Create New Template".
  3. Choose "Code Template".
  4. Use the starter HTML and JSON; the preview updates live.

Tip: Use Handlebars expressions like {{customer.name}} in your HTML.

2) Set PDF Options

Configure page size (A4, Letter, etc.), orientation, margins, and optional security/compression.

3) Generate a PDF via API

Use your API key in the Authorization header.

curl -X POST   -H "Content-Type: application/json"   -H "Authorization: Bearer <your-api-key>"   -d '{
    "templateId": "<template-id>",
    "data": { "customer": { "name": "Edwin" } }
  }'   http://localhost:3000/api/generate-pdf --output generated.pdf
await fetch('/api/generate-pdf', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer <your-api-key>'
  },
  body: JSON.stringify({
    templateId: '<template-id>',
    data: { /* your JSON */ }
  })
})

4) Charts (Optional)

<div class="chart-placeholder" data-chart='{"type":"bar","data":{}}'></div>

We replace placeholders with rendered images at preview and generation time.

5) Pipelines (Optional)

{
  "steps": [
    { "type": "compute", "expr": "sum($.items[*].price)", "to": "$.totals.subtotal" },
    { "type": "set", "value": 0.07, "to": "$.totals.taxRate" }
  ]
}

Next Steps

  • Learn the editor in depth: /docs/code-editor
  • Data Pipelines details: /docs/pipelines
  • API reference: /docs/api