Skip to content
PDF API · Use case

Print bot-protected pages to PDF, not the challenge screen

Making a PDF of a Cloudflare-protected page fails in the quietest possible way: the file is generated, it opens, and it contains a one-page “Just a moment” screen. Compliance archives, legal evidence, competitor research and report generators all need the actual page on paper. With a Pro key, the PDF API reaches the page through its built-in proxy before it prints, with nothing extra in the request.

The problem

A PDF of a blocked page is a PDF of the bot wall

Antibot services such as Cloudflare, DataDome and Akamai answer datacenter traffic with a challenge or a 403. A headless browser printing to PDF does not know the difference, so it prints whatever it received. The job reports a valid file, the file lands in the archive, and nobody notices until someone opens it months later looking for the original.

Fixing it yourself means putting a proxy between your print server and the web: buying exits, deciding which sites need residential ones, relaunching Chrome with the right flags, and adding a check that the output is not a challenge page. Printing already needs a full browser; stacking proxy management on top turns one job into two systems that fail in different ways.

On Pro plans the PDF request is unblocked automatically. When a page answers with a 403 antibot wall, the API escalates through its proxy tiers, ending with residential IPs, and remembers per domain which tier worked. The page is then rendered with its print stylesheet, adblock removes the consent banners, and the result is a hosted PDF of the real content.

How it works

How to save a bot-protected page as PDF

Send the same PDF request you would send for any page, with a Pro key. The PDF troubleshooting guide covers blocked sites next to layout and timing issues.

1 · Print the protected page
import createClient from 'microlink.io'

const microlink = createClient({
  apiKey: process.env.MICROLINK_API_KEY
})

const { url, size_pretty: size } = await microlink.pdf(
  'https://news.example.com/2026/report',
  { format: 'A4', margin: '1cm', retry: 3 }
)

No proxy option: the Pro key is enough. The response is the hosted PDF with its url and size, printed from the real page; retry: 3 absorbs intermittent challenges.

2 · Record the route with the file
import createClient from 'microlink.io'

const microlink = createClient({
  apiKey: process.env.MICROLINK_API_KEY
})

const mode = microlink.last.response.headers.get('x-fetch-mode')

const record = {
  source: 'https://news.example.com/2026/report',
  pdf: url,
  viaProxy: mode.endsWith('-proxy'),
  savedAt: new Date().toISOString()
}

x-fetch-mode ends in -proxy, for example prerender-proxy, when the page was reached through the proxy. Storing it with the file tells you later which archived PDFs came from protected sites.

3 · The same request as a URL
curl 'https://pro.microlink.io/?url=https%3A%2F%2Fnews.example.com%2F2026%2Freport&pdf.format=A4&pdf.margin=1cm&meta=false&retry=3' \
  -H 'x-api-key: $MICROLINK_API_KEY'

The Pro endpoint with your x-api-key header prints through the proxy when the site requires it. Keep the call server-side: an API key never belongs in a public PDF link.

Parameters used
  • pdf.format Paper size such as A4 (the default) or Letter.
  • pdf.margin Whitespace around the content. Default 0.35cm.
  • retry Server-side retries with exponential backoff. Default 2.
  • timeout 60 seconds on Pro by default. Leave it there: the residential route is the slowest.
  • proxy.location Optional. Prints the page as seen from a given country. Default us. Pro plans.

Store the file yourself once it is generated, as the article archiving recipe shows; the hosted URL is for delivery, not retention. For a quick one-off without code, the website to PDF tool prints any public URL.

Why it works

Why the PDF API should handle the proxy, not your print server

A PDF is a record. If it records the bot wall, the archive is wrong in a way no one sees. One request that owns the route and the print removes that failure mode.

01 · No extra option
The same PDF request, now unblocked.
On Pro plans automatic proxy resolution is on by default. Your existing format, margin, styles and page range options stay exactly as they are; the proxy only changes how the page is reached.

The same mechanism unblocks screenshots of bot-protected websites and Markdown from blocked pages.

02 · Residential when needed
Escalation, then memory per domain.
A 403 antibot wall triggers the proxy tiers, ending with residential IPs, the slowest route and the one that usually gets through. The tier that worked is cached for the domain, so a batch of PDFs from one site does not repeat the search.

The route is tested against the 500 most popular websites; see how it works on the proxy feature page.

03 · A clear failure
EPROXYNEEDED instead of a useless file.
On the free endpoint, a protected page fails with EPROXYNEEDED rather than producing a PDF of the challenge. You never archive a bot wall by accident; you get an error you can act on.

When not to: pages behind a login or a paywall are not bot walls. Forward your own session as described in the PDF private pages guide, and only print content you are permitted to keep.

FAQ

How do I save a Cloudflare-protected page as PDF?

Send the PDF request to the Pro endpoint with your API key. Automatic proxy resolution handles the Cloudflare wall before the page is printed, so the request is the same as for any other URL.

Why is my PDF a one-page “Just a moment” screen?

The site served its antibot challenge instead of the page, and the browser printed what it received. Through the API on a Pro plan, that 403 triggers the proxy escalation, and the PDF is printed from the real page.

Do I need to add a proxy option to PDF requests?

No. On Pro plans the proxy is automatic. Pass proxy.location only when you want the PDF as seen from a specific country, or proxy.url when you must use your own proxy server.

Does printing a blocked page to PDF take longer?

It can. The residential tier is the slowest route, so the first PDF from a protected domain may take longer than a direct one. Later requests to that domain go straight to the tier that worked, and cached PDFs return without any fetch.

Does the PDF proxy get past logins or paywalls?

No. It gets past blocks aimed at automated traffic, not access controls. Authenticated pages need your own session forwarded as request headers, and only where you are allowed to print that content.
Related use cases

Solve the next problem with the same API

Archive web articles as PDF

Keep readable, searchable PDFs of articles and docs, printed with their print styles and trimmed to the pages you need.

PDFs in bulk

Render thousands of documents from URLs in one job: parallel requests, server-side retries and per-document caching.

Screenshot blocked websites

When a site blocks headless browsers, a Pro key escalates the capture through proxy tiers automatically.

Markdown from bot-protected pages

Convert pages behind Cloudflare, DataDome or Akamai: on a Pro key the built-in proxy resolves automatically.

Link previews for bot-protected sites

Unfurl links to sites behind Cloudflare or DataDome: on a Pro key the built-in proxy resolves automatically.

Scrape Cloudflare-protected websites

Get the real page instead of “Just a moment”: on Pro plans, blocked requests escalate through proxy tiers up to residential IPs.

Ready to print the pages that block bots?

Same PDF request, real page, no proxy list. Get a Pro key and stop archiving challenge screens.