URL to PDF API

Send any public URL to the Screenshot endpoint with format: "pdf" and get back the rendered page as a vector PDF. Real Chrome loads the page, JavaScript runs, and the result paginates onto A4. Point it at a single page as a webpage to PDF API, or loop it over a sitemap as a website to PDF API; the request is the same either way.

Free for the first 25 renders a month. No credit card.
No code needed? Try the free URL to PDF converter in your browser.
url-to-pdf.sh bash
curl -X POST https://app.html2img.com/api/screenshot \
  -H 'X-API-Key: your-key-here' \
  -H 'Content-Type: application/json' \
  -d '{
    "url": "https://example.com/release-notes",
    "format": "pdf"
  }'

How the render works

We open the url you pass in a current build of headless Chrome, exactly as a visitor's browser would. Stylesheets load, webfonts download and JavaScript executes, so client-rendered content is in place before anything is captured.

Once the page has settled, the rendered result is laid out on A4 portrait pages. Long pages flow across as many pages as they need. There is nothing to configure and no pagination parameter to learn.

Dynamic pages sometimes need a moment longer. If content streams in after load, add ms_delay to wait a fixed period, or wait_for_selector to hold the capture until a specific element exists. Both work in PDF mode exactly as they do for screenshots.

What you get back

A document, not a flattened picture. Some tools rasterise the page and wrap the image in a PDF shell; this returns real, selectable text. The format parameter is the only thing you change.

A text layer you can search

Open the file and select a paragraph. Copy it, search it, feed it to a screen reader. The page arrives as a document, not as a picture of one.

Fonts travel with the file

Webfonts on the source page, whether Google Fonts, Adobe Fonts or self-hosted @font-face, load during the render and are embedded in the PDF.

Backgrounds render by default

Background colours, gradients and images are included without any print-specific flags, so the document looks like the page did.

A URL on the CDN

The response url points to a .pdf file on i.html2img.com, served as application/pdf. Share it, store it or attach it to an email.

The response you get back

The usual JSON envelope, with the url pointing at a .pdf file served as application/pdf from the CDN.

response.json json
{
  "success": true,
  "id": "3f8c2a71-9d44-4e2b-b7a0-52c9e8d1f306",
  "credits_remaining": 499,
  "url": "https://i.html2img.com/image-1784281733921-208114.pdf"
}

What people convert

The common thread is pages you want to keep, not pages you built. When the content lives at someone else's URL and might change or disappear, converting it to a PDF gives you a dated, portable copy with the text intact.

Release notes and changelogs

Archive each release announcement as a dated file. The text stays searchable, so finding the release that introduced a feature takes seconds.

Pricing pages before a change

Snapshot your own pricing page, or a competitor's, before an update goes live. A PDF with real text is a far better record than a screenshot folder.

Terms and policy pages

Keep a copy of terms you have agreed to on sites you do not control. If the page changes later, you hold the version you accepted.

Reports and dashboards

Turn a public report or status dashboard into a file people can circulate, print and file, without asking anyone to visit a link.

Compliance and audit records

Snapshot terms, pricing or disclosures as dated PDF records for your audit trail. When a regulator or a dispute asks what the page said on a given date, you produce the file rather than an argument.

Slow pages, delivered asynchronously

Third-party pages load at their own pace. Pass a webhook_url and the API returns straight away, then delivers the finished file to your endpoint when the render completes.

async-url-to-pdf.sh bash
curl -X POST https://app.html2img.com/api/screenshot \
  -H 'X-API-Key: your-key-here' \
  -H 'Content-Type: application/json' \
  -d '{
    "url": "https://example.com/quarterly-report",
    "format": "pdf",
    "webhook_url": "https://your-app.com/hooks/pdf-ready"
  }'

The MCP server exposes the same option, so an AI agent can turn a URL into a PDF from a single tool call.

Rendering your own markup instead

This endpoint is for pages that already exist at a URL. If the HTML is yours, generated from your own data, skip the hosting step and send the markup straight to the HTML to PDF API. Same key, same format parameter, same vector output, and your invoice or report never needs a public address.

For document shapes you would rather not build at all, the named templates accept the same parameter. Post JSON to an invoice, receipt or certificate template with format set to pdf and the finished document comes back without any HTML on your side.

The scope, stated plainly

This converts public URLs. The renderer arrives as a fresh, unauthenticated browser, so pages behind logins, paywalls or session cookies will not render. There is no cookie or header injection today.

Pages are A4 portrait with automatic pagination. You cannot pick US Letter, landscape, custom sizes or margins, and there are no headers, footers or page numbers.

Rendering uses the page's normal screen CSS. @media print rules are not applied, so the document matches what the browser shows, not what the site's print stylesheet would produce.

If your project needs precise page geometry or print-specific control, a dedicated PDF service will serve you better. If you want a faithful, searchable copy of the page as it renders in Chrome, this does exactly that.

From sign-up to first PDF

Create a free account, copy your API key from the dashboard and send the curl request at the top of this page with a URL of your own. The response arrives in a few seconds with the document already hosted; there is no SDK to install and no callback to configure unless you want one. If a render does not look right, the usual culprit is late-loading content, which wait_for_selector solves in one line.

One credit per PDF

A PDF render costs the same single credit as an image render, from the same monthly pool. No separate PDF tier, no multiplier. See pricing.

Frequently asked questions

Does it work on JavaScript-heavy pages?

Yes. The page loads in real Chrome and its JavaScript runs before anything is captured, so single-page apps and client-rendered content come out as they appear in a browser. For content that arrives late, add ms_delay or wait_for_selector to hold the capture until the page is ready.

Can it convert pages behind a login?

No. The renderer visits the URL as a fresh, unauthenticated browser, so anything behind a login, a paywall or a session cookie is out of reach. If you can generate the HTML yourself from your own system, send it to the HTML to PDF API instead.

What page size does the PDF use?

A4 portrait. Long pages paginate across as many A4 pages as they need, automatically. There are no page size, orientation or margin controls yet, so if your project needs US Letter or landscape output today, a dedicated PDF service is the better fit.

What does a PDF cost?

One credit, the same as a PNG, on every plan. The free tier includes 25 renders a month with no card, and paid plans start at $9 for 1,000 credits. See pricing for the full ladder.

How is this different from taking a screenshot?

A screenshot is pixels: zoom in and it blurs, and nobody can select or search the text. This endpoint returns a vector PDF with a real text layer and embedded fonts, paginated for printing. Same request, same endpoint; the format parameter is the only difference.

What about slow third-party pages?

Pass a webhook_url and the request returns immediately, then we POST the finished file to you when the render completes. Useful for pages you do not control and cannot make faster.

Convert your first URL

25 renders a month on the free tier, images and PDFs alike. No credit card.