HTML to PDF API

PDFs of the page. Not the cookie banner.

An HTML-to-PDF API that removes consent walls before it prints. A cookie banner does not just sit on top of a PDF — it collapses the document to a single page. We measured it: theguardian.com prints as 1 page with the wall and 22 without it.

Start without a key Read the API

1 page 22 pages

What a consent wall does to a PDF

Not a mock-up. These are the same URL through the same endpoint, twice each, changing one parameter:

PageConsent platform overlay_mode=off overlay_mode=dismiss
theguardian.com/internationalSourcepoint 1 page22 pages
economist.comOneTrust 1 page9 pages

The failure is silent. You get a valid PDF, HTTP 200, one page, and none of the article — which is why this is worth a product rather than a flag.

A consent wall truncates a PDF

This is worse than the screenshot case, and less obvious. The overlay locks scrolling on the body, so the printable document ends at the fold — you get one page of cookie notice where the article was. No error, no warning, a valid PDF containing nothing you wanted.

Same key, same plan, same quota

A PDF costs one render against the allowance you already have. There is no second subscription, no second key and no separate billing — if you are already using the screenshot API, this works today with the key in your environment.

Paper controls that behave

A3 through tabloid, landscape, margins in any CSS unit, scale, page ranges and printed page numbers. Chromium drops a footer that has no margin to sit in, so we widen the margin for you rather than let the option silently do nothing.

Print or screen, your call

Default is the site's own print stylesheet, which is usually what its author intended. Plenty of sites have none, or hide half the page in print — pass media=screen and you get the document a reader sees.

One call, no signup POST /v1/pdf application/pdf

# No key needed. Paste this as it is.
curl -X POST https://shots.rendershed.com/v1/pdf \
  -H "Content-Type: application/json" \
  -d '{"url": "theguardian.com/international", "footer": "page-numbers"}' \
  -o article.pdf

# Leave overlay_mode alone. With the consent wall in place this page
# prints as ONE page; with it removed, twenty-two.
const res = await fetch("https://shots.rendershed.com/v1/pdf", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    // Optional. Without it you are on the anonymous tier.
    ...(process.env.RENDERSHED_KEY && {
      "X-API-Key": process.env.RENDERSHED_KEY,
    }),
  },
  body: JSON.stringify({
    url: "https://stripe.com/docs",
    page_format: "a4",
    margin: "12mm",
    footer: "page-numbers",
  }),
});

const pdf = Buffer.from(await res.arrayBuffer());
import os, requests

# The header is optional; leave it out to use the anonymous tier.
res = requests.post(
    "https://shots.rendershed.com/v1/pdf",
    headers={"X-API-Key": os.environ.get("RENDERSHED_KEY", "")},
    json={
        "url": "https://www.economist.com",
        "page_format": "letter",
        "landscape": True,
        "media": "screen",   # this site has no useful print stylesheet
    },
    timeout=90,
)
open("report.pdf", "wb").write(res.content)
<!-- signed server-side; no key reaches the browser.
     Opens in the PDF viewer, saves as example.com.pdf -->
<a href="https://shots.rendershed.com/v1/pdf?url=https%3A%2F%2Fexample.com&kind=pdf&sig=..."
   download>Download as PDF</a>

40 an hour without a key, metered against your address. A key raises that and detaches it from where you are calling from.

Width, and why it matters here

Chromium lays a printed page out at the paper's printable width, not at the browser window — on A4 with 10mm margins that is 719 CSS px, which is nobody's breakpoint. Sites come out with hamburger menus and half-collapsed grids for no visible reason. So width here means what it says: we work out the scale that makes the document lay out at that width and shrink it onto the sheet, which is why a PDF looks like the site rather than like a phone. Pass scale: 1 if you would rather have the page reflow to the paper and get larger type — usually the better choice for a long article.

Parameters

NameTypeDefaultDescription
url stringrequiredThe page to render. http and https only.
page_format enuma4a3, a4, a5, letter, legal or tabloid.
landscape boolfalseRotate the paper.
margin string10mmOne CSS length for all four sides — 10mm, 0.5in, 20px.
scale floatautoOverrides width. Set 1 to let the page reflow to the paper instead of being laid out wide and shrunk.
print_background booltrueKeep background colours and images.
page_ranges stringSubset to keep, e.g. 1-3. Empty means the whole document.
prefer_css_page_size boolfalseHonour the page's own @page size over page_format.
media enumprintprint uses the site's print stylesheet; screen prints what a reader sees.
footer enumnonepage-numbers prints “n / total” at the foot of each page.
device enumiphone, android or ipad. Sets the viewport, the user agent and the touch flags together, so a site that sniffs the agent still serves its mobile page. Overrides width and height.
width int1280The CSS width the document is laid out at, then shrunk to fit the sheet. Lower it for bigger type, raise it for a wider desktop layout.
overlay_mode enumdismissoff, hide or dismiss. Leave this on unless you want the wall.

It is on the plan you already have

There is no separate PDF subscription and no separate key. A PDF counts as one render against the same monthly allowance as a screenshot, on the same ladder — $0 for 100 / month, $9.99 for 3,000 / month, $39.99 for 20,000 / month, $99 for 75,000 / month. Cached documents are free at every tier.

See the plans Both products