Use chrome --headless --print-to-pdf https://example.com/ to save a webpage as output.pdf in the current working directory. Add --no-pdf-header-footer to omit Chrome’s date, time, URL, and page-number print headers and footers; use --timeout or --virtual-time-budget only when the page’s loading or script behavior calls for it.
Print a webpage to PDF with Chrome Headless
Run this command in a terminal, replacing the example URL with the page you want to capture:
As an Amazon Associate I earn from qualifying purchases.
chrome --headless --print-to-pdf https://example.com/
Chrome writes a file named output.pdf to the current working directory. The official Chrome Headless documentation documents this default output behavior. Run the command from the directory where you want that file to appear.
Check that Chrome is available
The command assumes the Chrome executable is available as chrome in your shell. If the shell reports that the command is not found, invoke the installed Chrome executable using its path or configure your environment so the executable can be found. The exact executable path depends on your operating system and installation; the documented command does not specify a universal path.
#1 Best Overall
Remove the date, URL, and page number
To suppress Chrome’s automatic print header and footer, add --no-pdf-header-footer:
chrome --headless --print-to-pdf --no-pdf-header-footer https://example.com/
This removes the header containing the current date and time and the footer containing the page URL and page number. The current documented flag replaces the older spelling --print-to-pdf-no-header; if Chrome rejects the current flag, check the installed Chrome version and try the legacy spelling for an older version.
Choose when Chrome captures the page
Chrome documents two timing options that address different situations. Neither example value below is a universal wait setting or a guarantee that a page’s asynchronous work has finished.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #2
| Option | What it does | Use it when |
|---|---|---|
--timeout=<milliseconds> |
Sets a maximum wait before capture; Chrome captures when that wait expires even if the page is still loading. | You need to cap how long the command waits before taking the PDF. |
--virtual-time-budget=<milliseconds> |
Advances virtual time while the browser executes page code. | The page’s output depends on timers or other time-dependent script behavior. |
Use a maximum wait for loading pages
For example, this command sets a maximum wait of 5,000 milliseconds:
chrome --headless --print-to-pdf --no-pdf-header-footer
--timeout=5000 https://example.com/
The 5000 value is Chrome’s documented example, not a recommended default. Tune it for the page and the capture point you need. When the wait expires, capture can proceed while loading continues; a timeout does not establish that every request, image, or application update has completed.
Advance virtual time for timer-driven content
For content that changes through time-dependent page scripts, use --virtual-time-budget. Chrome’s reference illustrates --virtual-time-budget=42000 for a page whose counter updates over 42 seconds. That demonstrates the mechanism; it is not a general setting for unrelated pages. Virtual time lets scripts progress, but should not be treated as proof that a page’s network activity or application is ready.
Rank #3
Combine the options carefully
A typical invocation with a capped wait and no print headers or footers is:
Recommended Free Tools
chrome --headless --print-to-pdf --no-pdf-header-footer
--timeout=5000 https://example.com/
Change the timeout to suit the page rather than assuming five seconds is enough. If the page relies on timers, consider a virtual-time budget instead; choose the timing option based on the page behavior you need to capture.
Troubleshoot common problems
- No PDF appears where expected: Chrome saves
output.pdfin the current working directory. Check the directory from which you launched the command. - The PDF still has date, URL, or page number: include
--no-pdf-header-footer. If Chrome does not recognize that flag, check its version; older versions may use--print-to-pdf-no-header. - The PDF captures incomplete content: increase the maximum wait if the page is still loading at capture time. A timeout only caps waiting and does not guarantee page readiness. For timer-driven content, use a virtual-time budget appropriate to that script behavior.
- The command is rejected or Chrome will not start: verify that the Chrome executable is installed and that your shell can locate it as
chrome. Check the installed version if a flag is rejected.
Or skip the browser setup
For a single-request PDF capture, ScreenshotNeo accepts a URL and returns a PDF. See the ScreenshotNeo API documentation for its options.
Rank #4
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://example.com/
-d format=pdf
-o page.pdf
- It removes cookie banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off.
- Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status.
- An MCP server provides screenshot and PDF-capture tools for AI agents and MCP clients.
- The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.
Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.
FAQ
Can I choose a different output filename with this documented command?
The documented reference establishes output.pdf in the current working directory; it does not specify an arbitrary output-path syntax.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsDoes a five-second timeout mean the PDF captures a fully loaded page?
No. Chrome’s timeout is a maximum wait, and capture can occur while the page is still loading.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




