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

The quickest way to save a web page as a PDF on Linux is to open the page in your browser, choose Print, select Save to PDF, review the preview, and save the file. For repeatable jobs, use headless Chrome/Chromium or wkhtmltopdf from a terminal. The right method depends on whether you need a one-off copy, browser-level rendering, or a scriptable batch process.

Choose the method that fits your job

Method Best for What you control Main limitation
Firefox or another browser print dialog Occasional, visual saves Preview, page range, orientation, margins and destination Manual; labels vary by browser and Linux desktop
Headless Chrome/Chromium Automation that should resemble Chrome rendering Command-line capture, timeout and PDF header/footer behavior Dynamic pages may still need additional wait time
wkhtmltopdf Existing scripts using its options JavaScript, print media, page dimensions and local-file access Uses Qt WebKit, so output may differ from a current browser

Save a page as PDF from a Linux browser

Firefox: the simplest one-off workflow

  1. Open the page in Firefox.
  2. Open the print command, commonly with Ctrl+P on a Linux desktop.
  3. In the print preview, open the destination selector and choose Save to PDF.
  4. Check the preview. Look for missing images, clipped columns, unwanted blank pages, page breaks and print-only content.
  5. Adjust any offered controls such as page range, orientation or margins.
  6. Choose a known folder, enter a filename and save.

Firefox saves the rendered print view, not necessarily an exact visual copy of the screen. A site can provide print-specific CSS that hides navigation, changes colors or rearranges content. Browser and desktop integration labels differ by version and distribution, so look for the destination control rather than assuming every installation has identical wording.

When the preview is wrong

  • Content is missing: scroll through the live page first so lazy-loaded sections have a chance to appear, then reopen Print.
  • Columns are cut off: try landscape orientation or narrower margins.
  • Backgrounds are absent: look for a background-graphics option; some sites intentionally remove decorative backgrounds in print styles.
  • A cookie banner or chat panel covers the page: dismiss it before opening Print.

Convert a page from the terminal with headless Chrome or Chromium

Chrome’s documented headless interface prints a URL to PDF without opening a visible browser window. The basic command is:

chrome --headless --print-to-pdf https://example.com/

The default file is output.pdf in the current working directory. Confirm which executable your installation provides; it may be named chrome, google-chrome or chromium. Quote URLs containing shell metacharacters.

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.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Choose an output filename

Use the print-to-PDF option with an output path supported by your installed Chrome/Chromium build. A typical pattern is:

chrome --headless --print-to-pdf=/home/me/docs/page.pdf https://example.com/

If your build rejects that syntax, run chrome --help and consult the command-line reference shipped for that version. Keeping the destination in a writable directory avoids confusing permission errors with rendering failures.

Remove generated headers and footers

Chrome can suppress the generated date, URL and page-number area:

chrome --headless --print-to-pdf --no-pdf-header-footer https://example.com/

Older Chrome versions used --print-to-pdf-no-header. If the current spelling is ignored or reported as unknown, check the flags supported by your installed version.

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

Allow more time for dynamic pages

Chrome documents --timeout in milliseconds. It sets a maximum wait before capture, including cases where the page is still loading:

chrome --headless --timeout=15000 --print-to-pdf=/tmp/page.pdf https://example.com/

A timeout is not a guarantee that every late API response, animation or lazy image has finished. For reliable automation, identify a page state that is actually ready, test representative URLs and compare the resulting PDFs with the browser preview.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Script a batch conversion

A shell loop can process a list of URLs, but sanitize filenames and capture failures explicitly:

while IFS=$'t' read -r name url; do
  chrome --headless --no-pdf-header-footer 
    --print-to-pdf="pdf/${name}.pdf" "$url" || echo "failed: $url" >&2
done < urls.tsv

Run jobs in a controlled number of parallel processes. Starting too many browser instances can exhaust memory and make pages time out.

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

Use wkhtmltopdf when its WebKit workflow fits

wkhtmltopdf accepts a URL or local file followed by an output path:

wkhtmltopdf https://example.com/ output.pdf

The project documents switches for JavaScript, print-media selection, page dimensions and local-file access. These are useful when diagnosing a page that depends on scripts or local assets, but wkhtmltopdf renders with its Qt WebKit engine rather than the current Chrome engine.

Options worth checking

  • JavaScript: verify that scripts are enabled when the page builds its content client-side; disabling scripts can make output incomplete.
  • Delay and loading behavior: give scripts time to finish when the page does not render immediately. A delay still cannot guarantee that every asynchronous operation has completed.
  • Print media: select print media when you want the site’s print stylesheet rather than its screen stylesheet.
  • Local files: review local-file-access restrictions before converting an HTML file that references local images or CSS. Relaxing access can have security implications; use only trusted input.
  • Page size and margins: set these deliberately when producing reports or documents that must meet a paper format.

Confirm behavior in the build installed on your distribution. Package defaults and patches can affect JavaScript support, font availability and local-file handling.

Printing the finished PDF with CUPS

CUPS belongs to the printing stage, not the PDF-creation stage. Once a browser or converter has created output.pdf, send it to a configured printer with the CUPS command-line tools, for example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
lp output.pdf

CUPS accepts common document formats and exposes printer-specific options. If your goal is only a PDF file, you do not need a physical printer or CUPS; keep the two workflows separate when troubleshooting.

Make the output dependable

Rendering and fidelity

Browser print and headless Chrome follow the Chrome page-rendering path, while wkhtmltopdf follows Qt WebKit. A page can therefore look different between methods. Check fonts, SVGs, charts, sticky elements, code blocks and wide tables rather than assuming that a successful exit code means a correct document.

Dynamic content and lazy loading

Single-page applications, consent gates, authentication, delayed API calls and lazy images are common causes of incomplete PDFs. First inspect the page in a normal browser. If the content appears only after interaction, a basic URL-to-PDF command may capture it too early. Use a documented timeout or converter delay, or choose a workflow that can perform the required interaction before printing.

Fonts, locale and reproducibility

PDF output depends on installed fonts, timezone, language and page state. For repeatable builds, use the same browser build and container or host image, install the fonts the page requires, and record the command, URL and capture time. A page that changes by region or login state will not produce identical files on every run.

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

Performance and cost

Manual printing has almost no setup cost and is efficient for a few pages. Headless conversion is easier to integrate into jobs, but each browser process consumes CPU and memory. Reuse a controlled worker pattern rather than launching unlimited concurrent processes. wkhtmltopdf can be convenient in established pipelines, but its older rendering engine may require page-specific workarounds. None of these tools guarantees a particular speed or success rate for every site.

Troubleshoot common failures

The command is not found

Use the executable installed on your system, such as chromium instead of chrome, and verify it is on PATH. For wkhtmltopdf, install the distribution package or project build appropriate to your Linux distribution, then run wkhtmltopdf --version.

Permission denied or an empty output file

Choose a writable output directory and ensure the parent directory exists. Try a path under your home directory before diagnosing the page itself.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

The PDF contains only a blank page

Open the URL interactively. Check redirects, login requirements, bot checks, JavaScript errors and certificate warnings. Increase the wait period for a slow page, but treat the timeout as a maximum wait rather than proof of readiness.

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.

Images or fonts are missing

Check network access from the conversion environment, mixed-content restrictions, blocked local files and unavailable fonts. A page that loads assets only after scrolling or clicking may need a browser-driven workflow.

The layout is different from the screen

Compare the browser print preview with the live page. Print CSS, paper dimensions, margins and headers can all change pagination. Try headless Chrome for current-browser fidelity or adjust wkhtmltopdf’s page and media options.

Headers appear despite the flag

Confirm the flag spelling for your Chrome version. Current documentation uses --no-pdf-header-footer; older releases may require --print-to-pdf-no-header.

Local HTML cannot read its assets

Review wkhtmltopdf’s local-file-access setting and use trusted files only. If the HTML references remote assets, verify that the conversion host can reach them.

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

Or skip the browser setup

ScreenshotNeo provides a one-request website capture API that can return PNG, JPEG, WebP or PDF. It accepts cookie and consent banners like a visitor, then removes more than 60 known consent platforms, newsletter popups and chat widgets before capture. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the page verdict and billing result in headers.

For a PDF, call the API endpoint with the target URL and PDF options described in the ScreenshotNeo documentation:

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
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

Python

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://example.com", "format": "pdf"},
    timeout=90,
)
r.raise_for_status()
open("page.pdf", "wb").write(r.content)

Node.js

const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://example.com',
  format: 'pdf'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
require('fs').writeFileSync('page.pdf', Buffer.from(await res.arrayBuffer()));

ScreenshotNeo also supports full-page capture with lazy images loaded, CSS-selector element capture, dark mode, device presets, retina scale, paper size, margins, landscape mode, page ranges, custom CSS and JavaScript, clicks, selector waits, delays, network-idle waits, request blocking, headers, cookies, user agents, Authorization, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API and an OpenAPI specification. An MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. Its parameter names are compatible with those used by other screenshot APIs, which can simplify migration.

The Free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan, and yearly billing gives two months free. Create a free ScreenshotNeo account to try the PDF endpoint.

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

Which workflow should you use?

  • Choose the browser print dialog when you need one carefully checked PDF now.
  • Choose headless Chrome when you need browser-like rendering in a script or scheduled job.
  • Choose wkhtmltopdf when an existing pipeline depends on its WebKit-specific options and its output is acceptable.
  • Choose ScreenshotNeo when you want an API or MCP workflow that cleans common overlays before capture and charges only for clean results.

Frequently Asked Questions

Can I convert a local HTML file to PDF on Linux?

Yes. A browser can open a local file and print it, and wkhtmltopdf accepts a file as a page object. Check local-file access and asset paths when CSS, images or fonts are missing.

Does converting a page require CUPS?

No. CUPS sends an existing document to a printer. Browser print-to-PDF, headless Chrome and wkhtmltopdf can create the PDF without a printer.

Why does my PDF include a URL and date?

Those are generated PDF headers and footers. In headless Chrome, try --no-pdf-header-footer; older versions may use --print-to-pdf-no-header.

Will a PDF preserve a page’s interactive behavior?

No. PDF captures the rendered document. Links may remain clickable depending on the converter, but scripts, forms and other live behavior are not the same as opening the web page.

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

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.