Skip to content
jsontoimg
Start free
← All articles

Multi-Page PDF Generation API: Templates and Per-Page Credits

Published · Balaji

A PDF generation API usually means one of two things: converting HTML, Markdown, or a URL to PDF, or filling a designed template and exporting it. jsontoimg is the second kind. Set format to pdf on the same render call you use for images, and a multi-page template becomes a multi-page PDF.

The request

curl -X POST "$JSONTOIMG_BASE_URL/api/v1/render?wait=60" \
  -H "Authorization: Bearer $JSONTOIMG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"template":"<design-id>","format":"pdf","layers":{"full_name":{"text":"Ada Lovelace"}}}'

Layer overrides work exactly as they do for images, and so do wait, batch, and webhooks. A misspelled layer name returns 422 Unprocessable Content instead of a PDF with placeholder text.

What a PDF costs

One credit per page.

Output Credits
1-page certificate 1
5-page proposal 5
12-page report 12
One PNG of the same design 1

Failed jobs are free, and a quota overrun returns 402 Payment Required. At the prepaid rate of $0.02 per image, a 12-page report costs $0.24. Design to the page count you need: a template with a spare page costs a credit on every render.

Rules to know

  • transparent is not valid with PDF. It works with PNG, WebP, and AVIF only.
  • wait blocks for at most 60 seconds. Longer jobs return a job id; use a webhook or poll.
  • A batch accepts up to 50 jobs, and each job sets its own format.
  • Layout comes from the editor. Content that must reflow, such as a table that grows to a second page by itself, belongs in a template where you chose the page count.

What it does not do

jsontoimg does not turn arbitrary HTML, Markdown, or a live URL into a PDF. Tools such as APITemplate.io are built around HTML-to-PDF. If your source is a web page, use a tool that renders web pages. If your source is a design with named fields, this is the shorter path.

Pairing PDF with PNG

Many certificate and ticket flows render both: a PNG for the email body and a PDF for printing, from the same template and payload. That is two credits per recipient. The pipeline is in the bulk certificate generation from a CSV, and the format reference is in the PDF docs. The PDF format overview covers what the file type guarantees.

FAQ

How does jsontoimg generate PDFs?

Send POST /api/v1/render with format set to pdf. A multi-page template becomes a multi-page PDF, and layer overrides work as they do for images.

How are PDFs billed?

One credit per page. A 12-page report uses 12 credits, a failed job uses none, and prepaid packs work out to $0.02 per image.

Can I convert HTML or a URL to PDF with jsontoimg?

No. jsontoimg renders designs from its editor with named layers. For arbitrary HTML, Markdown, or URL conversion, use a tool built for that.

Can I make a transparent PDF?

No. The transparent option is not valid with PDF and works only with PNG, WebP, and AVIF.

Related Resources

Your first 25 images are on us.

Design a template, grab an API key, and render your first PNG or PDF in minutes. No card required.