HTML to PDF: web pages and raw HTML to PDF in bulk avatar

HTML to PDF: web pages and raw HTML to PDF in bulk

Pricing

from $9.00 / 1,000 pdf createds

Go to Apify Store
HTML to PDF: web pages and raw HTML to PDF in bulk

HTML to PDF: web pages and raw HTML to PDF in bulk

Prints every URL or raw HTML document you list to PDF in headless Chrome, with page size, margins, landscape, backgrounds, scale, page numbers, and header and footer templates. Returns a download link for each PDF.

Pricing

from $9.00 / 1,000 pdf createds

Rating

0.0

(0)

Developer

Ed Rayyis

Ed Rayyis

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

4 days ago

Last modified

Share

Give it a list of web page URLs, raw HTML documents, or both, and it prints each one to PDF in headless Chrome. Every PDF goes into the run's key value store, and the dataset gives you a direct download link with the page count and file size.

Use it for invoices, reports, receipts and certificates built from your own HTML templates, or to archive web pages as PDF.

Options

  • Page size: Letter (default), Legal, Tabloid, Ledger, A0 to A6, or a custom width and height such as 4in by 6in or 210mm by 297mm
  • Sideways pages: turn each page on its side, wider than tall
  • Margins for each side, in in, cm, mm or px (default 0.5in)
  • Print backgrounds: background colors and images (default on)
  • Scale of the content, from 0.1 to 2
  • Page numbers: a centered "Page 1 of 3" footer with one switch
  • Header and footer templates in HTML. Chrome fills in these classes for you: date, title, url, pageNumber and totalPages, as in <span class="pageNumber"></span>. For raw HTML, url prints about:blank. Set a font size inside the template, such as style="font-size:9px", and leave a margin big enough to hold it.
  • Page ranges, such as 1-3 or 1,4
  • Use the page's own CSS page size when it sets one with an @page rule
  • CSS media type: print (default) uses the page's print stylesheet; screen applies the page's screen styles instead
  • Tagged PDF with structure tags for screen readers (default on)
  • Bookmarks built from the page headings
  • Browser language (default en-US), sent to sites that serve several languages
  • Wait until the load event (default), DOM content loaded or network idle, plus an extra delay for late content (default 500 ms), and a page timeout (default 60 seconds)
  • Viewport width while the page loads (default 1,280 pixels)

Raw HTML documents

Each entry is an object with an html field and an optional name, used in the file name:

[
{"name": "invoice-1001", "html": "<!doctype html><html><head><title>Invoice 1001</title></head><body><h1>Invoice 1001</h1></body></html>"},
{"name": "with-images", "baseUrl": "https://www.example.com/assets/", "html": "<img src='logo.png'>"}
]

Add baseUrl when the HTML loads images or stylesheets by relative path; the paths are resolved against it. A plain string in the list is treated as the HTML of one document.

Output

Dataset: one item per URL or document with pdfUrl (download link), pdfKey (the file name in the key value store), source, type (url or html), title, pages, bytes, pageFormat and landscape. URLs also get finalUrl (after redirects) and status, the HTTP status of the page. Files are named by their position in your list and the source, such as 0001-example-com.pdf.

An input that cannot be printed gets ok: false and an error, such as an unknown host, a page timeout, or an empty html field. One bad input never stops the run. A page that answers with an HTTP error such as 404 is still printed, and its status shows the code.

Pricing

Pay per event: one event per PDF created. Inputs that fail are not charged. The run stops when it reaches the maximum charge you set.

Scope and conduct

Only the URLs you supply are opened, one at a time, each in a fresh browser context with no cookies carried over. No proxies are used, and the actor does not log in anywhere or collect personal data. Print pages you are allowed to copy.

Support

Questions and problems: the Issues tab on this page. Replies are written by an AI assistant on behalf of the developer and reviewed by the developer.