Generating PDFs is easy until you need hundreds: invoices from order data, certificates for every attendee, reports for every client. Here are the free options, and an API that fills a template with your rows and returns one PDF per row.
Free options
- Your browser: Print › Save as PDF. Fine for one page.
- Our free Markdown to PDF tool: real text, page numbers and a table of contents, in your browser.
- Code: headless Chrome (Puppeteer, Playwright
page.pdf()) or WeasyPrint. wkhtmltopdf is archived and uses an old WebKit, so modern CSS breaks. See PDFShift and wkhtmltopdf alternatives.
The API way: a template plus your data
- Open the HTML to PDF API on Apify.
- Either list URLs, paste HTML, or paste a Handlebars template and a data array (one object per document).
- Set page size, margins, landscape, header and footer templates and page numbers. fileNameTemplate names each file, e.g.
invoice-{{{{number}}}}. - Run it. Each row links to its PDF in your Apify storage.
curl -X POST "https://api.apify.com/v2/acts/blueberry_rainstorm~html-to-pdf/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"template": "<h1>Invoice {{number}}</h1><p>{{customer}}</p><p>Total: {{formatNumber total 2}} EUR</p>",
"data": [
{
"number": "2026-001",
"customer": "Acme GmbH",
"total": 1200
},
{
"number": "2026-002",
"customer": "Globex",
"total": 349.5
}
],
"fileNameTemplate": "invoice-{{number}}",
"pageFormat": "A4",
"pageNumbers": true
}'
Template helpers include multiply, sumProduct and formatNumber for invoice lines and totals.
What it costs
$3 per 1,000 PDFs, any page count, no start fee. 500 invoices cost $1.50. Failed documents are free. Apify's free credit covers about 1,600 PDFs a month.
Questions
How do I generate PDFs from an HTML template?
Paste a Handlebars template and an array of JSON rows into the HTML to PDF API. It renders one PDF per row with headless Chrome and names each file from your template.
Can I convert a URL to PDF?
Yes. List the URLs; cookie banners are hidden and lazy images loaded before printing.
Does a 30-page PDF cost more?
No. The price is $3 per 1,000 PDFs whatever the page count.
Can I add page numbers and headers?
Yes. Turn on pageNumbers or write your own headerTemplate and footerTemplate.