HTML to PDF Converter: Invoices from Templates, Merge & URLs avatar

HTML to PDF Converter: Invoices from Templates, Merge & URLs

Pricing

from $3.00 / 1,000 pdfs

Go to Apify Store
HTML to PDF Converter: Invoices from Templates, Merge & URLs

HTML to PDF Converter: Invoices from Templates, Merge & URLs

Turn an HTML template and a list of records into a PDF each, or HTML and web page URLs into PDFs, in a real Chrome: invoices with line items, A4 or Letter, margins, page numbers, headers and footers, and all of them merged into one PDF. A link to each; failures are free.

Pricing

from $3.00 / 1,000 pdfs

Rating

0.0

(0)

Developer

Spyridon Pikoulas

Spyridon Pikoulas

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

a day ago

Last modified

Features

Limited permissions

Share

Give it HTML or the addresses of web pages, and get PDFs back, printed by a real Chrome:

  • A template and its data: one HTML template with {{fields}} and a list of records, one PDF per record: invoices with their line items, certificates, tickets, letters. A hundred invoices took 11 seconds.
  • Your own HTML: finished documents, many in one run through the API.
  • Web pages by URL, as Chrome prints them, with print or screen styles.
  • A4, Letter, Legal, A3, A5 or Tabloid, portrait or landscape, your margins, and the document's own CSS (@page) when it sets a size or margins.
  • Page numbers, headers and footers on every page, backgrounds and web fonts kept, text selectable.
  • A link to each PDF, with its page count and size, and all of them merged into one PDF if you like.

It costs $3 per 1,000 PDFs on Apify's paid plans and $5 on the free plan; each started 20 pages count once. A document that fails costs nothing.

What people use it for

  • Invoices and receipts: a PDF for each order from one HTML template and your orders' data, from Make, Zapier, n8n or your own code, and one merged file to print or send to the accountant.
  • Reports: dashboards, statements and summaries rendered as HTML, sent as PDF.
  • Archiving web pages: articles, terms, prices and listings as they were on a day.
  • Documents for e-signature and print: contracts, certificates, tickets and labels.

How to make PDFs

  1. Click Try for free; Apify's free plan covers a first run.
  2. Paste your HTML, add Page URLs, or give a Template and its Data.
  3. Pick the Paper size, Margin and Page numbers if you want them.
  4. Click Start, then open the PDFs from the Output tab.

An input with every option:

{
"html": "<html><head><title>Invoice 1001</title></head><body><h1>Invoice 1001</h1></body></html>",
"documents": [
{"html": "<h1>Invoice 1002</h1>", "name": "invoice-1002"},
"<h1>Invoice 1003</h1>"
],
"urls": ["https://www.wikipedia.org"],
"paper": "A4",
"landscape": false,
"margin": "10mm",
"pageNumbers": true,
"headerTemplate": "<div style=\"font-size:9px;width:100%;text-align:right;padding-right:10mm\">ACME Ltd</div>",
"footerTemplate": "",
"printBackground": true,
"media": "print",
"scale": "1",
"waitUntil": "load",
"delaySeconds": 0
}

From a template

The template is HTML with Mustache fields, filled from each record of data: {{field}} is escaped, {{{field}}} put in as is, {{customer.name}} reads into an object, {{#items}}...{{/items}} repeats for each item of a list (or shows when a value is set), and {{^items}}...{{/items}} shows when it's empty. fileName is filled the same way.

{
"template": "<html><head><title>Invoice {{number}}</title></head><body><h1>Invoice {{number}}</h1><p>Billed to: <b>{{customer.name}}</b><br>{{customer.address}}</p><table>{{#items}}<tr><td>{{name}}</td><td>{{amount}}</td></tr>{{/items}}<tr><td>Total</td><td>{{total}}</td></tr></table>{{#paid}}<p>Paid, thank you.</p>{{/paid}}</body></html>",
"fileName": "invoice-{{number}}",
"data": [
{"number": 1001, "customer": {"name": "Example Corp", "address": "1 Example Street, London"},
"items": [{"name": "Website design", "amount": "$1,200.00"}, {"name": "Hosting, 12 months", "amount": "$180.00"}],
"total": "$1,380.00", "paid": true},
{"number": 1002, "customer": {"name": "Sample & Sons", "address": "2 Sample Road, Leeds"},
"items": [{"name": "Logo", "amount": "$400.00"}], "total": "$400.00"}
],
"merge": true,
"pageNumbers": true
}

Each record makes invoice-1001.pdf, invoice-1002.pdf and so on, and with Merge into one PDF they're also put together, in order, in merged.pdf.

Output

{
"source": "html",
"url": null,
"name": null,
"finalUrl": null,
"title": "Invoice 1001",
"status": null,
"pdfUrl": "https://api.apify.com/v2/key-value-stores/STORE_ID/records/00000-Invoice-1001.pdf",
"key": "00000-Invoice-1001.pdf",
"pages": 1,
"paper": "Letter",
"landscape": false,
"sizeBytes": 44173,
"chargedPdfs": 1,
"createdAt": "2026-11-10T10:12:49Z",
"error": null
}

pdfUrl opens the PDF as long as the run's storage is kept; key names it in the run's key-value store, after the document's name, else the page's address or the HTML's <title>. A web page's row also has url, finalUrl after redirects, and the status it answered with. A document that fails comes with error, saying why.

With Merge into one PDF, merged.pdf sits in the same key-value store, linked from the Output tab, and the run's status says how many pages it has. It's free, and it holds only the PDFs made, in the order given: URLs, the HTML, documents, then the template's records.

Use it as an API

Apify's API starts a run and returns its dataset as JSON; its Python and JavaScript clients, and its Make, Zapier and n8n integrations, work the same way.

curl -X POST "https://api.apify.com/v2/acts/pikoulas~html-to-pdf/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"html": "<h1>Invoice 1001</h1><p>Total: $1,380.00</p>", "paper": "Letter", "pageNumbers": true}'

AI agents can call it as a tool through Apify's MCP server: https://mcp.apify.com?tools=pikoulas/html-to-pdf.

How much does it cost?

A PDF is $0.003, up to 20 pages; a longer one counts once per started 20, so a 45-page report is three. A thousand invoices cost $3, and merging them costs nothing more. Set a spending limit on a run and it stops there, with what it has made so far.

Good to know

  • Images, fonts and stylesheets your HTML links to load from their public addresses; inline them (data: URLs) if they aren't public. Files on your computer can't load.
  • Headers and footers are HTML with their styles inline, as Chrome prints them: elements with the classes pageNumber, totalPages, date, title and url get those filled in. They sit in the margin, so keep it at 10mm or more.
  • Charts and late content: pick The network has gone quiet or an Extra wait for scripts that draw after the page loads.
  • More memory, more at once: two documents at a time per GB.
  • A site's refusal is respected for web pages. It names itself in its User-Agent and reads each site's robots.txt, one page a second per site at most. A path robots.txt refuses isn't printed, and a site that answers 401, 403 or 451, shows a verification page or answers 429 is left alone for the rest of the run. It uses no proxy and doesn't try to get past any of this, so a page behind a check comes back with an error.
  • Only public addresses are reached, not private networks, for pages and for what your HTML links to.
  • Contact. The Actor keeps nothing itself: PDFs and results sit in the storage of whoever ran it. Questions or requests go to spyridwn.pd@gmail.com.

FAQ

Printing a page you can open, for your own records, is what a browser's own Print does; it reads only the pages you give it, without logging in, and keeps to each site's robots.txt. Publishing or selling a copy is another matter: pages are usually someone's copyrighted work, a site's terms may limit what you do with them, and people named on them are protected by laws such as the GDPR and the CCPA. If you're unsure, ask a lawyer; Apify's Is web scraping legal? is a good start.

Can I use a template with fields?

Yes: give Template and Data, as above. For a template language it doesn't take (Handlebars helpers, Jinja filters), fill it in your own code or automation and send the finished HTML under documents, each with a name.

Something missing or not working?

Open an issue on the Issues tab with the input you used, or ask there for a field you need.

If it does what you need, a review on the Reviews tab helps others find it.