HTML to PDF Converter avatar

HTML to PDF Converter

Pricing

from $9.99 / 1,000 pdfs

Go to Apify Store
HTML to PDF Converter

HTML to PDF Converter

Convert raw HTML or web page URLs into downloadable PDF files using a real browser. Render CSS, images, tables, invoices, reports, and dynamic layouts, then save the generated PDF to the Apify Key-Value Store with dataset metadata.

Pricing

from $9.99 / 1,000 pdfs

Rating

0.0

(0)

Developer

rainminer

rainminer

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

a day ago

Last modified

Share

HTML to PDF

Convert raw HTML or a public web page URL into a downloadable PDF with a temporary Playwright browser.

What It Does

HTML to PDF renders your input in headless Chrome, generates a PDF with Playwright page.pdf, saves the file to the Apify Key-Value Store, and pushes one dataset item with the file name, storage key, PDF URL, byte size, source type, and page title when available.

Raw HTML is the primary input. If html is empty, the Actor loads url instead.

Input

{
"html": "<!doctype html><html><head><title>Invoice</title></head><body><h1>Invoice</h1></body></html>",
"fileName": "invoice.pdf",
"format": "A4",
"printBackground": true,
"landscape": false,
"margin": {
"top": "0.4in",
"right": "0.4in",
"bottom": "0.4in",
"left": "0.4in"
},
"viewportWidth": 1280,
"viewportHeight": 720,
"waitForMillis": 0
}

Use url instead of html when you want to render a live page:

{
"url": "https://example.com",
"fileName": "example.pdf"
}

Output

The PDF is stored in the default Key-Value Store under fileName, defaulting to output.pdf.

Example dataset item:

{
"fileName": "invoice.pdf",
"pdfUrl": "https://api.apify.com/v2/key-value-stores/{storeId}/records/invoice.pdf",
"key": "invoice.pdf",
"bytes": 18421,
"sourceType": "html",
"title": "Invoice"
}

Notes

  • printBackground defaults to true so CSS backgrounds are included.
  • format defaults to A4.
  • waitForMillis can delay PDF generation for client-side rendering, up to 60 seconds.
  • File names are sanitized to valid Key-Value Store record keys and get a .pdf suffix if missing.