PDF API
PDF generator API
Send the address of a web page, or your own HTML, and get back a PDF, printed by a headless Chromium browser with JavaScript. Choose the paper size, orientation, margins and page ranges, or put the whole page on one long PDF page.
Example request and response
The answer is the PDF itself. Add upload=true to store it instead and get JSON with its URL, or attachment_name=invoice-42 to name the download invoice-42.pdf. Errors come back as JSON with a status code. All parameters are in the PDF documentation.
curl -G "https://api.screenshotbase.com/v1/take" \
--data-urlencode "url=https://example.com" \
-d format=pdf \
-d pdf_paper_format=A4 \
-d pdf_margin=15mm \
-H "apikey: YOUR-API-KEY" \
-o page.pdf
HTTP/1.1 200 OK
Content-Type: application/pdf
X-Cost: 1
(the PDF, served as a download)
PDF options
- pdf_paper_format
A4(default),Letter,LegalorA3.- pdf_landscape
- Turn the paper to landscape.
- pdf_margin, pdf_margin_top, pdf_margin_right, pdf_margin_bottom, pdf_margin_left
- Margins in mm, cm, in or px, up to 4 inches per side.
pdf_marginalso takes the CSS shorthand, such as10mm 20mm. The default is 0. - pdf_media_type
print(default) uses the page's print stylesheet, like Save as PDF in a browser;screenprints the page as it looks on screen.- pdf_print_background
- Print background colors and images (on by default).
- pdf_scale
- Scale the rendering from 0.1 to 2, for example 0.8 to fit wide content.
- pdf_page_ranges
- Pages to keep, such as
1-3,5. A PDF has at most 30 pages. - pdf_fit_one_page
- The whole page on a single PDF page as wide as the paper, up to 200 inches tall.
- wait_until, delay, block_cookie_banners, block_ads, hide_selectors, styles
- Prepare the page before it is printed, as for screenshots.
delayis at most 7 seconds for PDFs. - upload
- Store the PDF and return
{"url": ...}instead of the file. Anyone with the URL can open a stored file.
Use cases
Archive web pages
Keep a dated PDF of terms of service, price lists, ads or articles, as evidence or for records.
Reports and dashboards
Print a report page that your application serves at a public URL, with its print stylesheet, on A4 or Letter.
Read later and share
Turn articles and documentation pages into PDFs for offline reading, e-readers or email attachments.
Invoices from your HTML
Send the HTML your application generates to POST /v1/take and get it back as a PDF. See the HTML to PDF API.
Receipts and long pages
Put a whole page on one long PDF page with pdf_fit_one_page, without page breaks.
AI agents
Through the MCP server, an agent can create a PDF with the take tool. It passes upload: true and gets the URL of the stored file.
Start on the free plan
PDFs are part of every plan, including the free plan with 300 requests a month. Each PDF counts as one request, also when you store it with upload=true; PDFs that fail are not counted. Paid plans start at $15 a month for 3,000 requests.
Frequently asked questions
How long can a PDF take?
wait_until=domcontentloaded does not wait for all of them.How many pages can a PDF have?
pdf_page_ranges to pick pages, or pdf_fit_one_page to get the whole page on one page.Are pages with JavaScript supported?
wait_until or a short delay if content appears late.Are my PDFs stored?
upload=true, the API returns the PDF and does not keep it. With upload=true, the PDF is stored and anyone with the returned URL can open it.Can I test without using my quota?
X-Cost: 0).Can I create a PDF from HTML instead of a URL?
POST /v1/take with format=pdf. All PDF options work the same. See the HTML to PDF API.