Generate a PDF of a URL using only the headless Chrome/Chromium command-line binary, with no automation library

domain: developer.chrome.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Run chrome --headless --print-to-pdf <url>, which writes output.pdf into the current working directory
  2. Add --no-pdf-header-footer to omit the default print header/footer (date, URL, page number)
  3. Add --timeout=<ms> to cap how long Chrome waits for the page to finish loading before capturing the PDF
  4. For pages with time-based JavaScript, add --virtual-time-budget=<ms> to fast-forward virtual time before capture
  5. If output looks wrong, launch with --remote-debugging-port=0, read the printed WebSocket URL, and inspect via chrome://inspect

Known gotchas

Related routes

Drive headless Chrome directly via the Chrome DevTools Protocol (CDP) without a high-level browser automation library
chromedevtools.github.io · 5 steps · unrated
Execute a raw Chrome DevTools Protocol command from Selenium 4 for which no dedicated Selenium API exists
selenium.dev · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans