URL to PDF Converter - Web Pages and HTML
Pricing
from $0.01 / 1,000 row returneds
URL to PDF Converter - Web Pages and HTML
Convert public web pages or your own HTML documents to PDF. Set page size, margins, orientation, scale, page ranges, headers and footers. Get a download link, page count and file size for each PDF.
Pricing
from $0.01 / 1,000 row returneds
Rating
0.0
(0)
Developer
bite-sized-insights
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
15 hours ago
Last modified
Categories
Security
Limited permissionsShare
URL to PDF Converter - Web Pages and HTML to PDF
Turn any public web page, or HTML you generate yourself, into a print-ready PDF. Give it a list of URLs or HTML documents; every one comes back as a PDF file with a public download link. Control page size, orientation, margins, headers, footers and what to wait for before a page is captured.
What this actor does
- Converts web pages and raw HTML. Paste URLs, pass your own HTML (invoices, reports, receipts), or both in the same run.
- Real page rendering. Pages are loaded the way a visitor sees them, including content that appears after the page opens, so modern sites come out complete instead of blank.
- Print layout control. Page format (A0-A6, Letter, Legal, Tabloid, Ledger) or a custom size, portrait or landscape, individual margins, scale, page ranges, background colors and images on or off.
- Wait conditions. Wait for the page to finish loading, for the network to go quiet, for a specific element to appear, or for a fixed extra moment. Each document has its own time limit.
- Headers and footers. Add HTML headers and footers with automatic page numbers, total pages, date, title and URL.
- Public download links. Each PDF is stored with the run and linked in the results, ready to download or to hand to the next step of your workflow.
- Runs documents in parallel and delivers results as each one finishes.
Quick start
{"urls": ["https://example.com"]}
Click Start. Each PDF appears in the results as soon as it is ready, with a link in the pdf_url column.
Convert your own HTML
{"urls": [],"htmlDocuments": ["<html><body><h1>Invoice 2026-001</h1><p>Total: 120.00 EUR</p></body></html>"],"pageFormat": "Letter","marginBottom": "20mm","footerHtml": "<div style=\"font-size:9px\"><span class=\"pageNumber\"></span></div>"}
The URL list has an example prefilled; empty it (as above) when you only want to convert HTML.
Input parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
urls | Array[String] | ["https://example.com"] | Public web pages to convert, up to 100. Domain or full URL. |
htmlDocuments | Array[String] | [] | Complete HTML documents, up to 20, each up to 1,000,000 characters. |
pageFormat | String | A4 | A0-A6, Letter, Legal, Tabloid or Ledger. |
pageWidth, pageHeight | String | - | Custom page size, e.g. 100mm and 150mm. Set both; replaces the format. |
landscape | Boolean | false | Landscape instead of portrait. |
marginTop, marginRight, marginBottom, marginLeft | String | 10mm | Margins, e.g. 10mm, 1in. |
scale | Number | 1 | Content zoom, 0.1 to 2. |
pageRanges | String | all pages | Keep only some pages, for example 1-3, 5. |
printBackground | Boolean | true | Include background colors and images. |
preferCssPageSize | Boolean | false | Use the page size set by the page's own print styles, if it has one. |
mediaType | String | print | print applies the page's print styles, screen keeps the screen look. |
headerHtml, footerHtml | String | - | HTML repeated on every page. See below. |
waitUntil | String | load | load, domcontentloaded (fastest) or networkidle (waits for late content). |
waitForSelector | String | - | CSS selector that must be present before the page is converted. |
waitMs | Integer | 0 | Extra pause in milliseconds after the page is ready, up to 10000. |
timeoutSeconds | Integer | 30 | Time limit per document, 5 to 120. |
failOnHttpError | Boolean | true | Skip the PDF when the page answers with an error status such as 404 or 500. |
viewportWidth, viewportHeight | Integer | 1280, 1024 | Size of the virtual window the page is laid out in. |
At least one URL or one HTML document is required. Only public http(s) addresses are accepted: entries pointing at private or local addresses, containing credentials, or otherwise malformed are rejected as invalid input before any work starts.
Headers and footers
Headers and footers are small pieces of HTML. Give them an inline font size and a top or bottom margin large enough to
hold them. These placeholders are filled in automatically when used as the class of an empty span:
pageNumber, totalPages, date, title and url.
Output
One row per document, in the results table and the dataset. The PDF itself is stored with the run; pdf_url is the
public link to download it.
Successful conversion
{"source": "https://example.com/","source_type": "url","status": "success","pdf_url": "https://api.apify.com/v2/key-value-stores/xxxxxxxxxxxxxxxxx/records/pdf-0001-1a2b3c4d.pdf","pdf_key": "pdf-0001-1a2b3c4d.pdf","page_count": 1,"file_size_bytes": 92999,"render_seconds": 0.54,"final_url": "https://example.com/","http_status": 200,"error": null}
Document that could not be converted
{"source": "https://example.com/missing","source_type": "url","status": "failed","pdf_url": null,"pdf_key": null,"page_count": null,"file_size_bytes": null,"render_seconds": null,"final_url": null,"http_status": null,"error": "The page responded with HTTP 404"}
Every row has the same keys. HTML inputs are labelled HTML document 1, HTML document 2, ... in source; final_url
and http_status only apply to URL inputs.
A document fails when the page cannot be reached, answers with an error status (unless failOnHttpError is off), is
not allowed (private or local addresses), or exceeds its time limit. Failed documents are not charged. A problem with
the run's access to the conversion service ends the run with an error message instead of producing rows.
Pricing: pay per PDF
You pay for every PDF that was created and delivered, plus a small flat fee per run. Failed documents are free. Apify's platform dataset-item fee ($0.00001 per row) applies to every row written to the dataset, including failed rows.
| Event | Price |
|---|---|
| PDF created and delivered | $0.005 (about $5 per 1,000 PDFs) |
| Run start | $0.00005 |
Free test runs
New users on Apify's free plan get up to 5 free runs of this actor (lifetime total), each capped to 3 documents. Runs started via the Apify Console's "Test" button are capped to 3 documents too, regardless of plan, and don't count against the 5 free runs.
How long does a run take?
Most pages take one to five seconds each, with up to 2 documents processed at once. Pages that load content late, or that you ask to wait for an element or for the network to settle, take longer, up to the time limit you set. Results stream into the dataset as each document finishes.
FAQ
Can I convert pages behind a login?
No. Only publicly reachable pages can be converted. For private content, pass the page's HTML in htmlDocuments
instead.
Why is my PDF missing content that I see in my browser?
The page probably loads that content late. Try waitUntil: networkidle, waitForSelector with an element that
appears once the content is there, or a short waitMs. Some sites also show different content to printed pages: set
mediaType to screen to keep the on-screen look.
How long are the PDF links available?
The files are stored with the run, so they stay available as long as the run's data does. Download or copy them if you need them for longer. Anyone who has the link can open the file, so treat links like the data they point to.
Are there size limits?
HTML documents can be up to 1,000,000 characters, and a single PDF can be up to 50 MB.
Disclaimer
Only convert pages you are allowed to copy and store. The actor does not alter page content, and what ends up in the PDF depends on what the page shows at the time of conversion.
Need help? Open an issue on the actor's repository or contact support through Apify Console.