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.
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 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.
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.
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.
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.
- 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 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.
The same mechanism unblocks screenshots of bot-protected websites and Markdown from blocked pages.
The route is tested against the 500 most popular websites; see how it works on the proxy feature page.
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?
Why is my PDF a one-page “Just a moment” screen?
Do I need to add a proxy option to PDF requests?
Does printing a blocked page to PDF take longer?
Does the PDF proxy get past logins or paywalls?
Solve the next problem with the same API
Archive web articles as PDF
PDFs in bulk
Screenshot blocked websites
Markdown from bot-protected pages
Link previews for bot-protected sites
Scrape Cloudflare-protected websites
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.