A PDF generation API that turns HTML or any URL into a PDF with one request
The Browserless PDF generation API renders your HTML or a live page in real Chrome and returns a paginated, text-searchable PDF. Headers, footers, page sizes, and wait conditions are request options, and there is no browser to install or scale.
175M+
Docker pulls
8 years
in production
99.9%
uptime
SOC 2
Type II
Trusted by engineering teams
Security and compliance
See the Trust CenterWhat is a PDF generation API?
A PDF generation API is an HTTP endpoint that takes HTML or a URL and returns a finished PDF, so your application never runs a browser or a PDF library itself. The Browserless /pdf endpoint loads your content in Chrome, waits for it to be ready, and prints it with the page size, margins, headers, and footers you specify. One POST request in, one application/pdf response out.
What teams generate with the PDF API
The /pdf endpoint sits behind billing systems, reporting jobs, and compliance pipelines.
- 01
Invoices and receipts
Render a billing template with the customer's data to a PDF the moment an order closes, with page numbers and your branding in the footer.
- 02
Dashboard and report exports
Print an authenticated dashboard or a scheduled report exactly as it renders, charts included, and email it or drop it into storage.
- 03
Contracts and certificates
Generate agreements, statements, and certificates from HTML so a design change is a template edit rather than a new PDF library.
- 04
Email attachments
Turn a transactional email's HTML into a PDF attachment in the same request pipeline that sends the message.
- 05
Archiving web pages
Capture a dated, text-searchable PDF of a page for compliance records, legal holds, or audit trails.
- 06
Documentation and ebooks
Compile long-form HTML into paginated PDFs with running headers and a document outline for navigation.
What the Browserless PDF API can render
The /pdf endpoint covers both halves of the job: HTML to PDF for templates you own, and URL to PDF for pages that already exist.
html field with your markup and get a PDF back. Render invoices, reports, and certificates from a template without hosting the page anywhere first.url and the API loads it in real Chrome, runs its JavaScript, and prints the rendered page. Single-page apps and dashboards come out the way they look on screen.displayHeaderFooter and pass HTML templates for the header and footer. The pageNumber, totalPages, date, title, and url classes fill in per page.format such as A4 or Letter, or set explicit width and height. Margins, landscape, scale, and pageRanges are all request options.waitForSelector, waitForFunction, waitForEvent, or waitForTimeout so charts, fonts, and late-loading data are on the page before it prints.addStyleTag and addScriptTag to apply print CSS, load a font, hide navigation, or rewrite content before the PDF is generated.How to generate a PDF with the Browserless API
Three steps, one POST request, and real Chrome doing the printing.
- 01
Sign up for free
Create a free Browserless account with no credit card required. The Free plan includes 1k units a month and 2 concurrent browsers, and your API token is in the dashboard as soon as you sign in.
- 02
Send the request
POST to the
/pdfendpoint with aurlor anhtmlfield, but not both, plus any options. Swap the host forproduction-lonorproduction-amsto render closer to your users. - 03
Handle the response
The API responds with
application/pdfbinary. Save it to disk, stream it to the browser, or hand it to storage. The text stays selectable because Chrome prints the page rather than photographing it.
Each example is a complete request. Swap in your token and run it.
curl -X POST --fail-with-body \
"https://production-sfo.browserless.io/pdf?token=YOUR_API_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"url": "https://example.com/",
"options": {
"format": "A4",
"printBackground": true
}
}' \
--output "page.pdf"The Node example renders raw HTML with a header and page-number footer. The Python example prints a URL after waiting for a selector. The clean-output example hides navigation, blocks ads and consent banners, and emits a tagged PDF.
The PDF options that matter
Everything under options maps to Chrome's print settings. These are the ones most requests end up setting.
Option
What it does
The full list, including omitBackground, waitForFonts, and outline, is in the PDF API docs.
Hosted PDF API or do it yourself?
The honest version: each approach has a place. Here is where the lines fall.
Puppeteer page.pdf()
- Best for
- Full control from your own code, with the same Chrome print engine, for a handful of PDFs a day on infrastructure you already run.
- Limitation
- You install, patch, and scale Chrome yourself. Memory and zombie processes become your on-call problem.
wkhtmltopdf
- Best for
- Static, simple HTML where fidelity does not matter, from a single binary with no browser to manage.
- Limitation
- No longer maintained and built on an old WebKit engine, so CSS grid and flexbox, web fonts, and JavaScript-rendered content come out wrong or not at all.
Browserless /pdf
- Best for
- Production volume, dynamic pages, and any team that would rather not run browsers. Real, current Chrome over one HTTP call, with waiting, proxies, header and footer templates, and tagged output built in.
- Limitation
- A network round trip and a per-session unit instead of a library import.
Beyond PDFs: which Browserless API fits the job?
The PDF endpoint is one of several REST APIs in the Browserless platform, and none of them need a local browser or an installed automation library. Prefer the library route? The combined Screenshot, PDF and Screen Recording page covers Puppeteer and Playwright.
| If you need to… | Use… |
|---|---|
| Capture a page as a PNG, JPEG, or WebP image instead of a PDF | Use…Screenshot API |
| Get a page's rendered HTML, or run your own Puppeteer code over HTTP | Use…REST APIs |
| Print a page that sits behind bot detection or a CAPTCHA | Use…Web Unblocker |
| Keep page.pdf() in your own Puppeteer or Playwright script | Use…Browsers as a Service |
PDF generation API FAQs
PDF generation API FAQs
Ready to generate your first PDF?
Grab a token, paste the cURL call, and you have a PDF in a few seconds. The free plan includes 1k units a month, no credit card required.