iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Short answer: Headless Chrome’s --print-to-pdf flag prints a web page; it is not a general PDF-to-PDF converter. To give a local PDF to a website, use Puppeteer to upload it through the page’s file input, wait for the site to finish processing it, then call page.pdf() to save the page’s print rendering. The site determines what the uploaded file becomes.
Choose the workflow that matches your input
| What you have | What you want | Use |
|---|---|---|
| A URL that displays the page to print | A PDF of that page | Chrome’s --headless --print-to-pdf command |
| A local PDF and a website file input | A PDF of the website’s processed or displayed result | Puppeteer file upload followed by page.pdf() |
| A local PDF | An unchanged copy of the same document | Neither workflow guarantees this. Use the site’s own download/export behavior if it provides one; browser printing creates a PDF from the page’s print layout. |
The upload and print steps are separate. Uploading does not specify what the website will render, transform, or offer for download. You need the target site’s actual file-input selector and a signal that its processing is complete.
Print a page URL directly with Chrome
When the page is already available at a URL, Chrome’s command-line printing is the shortest route:
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallchrome --headless --print-to-pdf https://example.com/
Chrome writes output.pdf in the current working directory. To omit Chrome’s generated header and footer, add --no-pdf-header-footer:
#1 Best Overall
- INNOVATIVE CARTRIDGE-FREE PRINTING — No more dealing with lots of tiny ink cartridges; With this wireless document and photo printer each ink bottle set is equivalent to about 90 individual cartridges²
- LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; When you choose this combination printer, scanner and copier you can print up to 4,500 pages black/7,500 color³
- COLOR PRINTING — Up to 2 years of ink in the box4 (and with every replacement ink set) for fewer out-of-ink frustrations
- ZERO CARTRIDGE WASTE — By using an Epson EcoTank printer you can help reduce the amount of cartridge waste ending up in landfills
- HOME PRINTER DESIGNED FOR RELIABILITY — The Epson EcoTank ET-2800 All-in-One Supertank Color Printer creates vivid, detailed prints and documents thanks to Micro Piezo Heat-Free Technology; Fire off 10 ISO pages per minute1 to easily finish large jobs
chrome --headless --print-to-pdf --no-pdf-header-footer https://example.com/
For pages that need time to load, the CLI reference documents --timeout=5000, where the value is in milliseconds. For JavaScript driven by timers, --virtual-time-budget can advance virtual time before capture. These settings are not proof that every application operation has completed; choose them based on the page and inspect the output.
chrome --headless --timeout=5000 --print-to-pdf https://example.com/
The older flag --print-to-pdf-no-header has been superseded by --no-pdf-header-footer; older Chrome versions may require the earlier name. The CLI documentation says --allow-chrome-scheme-url is required for chrome:// URLs and is available from Chrome 123.
Upload a local PDF with Puppeteer, then print the page
This Node.js example opens the site, uploads an absolute file path to its file input, waits for a site-specific completion element, and saves the page’s print rendering. Replace the URL, file path, and selectors with those used by your target application.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #2
- CARTRIDGE-FREE PRINTING — Print lab-quality photos, graphics and creative projects; Get vibrant colors and sharp text with Epson's high-accuracy printhead and Claria ET Premium 6-color inks
- INK BOTTLES — Save on photos1 and creative projects with affordable in-house printing; All-in-one printer allows you to print 4" x 6" photos for about 4 cents each vs. 40 cents with traditional ink cartridges1
- LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; Printer, scanner and copier lets you print up to 6,200 color pages³
- PRINT FOR LONGER — Up to 2 years of ink in the box² (and with every replacement ink set) for fewer out-of-ink frustrations with this wireless printer
- ZERO CARTRIDGE WASTE — Epson EcoTank printer helps reduce the amount of cartridge waste ending up in landfills; Cartridge-free printer uses high-yield ink bottles; Each replacement ink bottle set is equivalent to about 100 individual ink cartridges⁴
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: true });
try {
const page = await browser.newPage();
await page.goto('https://example.com/upload', { waitUntil: 'domcontentloaded' });
const fileElement = await page.waitForSelector('input[type="file"]');
await fileElement.uploadFile(['/absolute/path/input.pdf']);
// Replace this with a real signal that the target site finished processing.
await page.waitForSelector('.processing-complete', { timeout: 30000 });
await page.pdf({ path: 'output.pdf' });
} finally {
await browser.close();
}
})();
Install Puppeteer in your project with npm install puppeteer. The upload path must be accessible to the process running Puppeteer; use an absolute path to avoid ambiguity. The example’s .processing-complete selector is illustrative, not a universal selector. A target site might instead show a preview, update a status message, or enable an export control.
Make the readiness check specific to the site
Do not call page.pdf() immediately after upload unless the application is known to finish synchronously. Prefer a completion element, a changed status, or another observable state that means the result is ready. A fixed delay can be a fallback for a known application, but it can be too short on a slow run and unnecessarily long on a fast one.
Know what the output contains
Puppeteer’s Page.pdf() uses print CSS media by default. It generates a PDF of the page’s print rendering. It does not promise a byte-for-byte copy of the uploaded PDF or a specific conversion: the website controls how it handles the file, and the page’s print styles control the captured layout.
Rank #3
- SET IT UP ONCE AND PRINT WITH CONFIDENCE. No complicated maintenance. Just easy, reliable printing you can count on.
- INK FOR YEARS. NOT MONTHS. Up to 2 years of ink included. Get thousands of pages of cartridge-free printing. More pages, less hassle
- KEEPS PRINTING WELL AFTER COMPETITORS HAVE QUIT. No complex maintenance. Sharper text, richer colors.[2] Only with HP Smart Tank
- PREMIUM SUPPORT - Strong technical expertise to solve issues faster
- THE LAST PRINTER YOU'LL EVER NEED. Enjoy years of refillable, cartridge-free printing.
Use current Headless Chrome behavior
Chrome’s current Headless mode shares the implementation used by headful Chrome. The older Headless implementation is available separately as chrome-headless-shell; Puppeteer can select it with headless: 'shell'. In current Puppeteer, headless: true enables modern Headless. Prefer documentation matching the installed Chrome and Puppeteer versions when adapting older examples or command flags.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesTroubleshoot upload and PDF output
| Symptom | Likely cause | What to check or change |
|---|---|---|
waitForSelector times out for the file input |
The selector does not match, the input is added later, or it is inside a frame. | Inspect the page and use the real input[type="file"] selector. If the control is in a frame, locate the relevant frame before waiting for it. |
| Upload fails or the site shows no file | The path is wrong, relative to an unexpected working directory, or inaccessible to the browser process. | Use the correct absolute path and confirm that the process can read that file. |
| The PDF is blank or shows a loading state | The page was printed before processing or rendering finished. | Wait for an application-specific completion condition and verify the resulting page state before calling page.pdf(). |
| The output differs from the uploaded document | page.pdf() prints the webpage’s print layout, not necessarily the original document. |
Check what the site displays after upload and whether it provides a direct export/download for the original or transformed PDF. |
| Headers, footers, or layout differ from expectations | Chrome’s print settings and the page’s print CSS affect output. | For CLI printing, choose the supported header/footer flag for the installed Chrome version. For Puppeteer, inspect the page’s print rendering and Page.pdf() options. |
| The CLI capture omits content that appears later | The page needs more loading time or timer-driven JavaScript has not run. | Evaluate --timeout or --virtual-time-budget in line with the page’s behavior, then verify the PDF rather than assuming the delay means completion. |
Or skip the browser setup
If your goal is to capture a webpage as an image or PDF rather than upload a local PDF into a particular site, ScreenshotNeo provides a one-request screenshot API. This example saves a URL capture as WebP:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options and output formats. Cookie banners are accepted and removed before capture, along with supported newsletter popups and chat widgets; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server lets AI agents use screenshot and PDF-capture tools. The free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots.
Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card.
Rank #4
- Wireless Bluetooth Printer: Portable thermal printer compatible with iPhone, Android phones, iPad and tablet computers via Bluetooth. For smartphones, please download the "Nada Print" App. You can also connect to laptops and computers for printing using a USB-C cable. (Note: Laptops and computers can only be connected via USB and require the installation of a driver first. Bluetooth connection is not supported.)
- No-ink printing: Only supports US Letter and A4 size thermal paper.(Doesn't support regular paper) The no-ink portable thermal printer uses direct thermal technology, requiring no ink, toner or ribbons, making it environmentally friendly, cost-effective and time-saving. The thermal printer package comes with a roll of US Letter thermal printing paper. Note: When installing the paper, remember to switch the paper size switch on APP
- Clear Print: NDYIN N80 portable thermal printer adopts high-definition printing technology, with a 203DPI resolution to provide you with clear printing results. This mobile printer is compatible with roll paper, folded paper and tattoo transfer paper, supporting printing from your mobile phone PDF, Word, pictures and web pages anytime and anywhere. It is recommended to use our NDYIN thermal paper to achieve good printing quality
- Portable wireless printer for travel: The thermal printer is equipped with a built-in 1500mAh rechargeable battery, which can print 160 sheets of 8.5" x 11" thermal paper after being fully charged. It weighs only 1.5 pounds and is compact in size. This ink-free portable printer can be easily carried in a backpack or briefcase! It is perfect for business travel, cars, small offices, construction sites, schools and homes. You can print documents, contracts, invoices and boarding passes anytime and anywhere
- The N80 thermal printer has a wide range of uses. The package includes the N80 printer, a roll of US Letter paper(7m/roll), a user manual, a guide card, a type-C soft cable and a type C adapter. Note: The charging adapter is not included. Special thermal paper is required for use; ordinary paper cannot be used. This ink-free portable thermal printer is suitable for various scenarios such as home, school, travel, office, and outdoor, meeting the printing needs of different groups of people. This tattoo template printer is also compatible with tattoo transfer paper, making it an ideal choice for tattoo art
Frequently Asked Questions
Does Chrome’s --print-to-pdf convert a local PDF file?
No. The documented command prints a target page. A local PDF uploaded to a website requires that site to process or display it first.
Will Puppeteer’s output be an exact copy of the uploaded PDF?
Not necessarily. page.pdf() prints the webpage using print CSS; the website determines how it handles the uploaded file.
Can Puppeteer download a PDF that the website creates?
Puppeteer’s file guide says it does not currently provide programmatic handling for file downloads. If the desired artifact is the rendered page, generate it directly with Page.pdf().
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.

