Updated
How to Convert a URL to PDF (One Page or Thousands)
1. One page: the browser
Print (Ctrl+P or Cmd+P), destination Save as PDF, enable Background graphics if colours matter. Quick, but manual and not repeatable.
2. Scripted: headless Chromium
npm i playwright
node -e "const {chromium}=require('playwright');(async()=>{const b=await chromium.launch();const p=await b.newPage();await p.goto('https://example.com',{waitUntil:'networkidle'});await p.pdf({path:'page.pdf',format:'A4',printBackground:true});await b.close()})()"PDF printing works in headless Chromium only. Pages that load images on scroll need a scroll before pdf(); banners can be hidden with page.addStyleTag.
3. Common problems
- Blank or half-empty PDF: the page builds itself with JavaScript; wait for the network to settle or for a selector.
- Missing images: lazy loading; scroll to the bottom first.
- Cookie or chat overlays: hide them with CSS rather than clicking consent.
- Block pages: some sites answer automated browsers with a challenge; treat that as an error, not as the page.
4. Many URLs
For archiving, compliance records or reports over hundreds of pages, Plainprobe Website Screenshot returns a PDF (or PNG, JPEG, WebP) per URL with a direct link, hides common cookie banners with CSS, runs pages in parallel with retries, and reports blocked or failed pages as typed errors that are not charged ($0.003 per full-page capture or PDF). To turn PDFs back into text for an AI model, see PDF to Markdown for LLMs.
Limits to keep in mind
- Print layouts differ from the screen: some sites ship a print stylesheet that hides parts of the page.
- Very long pages are split into many sheets; a full-page image may suit visual records better.
- Respect each site's terms and robots.txt, and convert only public pages.
FAQ
How do I save a web page as a PDF?
For one page, use the browser's Print dialog and choose Save as PDF. For many pages or a scheduled job, a headless browser (Chromium through Playwright or Puppeteer) renders each URL and prints it to PDF with the same settings every time.
Why does my PDF have a cookie banner or missing images?
The page was printed before lazy-loaded images appeared, or with the consent banner on top. Scroll the page before printing and hide the banner with CSS; do not click Accept on the visitor's behalf.
PDF or full-page screenshot?
A PDF keeps selectable text and splits the page into printable sheets; a full-page PNG keeps the exact on-screen look in one image. Archive with PDF, compare visual changes with images.
Can I convert pages behind a login?
Not with a public converter. Convert only public pages, or pages you are allowed to automate.