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

The quickest way to convert an HTML file is to open it in Chrome, press Ctrl+P on Windows/Linux or Command+P on Mac, choose a PDF destination (usually “Save as PDF”), and save the file. For repeatable jobs, Chrome Headless can print pages from the command line, while WeasyPrint provides command-line and Python workflows. Whichever method you use, inspect the resulting PDF for page breaks, missing assets, fonts, and script-generated content.

Choose the right HTML-to-PDF method

Your best method depends on whether this is a one-time conversion, a scripted task, or a server-side document pipeline. Browser printing is the simplest starting point because it uses the same print renderer you can preview. Headless Chrome is useful when you need a repeatable command. WeasyPrint is convenient for Python document generation, but it does not implement every browser CSS feature. The older wkhtmltopdf tool may fit an existing workflow, yet its project information is dated, so verify maintenance and compatibility before adopting it for new production work.

Method Best fit Important considerations
Chrome print preview Occasional manual conversion Fast setup; dialog labels and PDF destinations vary by operating system and Chrome version.
Chrome Headless Scripts, CI jobs, and repeatable captures Supports --print-to-pdf, timeout control, virtual-time waiting, and optional header/footer suppression.
WeasyPrint Python or server-side document generation Offers CLI and Python APIs; check its CSS support and isolate untrusted input.
wkhtmltopdf Existing systems already built around Qt WebKit Review current security, runtime compatibility, and project status; do not assume Chrome-level rendering.

There is no documented universal winner for speed, fidelity, or cost. Compare the tools against your actual requirements: JavaScript dependence, print CSS, volume, automation, and the trust level of the HTML.

Convert an HTML file in Chrome on Windows, Mac, or Linux

  1. Keep the page’s assets together. If the document references local images, stylesheets, fonts, or scripts, do not move those files away from the relative paths used by the HTML.
  2. Open the file. In your file manager, open the .html file with Chrome. You can also use Chrome’s File > Open File command.
  3. Open print preview. Choose File > Print, press Ctrl+P on Windows/Linux, or press Command+P on macOS.
  4. Select a PDF destination. Choose “Save as PDF” or the PDF destination offered by your operating system. Some systems show a separate PDF button or a printer dialog first.
  5. Set page options. Choose paper size, portrait or landscape orientation, scale, margins, and whether background graphics should print. Background graphics are often required for colored panels, charts, and branded headers.
  6. Preview every page. Check for clipped columns, blank pages, missing images, unexpected headers and footers, and headings stranded at the bottom of a page.
  7. Save to a known location. Give the PDF a descriptive filename, then reopen it in a PDF viewer to confirm that all pages and links you need are present.

Print preview reflects the page’s print rendering, not necessarily its screen appearance. A stylesheet can include @media print rules that hide navigation, change colors, or rearrange content. If the page is generated by JavaScript, wait until the visible content has finished loading before printing.

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.

Save an HTML file as PDF on Android

  1. Open the local HTML file or web page in Chrome.
  2. Tap More (the three-dot menu), then Share, then Print.
  3. Choose “Save as PDF” as the printer or destination.
  4. Select a storage location and tap Print (the label may vary slightly by Android release).

Keep local companion files available to the browser. If images or CSS are absent in the preview, the PDF cannot include them; fix the file paths and reopen the HTML before printing again.

Automate conversion with Chrome Headless

Chrome’s Headless command-line reference documents the --print-to-pdf flag. It writes a PDF named output.pdf in the current working directory unless you provide an output path. A basic command is:

google-chrome --headless --print-to-pdf="/absolute/path/report.pdf" "file:///absolute/path/report.html"

On systems where the executable is named differently, use the installed Chrome or Chromium command. Quote paths containing spaces. A relative local path can work, but an absolute file:/// URL makes the input unambiguous.

Useful Headless flags

  • --no-pdf-header-footer suppresses the default date, title, URL, and page-number decoration when your installed Chrome supports the flag.
  • --timeout=90000 caps how long Chrome waits (the value is in milliseconds). Choose a limit appropriate for your page rather than copying a value blindly.
  • --virtual-time-budget=10000 gives time-dependent page code a virtual-time window before capture (also in milliseconds).

For a page that renders content after a delay, combine a deliberate wait strategy with a timeout, then inspect the PDF. A timeout only limits waiting; it does not prove that remote fonts, images, API data, or animations finished loading.

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

Headless conversion checklist

  • Use a deterministic output directory and unique filenames in batch jobs.
  • Make sure the process can read every local file and reach every required remote resource.
  • Disable or freeze animations when they can capture an intermediate frame.
  • Open sample PDFs in CI or a validation step to catch zero-byte, blank, or truncated output.

Convert HTML to PDF with WeasyPrint

WeasyPrint supports both a command-line interface and a Python API. It is designed for document-style output, but its CSS implementation is not identical to a full browser. Test your page’s layout, fonts, images, tables, and page-break rules before relying on it for production.

Command line

weasyprint input.html output.pdf

It can also accept a URL where your installation and security policy permit network access:

weasyprint https://example.com/report output.pdf

Python API

from weasyprint import HTML

HTML(filename="input.html").write_pdf("output.pdf")

Use an appropriate base URL when your HTML contains relative assets. For example, a document loaded from a controlled directory can be given that directory as its base so relative images and stylesheets resolve consistently. Consult the WeasyPrint documentation for the exact API supported by your installed version.

Security for server-side conversion

Do not blindly render arbitrary uploaded HTML or CSS. WeasyPrint warns that untrusted input can create security problems, and output is not guaranteed for every combination of HTML, CSS, and PDF features. Run conversion in an isolated, least-privileged environment; restrict network and filesystem access; limit CPU, memory, and execution time; and validate file types before processing them.

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

Why the PDF looks wrong

Images or fonts are missing

Check relative URLs, file permissions, and whether the renderer can access remote resources. A browser preview may show an image from your current session while a headless process or server cannot authenticate to the same location. Copy required assets locally or provide the credentials and network access your controlled job needs.

Content is cut off or columns overflow

Use print-specific CSS, reduce the print scale, choose landscape orientation for wide tables, and add explicit page-break rules around large sections. Recheck the preview at the target paper size instead of judging from a responsive screen layout.

There are unexpected blank pages

Look for fixed heights, forced page breaks, oversized margins, and elements that become visible only in print. Remove redundant breaks and test again with backgrounds and headers enabled or disabled as appropriate.

The PDF contains an old or incomplete page

Wait for JavaScript and network content to finish. In Headless Chrome, use a suitable virtual-time budget or timeout, then verify that the page’s API calls and assets are available to the process. A PDF captures rendered output; it does not preserve live application behavior.

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

Interactive controls do not work

PDF conversion renders a document. Forms, hover states, animations, infinite scrolling, and other browser interactions may not survive as live interactions. Export the information users need to read, and provide a link to the original application when interaction is required.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If the HTML is available at a public URL, ScreenshotNeo can return a PDF from one API request. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. It also provides an MCP server for Claude, Cursor, and other MCP clients, with take_screenshot, get_page_info, and capture_pdf tools.

See the ScreenshotNeo documentation for all options, including paper size, margins, landscape mode, page ranges, waits, custom CSS and JavaScript, headers, cookies, authorization, geolocation, caching, signed webhooks, and bulk capture.

cURL

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

For a PDF, add the API’s PDF output parameter documented for your account and target URL. The request above demonstrates the required endpoint, key, URL encoding, and binary output handling; do not send a private local file:// path because the service needs a reachable URL.

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.

Python

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

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

ScreenshotNeo’s Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is on every plan. Create a free ScreenshotNeo account to get an API key.

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.

Cost, reliability, and workflow decisions

  • One file: use Chrome print preview and manually inspect the result.
  • Many files on one machine: use Headless Chrome with controlled paths, waits, and validation.
  • Python-generated reports: evaluate WeasyPrint when your CSS fits its supported feature set.
  • Public URLs, API pipelines, or AI agents: ScreenshotNeo avoids local browser setup and reports whether a response was billable.
  • Untrusted uploads: isolate the renderer regardless of tool choice; convenience is not a substitute for sandboxing.

Keep representative HTML fixtures in your tests: short text, long tables, remote and local images, custom fonts, right-to-left text if applicable, and pages that intentionally span several sheets. Compare PDFs after renderer or browser upgrades because pagination and CSS behavior can change.

Frequently Asked Questions

Can I convert HTML to PDF without installing a converter?

Yes. A desktop browser such as Chrome can open the file and use its built-in print preview; choose a PDF destination and save.

Will JavaScript and interactive features be preserved?

The renderer captures the page’s output at a point in time. It may include content produced by JavaScript, but live interactions, animations, and application behavior are not guaranteed to remain interactive in the PDF.

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

Can I convert a private local HTML file with ScreenshotNeo?

Not directly from a local file path. ScreenshotNeo requests a reachable URL, so publish the document behind appropriate access controls or use a local browser, Headless Chrome, or WeasyPrint workflow.

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.