Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Make a PDF Archive of a Webpage in Linux from the Command Line

Print a live webpage to PDF from a Linux shell with headless Chrome, or compare wkhtmltopdf and WeasyPrint for different rendering needs.

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.

For a one-off PDF of a live webpage on Linux, use headless Chrome or Chromium:

google-chrome --headless --print-to-pdf=page.pdf 'https://example.com'

The executable name and supported flags vary by installation. Chrome’s documented basic form saves the page as output.pdf in the current directory; check your installed browser’s help if the command or output option is rejected. A PDF is a rendered snapshot, not a complete copy of the original website or its assets and interactions.

As an Amazon Associate I earn from qualifying purchases.

Save a webpage as PDF with headless Chrome

Chrome’s headless command-line mode opens a page without displaying a browser window and prints it to PDF. The basic documented form is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
chrome --headless --print-to-pdf 'https://developer.chrome.com/'

Chrome for Developers says this saves the PDF as output.pdf in the current working directory. To choose a filename, common Chrome and Chromium builds accept the equals form:

#1 Best Overall
Lenovo Business Laptop - Linux Mint (Cinnamon) - Intel i5-1335U, 16GB RAM, 256GB SSD, 15.6" FHD 1920x1080 Display, Full Keyboard, Fast Charging
  • Intel Core i5-1335U Processor (12M Cache, 12 Threads, up to 4.6 GHz) - 256GB Solid State Drive - 16GB DDR4 SDRAM
  • 15.6" FHD (1920x1080) Non-Touch Anti-Glare Display - Intel UHD 620 Integrated Graphics - Stereo Speakers
  • 720p HD Webcam with Privacy Shutter. Integrated Microphone - Intel Dual Band Wireless-AC (2x2) 8265, Bluetooth Version 4.2
  • I/O Ports: 2x USB 3.0, 1x USB 3.1 Type-C 3.1, Headphone/Mic Combo Port, 4-in-1 Card Reader, HDMI, Kensington Mini-Lock Slot
  • Linux Mint (Cinnamon) 64-Bit - Keyboard with Full NumberPad - Fast Charging
google-chrome --headless --print-to-pdf=page.pdf 'https://example.com'

Executable names differ across Linux distributions and packages: you may have google-chrome, chromium, or another name. The supported flag syntax may also differ by version. If needed, check the installed binary’s command-line help and try the documented basic form. The current Chrome CLI reference documents --no-pdf-header-footer to omit print headers and footers such as the URL and page number:

google-chrome --headless --no-pdf-header-footer --print-to-pdf=page.pdf 'https://example.com'

On older versions, the previous flag name may be --print-to-pdf-no-header. Confirm which spelling your installed build supports in the Chrome Headless command-line reference.

Rank #2
HP 17 Business Laptop - Linux Mint Cinnamon - Intel Quad-Core i5-10210U, 32GB RAM, 1TB PCIe NVMe SSD + 1TB Storage HDD, 17.3" Inch HD+ (1600x900) Display
  • Intel Core i5-10210U (up to 4.2GHz) - 1TB PCIe NVMe + 1TB HDD - 32GB DDR4 SDRAM
  • 17.3" HD+ (1600x900) Display, Intel UHD Graphics 620
  • Built in HD 720p Webcam with Microphone - Bluetooth Version4.2
  • I/O Ports: 2x USB 3.1 (Data Only), 1x USB 2.0, 1x HDMI, 1x Headphone/Microphone Combo Jack
  • Linux Mint Cinnamon 64-Bit - 6-Row Keyboard w/ Full Numberpad

Handle pages that load content late

Some pages add content after the initial navigation, using JavaScript, timers, or lazy loading. Chrome offers timing controls, but neither one proves that every element has finished loading.

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

Set a maximum wait

google-chrome --headless --timeout=5000 --print-to-pdf=page.pdf 'https://example.com'

--timeout=5000 captures after a maximum wait of five seconds, even if page loading continues. Adjust the value to suit the page; a longer wait can help with slow content but does not guarantee that the site has completed its work.

Rank #3
Panasonic Toughbook CF-31 MK5 Rugged Laptop, 13.1in i5, 8GB 256GB (Renewed) | Touch, 4G LTE, Backlit Keyboard, Linux Ubuntu OS
  • [ULTRA-RUGGED DESIGN] MIL-STD-810G and IP65 certified. Built to survive 6-foot drops, heavy rain, and extreme vibrations. Features a magnesium alloy chassis with an integrated carry handle for maximum portability
  • [4G LTE - WORK ANYWHERE] Integrated 4G LTE Multi-Carrier Mobile Broadband. Stay connected to the internet in remote areas or on the road without relying on Wi-Fi or phone hotspots. True mobile freedom for field professionals
  • [1200-NIT SUNLIGHT READABLE] 13.1" XGA Touchscreen with CircuLumin technology. At 1200 nits, it is nearly 4x brighter than a standard laptop, ensuring perfect visibility under direct, intense sunlight
  • [LINUX UBUNTU PRE-INSTALLED] Fast, secure, and bloatware-free. Optimized for developers, network engineers, and diagnostic software that thrives in a stable, open-source environment
  • [LEGACY SERIAL PORT] Features a native RS-232 Serial Port, HDMI, and USB 3.0. Essential for connecting directly to industrial machinery, CNCs, and automotive diagnostic tools without unreliable adapter

Advance virtual time

google-chrome --headless --virtual-time-budget=42000 --print-to-pdf=page.pdf 'https://example.com'

--virtual-time-budget=42000 advances time-dependent page code while Chrome captures. It can help with some timer-driven pages, but it is not a universal wait-for-everything switch. Inspect the resulting PDF to confirm that important text and images appeared.

Choose an alternative renderer when needed

Chrome is a practical starting point for a live site when current browser rendering and JavaScript matter. Other command-line tools may suit different HTML or PDF requirements, but their output depends on their rendering engine and capabilities.

Rank #4
Lenovo V15 Gen 4 - Business Laptop - AMD Ryzen 5 7430U - 15.6" FHD Display - 8GB RAM - 512GB SSD Storage - Integrated AMD Radeon™ Graphics - Webcam Privacy Shutter - Business Black
  • THE POWER TO STAY PRODUCTIVE – Looking to make your everyday work and home life more manageable without breaking the bank? The Lenovo V15 Gen 4 offers long-term reliability with top-of-the-line features to make you your most productive self.
  • CRUSH YOUR TO-DO LIST – The AMD Ryzen CPU pairs quiet performance and enhanced operating power to crush your high-demand workday. It optimizes performance and allows for seamless multitasking.
  • TRUE-TO-LIFE VISUALS – The 15.6” FHD IPS display is anti-glare with 300 nits brightness to see your best outside or in. Its 88% screen-to-body ratio makes viewing detailed applications like spreadsheets a breeze.
  • SEAMLESS COLLABORATION – Lenovo Smart Appearance enhances your camera effects to protect your privacy and to make you the focus of every video conference. Intelligent noise cancelation minimizes distraction and Dolby Audio provides an elegantly sonorous experience.
  • BUILT TO WITHSTAND – Built for military-grade toughness, the V15 Gen 4 is tested to withstand harsh temperatures, pressure, humidity, vibrations and more. Keep your work safe from the board room to your living room and everywhere in between.
Tool Example What to consider
Chrome or Chromium chrome --headless --print-to-pdf 'https://example.com' Uses browser rendering and JavaScript. Flags and executable names depend on the installed build. See the official CLI reference.
wkhtmltopdf wkhtmltopdf 'https://example.com' page.pdf Uses Qt WebKit. The project’s downloads page lists 0.12.6 as the stable series and dates its release June 11, 2020; check the rendering on modern pages rather than assuming it matches a current browser. See the project homepage and downloads and security warning.
WeasyPrint weasyprint https://weasyprint.org /tmp/page.pdf Can be useful when HTML/CSS rendering control matters. Unsupported CSS properties can produce warnings. Its documentation also covers PDF/A variants, which have format constraints, including no audio, video, or JavaScript. See first steps and common use cases and PDF/A.

There is no universal best renderer for every site. Compare output against the target page, especially where JavaScript, delayed content, print styles, or precise layout matters.

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

Keep the result useful as an archive

A PDF records a page as rendered at capture time. It does not establish that the original HTML, images, scripts, interactions, or network dependencies have been preserved. If you may need to identify or contextualize the capture later, keep the original URL and capture date with the PDF—for example, in the filename or an accompanying note.

Best Value
Lenovo IdeaPad Slim 3 Linux Laptop, 15.6" FHD Touchscreen Laptop, 8-Core AMD Ryzen 7 5825U, 16GB RAM, 512GB SSD, Keypad, SD Card Reader, Stylus Pen + External Portable SSD + USB Hub, Linux Ubuntu OS
  • Powerful Linux Laptop: This IdeaPad Slim 3 Laptop comes pre-installed with Ubuntu Linux, offering fast performance, robust security, and a clean, user-friendly experience. Enjoy full customization, seamless hardware compatibility, and access to thousands of open-source apps. Whether you're working, creating, or coding, it's built to keep up with everything you do.
  • A Multitasking Master: The latest AMD Ryzen 7 5825U processor (up to 4.5 GHz) delivers powerful performance with 8 cores and 16 threads for smooth multitasking. Integrated AMD Radeon Graphics provide crisp visuals for streaming, browsing, photo editing, and casual gaming. With smart machine intelligence, it adapts to your needs for a fast, responsive experience.
  • 15.6" Full HD Display: The IdeaPad Slim 3 boasts an 88% screen-to-body ratio for a floating, edge-to-edge visual experience. TÜV Low Blue Light certification reduces eye strain, making it perfect for long work or study sessions.
  • Military-Grade Durability: The smart IdeaPad Slim 3 combines portability and durability, letting you work, study, and play on the go. With a profile 10% slimmer than the previous generation, it's lightweight yet military-grade rugged, ready for anything, anywhere.
  • Versatile Connectivity: Enjoy the security of a built-in webcam with a privacy shutter. Connect effortlessly with multiple ports: 2x USB A, 1x USB C, 1x HDMI, 1x SD Card Reader, 1x Headphone/Microphone combo. Bundle comes with Stylus Pen, 256GB Portable SSD and 5-in-1 Docking Station.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use wkhtmltopdf safely with untrusted input

The wkhtmltopdf project warns against processing untrusted HTML: unsanitized user-supplied HTML or JavaScript can create a risk of server takeover. Do not treat this tool as a safe renderer for arbitrary content on a shared or sensitive machine; follow the project’s warning and sanitize input where applicable.

Troubleshoot common command-line problems

  • “Command not found”: The executable may have a different name, or the browser may not be installed. Check which browser package you installed and invoke its binary name.
  • Chrome rejects a flag: Flag availability or spelling can differ by version. Consult the current CLI reference; older builds may use --print-to-pdf-no-header instead of --no-pdf-header-footer.
  • The PDF is saved under an unexpected name: The documented basic Chrome command writes output.pdf to the current working directory. Check that directory, or use the equals form for a filename if your build supports it.
  • Content is missing: The page may load it after the capture. Try a suitable --timeout or --virtual-time-budget, then inspect the output; these controls cannot guarantee every site has finished loading.
  • Layout differs from the screen: Printing can use print styles and page breaks rather than the page’s on-screen layout. Compare the PDF with the page and test another renderer if its output does not meet your needs.
  • WeasyPrint reports CSS warnings: Its documentation notes that unsupported CSS properties can generate warnings. Check whether the affected styling is important to the PDF and adjust the source or rendering approach.

Or skip the browser setup

For a capture through an API rather than a locally installed browser, ScreenshotNeo returns a webpage screenshot or PDF from one GET request. For PDF output, use its PDF options as described in the ScreenshotNeo documentation. For example, the following cURL request saves a screenshot:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers indicate the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots.

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

Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.

Frequently Asked Questions

Does Chrome’s PDF command save the file in the current directory?

Yes. Chrome’s documented basic headless command saves it as output.pdf in the current working directory.

Can a PDF prove exactly what a website contained at the time?

It records a rendered view, but does not preserve the original source, assets, interactions, or network dependencies. Keep the URL and capture date with it when those details matter.

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.

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

Leave a Reply

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

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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.