HTML URL to PDF File
Fetch a remote HTML page and return a downloadable PDF
GET
1 credit
/v1/convert/html-to-pdf-file
curl -OJ "https://convert.toolkitapi.io/v1/convert/html-to-pdf-file?url=https://toolkitapi.io/invoice/42&page_size=A4"
import httpx
resp = httpx.get(
"https://convert.toolkitapi.io/v1/convert/html-to-pdf-file?url=https://toolkitapi.io/invoice/42&page_size=A4",
)
print(resp.json())
const resp = await fetch("https://convert.toolkitapi.io/v1/convert/html-to-pdf-file?url=https://toolkitapi.io/invoice/42&page_size=A4", {
});
const data = await resp.json();
console.log(data);
# See curl example
Response
200 OK
Binary PDF stream
Content-Type: application/pdf
Content-Disposition: attachment; filename="output.pdf"
Content-Length: 52410
Description
Fetch a remote HTML page and return a downloadable PDF
How to Use
1
1. Supply the HTML URL via the `url` query parameter.
2
2. Pick a `page_size` (A4, Letter, Legal, A3, A5).
3
3. Optionally set a custom `filename` for the download.
4
4. Use `curl -OJ` or a browser link — the PDF streams directly back.
About This Tool
Point this endpoint at a public HTML page and it renders the page with a headless browser, returning a streamed PDF attachment. Perfect for one-click PDF downloads of dashboards, invoices or reports.
Why Use This Tool
- One-click invoices — Render `/invoices/42` to PDF on demand
- Dashboard snapshots — Email a PDF of a live dashboard state
- Article exports — Produce reader-friendly PDFs from public article pages
- Certificates — Render personalized certificates from URLs
Frequently Asked Questions
Does it wait for JavaScript to finish?
Yes — the renderer waits for network idle before printing, so async data-loading pages typically render correctly.
Are cookies/auth supported?
No — the URL must be publicly accessible. For authenticated pages, render server-side and POST the HTML.
What about headers/footers?
The renderer uses default print headers/footers. Customize via CSS `@page` rules in the source HTML.
Start using HTML URL to PDF File now
Get your free API key and make your first request in under a minute.