Auto-pagination

Auto-pagination turns one designed page into a multi-page PDF whose page count follows the content — invoices with any number of line items, catalogs, reports. You design a single page; at render time Bannx measures the content, splits it into pages, and merges them into one PDF.

How it works

  1. In the editor, enable Paginate on the page (page.paginate) and mark exactly one top-level column container as the flow region (layer.flowRegion).
  2. Fill the flow region with content — typically a loop layer bound to a data collection, so rows come from your data.
  3. Render with format: "pdf" via the Rendering API. The server measures each item in the flow region at its natural height, packs items into as many virtual pages as needed, and renders them into one merged PDF.

Everything outside the flow region (headers, footers, backgrounds) repeats on every page.

Flow region rules

The flow region must satisfy all of these — otherwise the render falls back to a normal single page (with a server-side warning), so a misconfigured template still produces output:

  • Exactly one visible layer marked as flow region
  • It must be a top-level layer (no parent)
  • flexDirection: column (items stack vertically; overflow extends downward)
  • It cannot itself be a loop layer (put loop layers inside it)

Page-number variables

Each generated page gets pageNumber and totalPages merged into its data context — bind them in text layers for "Page 2 of 7" footers.

Limits

  • page.paginate.maxPages caps generation per page; the hard server cap is 50 pages. Content beyond the cap is dropped (logged as a warning).
  • Pagination applies to the PDF pipeline (format: "pdf"); PDF renders consume one credit per generated page.

Example

curl -X POST -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "pageId": "INVOICE_PAGE_ID",
    "format": "pdf",
    "output": "binary",
    "tweaks": { "invoiceNumber": "INV-2041", "lineItems": [ /* any number of rows */ ] }
  }' \
  "https://your-app.bannx.app/api/render" -o invoice.pdf

A 3-item invoice comes back as one page; a 60-item invoice comes back as however many pages the items need (up to the cap) — same template, same request shape.