October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Configure Chrome Headless Print-to-PDF Options

Use Chrome Headless to save webpages as PDFs, suppress automatic print headers and footers, and choose capture timing based on how the page loads.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Combine the options carefully

A typical invocation with a capped wait and no print headers or footers is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.pdf in 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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

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.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does 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.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.