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

Fastest answer: open the .html file in Chrome, press Ctrl+P (Windows/Linux) or Command+P (Mac), choose Save as PDF (or another PDF destination), adjust the print settings, preview every page, and save. For repeatable jobs, use Chrome Headless with --print-to-pdf or a renderer such as WeasyPrint.

1. Convert an HTML file to PDF in Chrome

This is the best choice for a one-off conversion because it needs no dedicated converter. Chrome prints the page as a rendered document, including its print styles, images, fonts and page breaks as they load.

  1. Locate the .html file in your file manager and open it in Chrome. Keep its companion CSS files, images, fonts and JavaScript folders in the same relative locations.
  2. Choose File > Print, or press Ctrl+P on Windows/Linux or Command+P on macOS.
  3. In the destination/printer list, select Save as PDF when it is offered. The exact label and available destinations vary by operating system and Chrome version.
  4. Set the paper size, orientation, scale and margins. Turn on Background graphics if the design depends on colored backgrounds or background images.
  5. Use the preview to inspect every page, then choose a filename and save.

A PDF is a rendered snapshot, not a preserved web application. Links may remain clickable, but live forms, animations, hover states and other interactive behavior are not guaranteed to survive.

Keep local assets available

A local page can reference styles.css, images, web fonts and scripts with relative paths. Moving only the HTML file, blocking local-file access, or opening it from a different folder can produce missing images or unstyled text. Keep the original folder structure intact and wait for the page to finish loading before printing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
PDF Converter Ultimate - Convert PDF files into Word, Excel, PowerPoint and others - PDF converter software with OCR recognition compatible with Windows 11 / 10 / 8.1 / 8 / 7
  • Convert your PDF files into Word, Excel & Co. the easy way
  • Convert scanned documents thanks to our new 2022 OCR technology
  • Adjustable conversion settings
  • No subscription! Lifetime license!
  • Compatible with Windows 11, 10, 8.1, 7 - Internet connection required

Use print-specific CSS when you control the file

@media print {
  nav, .cookie-banner, .chat-widget { display: none; }
  @page { size: A4; margin: 16mm; }
  h1, h2, h3 { break-after: avoid; }
  table, figure { break-inside: avoid; }
}

Print rules can remove navigation and overlays, set paper geometry and reduce awkward splits. Check the preview rather than assuming the browser interpreted every rule as intended.

2. Convert HTML to PDF on Android

Chrome on Android provides a print route for a local file or web page:

  1. Open the HTML file or page in Chrome.
  2. Tap More (the three-dot menu), then Share, then Print.
  3. Choose Save as PDF as the printer/destination and select a storage location.
  4. Tap the print/save button and verify the resulting file in your file manager.

Android menus differ slightly by device and OS build. If the file uses local images or styles, keep those files accessible while Chrome renders it.

Rank #2
Doxillion Free Document Converter – Converts DOCX, DOC, PDF, WPS and Many More Files Quickly [Download]
  • Convert over 50 document file formats.
  • Preview your files from Doxillion before converting them.
  • Use batch conversion to convert thousands of files at once.
  • Enjoy an easy-to-use, intuitive interface with a Drag and Drop file option.
  • Burn your converted or original files directly to disc.

3. Automate conversion with Chrome Headless

For scripts, CI jobs or many files, Chrome’s headless command-line mode uses the same general browser rendering engine while writing a PDF directly. The documented flag saves a file named output.pdf in the current working directory unless you specify another output path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
google-chrome --headless --print-to-pdf="report.pdf" "file:///absolute/path/report.html"

On systems where the executable is named differently, use chromium or chromium-browser. Quote paths containing spaces. A local file URL must use an absolute path, for example file:///Users/alex/docs/report.html or file:///home/alex/docs/report.html.

Useful headless controls

  • --no-pdf-header-footer suppresses the browser-generated date, URL and page-number header/footer.
  • --timeout=30000 caps how long the capture waits (the value is in milliseconds).
  • --virtual-time-budget=5000 gives time-dependent page code a virtual-time window before capture (also in milliseconds).
google-chrome --headless 
  --no-pdf-header-footer 
  --timeout=30000 
  --virtual-time-budget=5000 
  --print-to-pdf="report.pdf" 
  "file:///absolute/path/report.html"

Waiting is important for pages that build content with JavaScript, lazy-load images or fetch data. These flags are controls, not guarantees: a script that depends on a blocked network request or an unavailable asset can still produce an incomplete PDF.

Rank #3
PDF Extra Ultimate | Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Yearly License | 1 Windows PC & 2 Mobile Devices | 1 User
  • EDIT text, images & designs in PDF documents. ORGANIZE PDFs. Convert PDFs to Word, Excel & ePub.
  • READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.
  • CREATE, COMBINE, SCAN and COMPRESS PDFs
  • FILL forms & Digitally Sign PDFs. PROTECT and Encrypt PDFs
  • 1 Year License for 1 Windows & 2 Mobile (Android and/or iOS) devices.

4. Generate PDFs with WeasyPrint (CLI or Python)

WeasyPrint is a document-oriented renderer with both a command-line interface and a Python API. It can be a good fit when your input is trusted HTML/CSS and you want a repeatable Python workflow, but it does not promise full browser/CSS parity. Check its supported CSS features before migrating a complex screen layout.

Command line

weasyprint input.html output.pdf

It can also accept a URL where your environment permits network access:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
weasyprint https://example.com/invoice.html invoice.pdf

Python API

from weasyprint import HTML

HTML(filename="input.html").write_pdf("output.pdf")
# Or: HTML(url="https://example.com/invoice.html").write_pdf("output.pdf")

Use a base URL when HTML contains relative assets loaded from a string or generated template. Treat untrusted HTML and CSS as hostile input: rendering can expose local files or consume excessive resources if isolation and the renderer’s security guidance are ignored.

Rank #4
PDF Extra Lifetime - Professional PDF Editor - Best Adobe Acrobat Pro Alternative - Lifetime License for Windows PC
  • Perfect Adobe Acrobat Pro alternative – lifetime license for Windows 10 and 11.
  • EDIT text, images, pages, hyperlinks, designs in PDF documents. ORGANIZE PDFs.
  • READ and Comment on PDFs – Intuitive reading modes & document commenting and mark up tools!
  • CREATE, COMBINE, SCAN and COMPRESS PDFs.
  • FILL forms & Digitally Sign PDFs. Work with Digital certificates

5. Which method should you choose?

Method Best fit What it provides Important trade-off
Chrome print preview Occasional manual conversion Point-and-click PDF saving, print settings and visual preview Dialog labels and destinations vary by OS and Chrome release
Chrome Headless Automated browser-faithful capture --print-to-pdf, header/footer suppression, timeout and virtual-time controls You must choose a wait strategy and verify scripts/assets have loaded
WeasyPrint Python or CLI document generation Filename/URL input and Python API Some CSS is unsupported; untrusted input requires security isolation
wkhtmltopdf Existing jobs already built around it Qt WebKit-based command-line conversion with options for local-file access Its public homepage evidence is old; verify maintenance, runtime compatibility and security before starting a new project

Choose by asking whether you need a human preview, JavaScript-heavy browser rendering, a Python-native pipeline, high-volume processing or strict isolation of uploaded content. There is no documented universal winner for speed, accuracy or cost; those results depend on the HTML, assets, renderer version and environment.

6. Fix common conversion problems

Blank or partly blank pages

  • Cause: the page had not finished loading, a script failed, or a remote request was blocked.
  • Fix: open it interactively first, confirm the content appears, then increase Headless --timeout or --virtual-time-budget and retry.

Images, fonts or CSS are missing

  • Cause: broken relative paths, moved companion files, inaccessible remote resources or a font blocked by policy.
  • Fix: restore the original folder structure, use correct absolute/relative URLs, and inspect the page in Chrome before printing.

Headers, footers or URLs appear unexpectedly

  • Cause: browser print metadata is enabled.
  • Fix: disable headers and footers in print preview, or add --no-pdf-header-footer to a Headless command.

Content is clipped or split badly

  • Cause: the selected paper size, scale, margins or print CSS do not match the layout.
  • Fix: try a different orientation or scale, adjust margins, add break-inside: avoid to cards/tables, and inspect each page in preview.

WeasyPrint output differs from Chrome

  • Cause: browser and document renderers support different CSS and layout features.
  • Fix: check WeasyPrint’s supported-feature documentation and simplify or provide print-specific CSS; use Chrome Headless when browser behavior is essential.

Server-side conversion raises a security concern

Do not render arbitrary uploaded HTML/CSS in the same trust boundary as your application. Apply the renderer’s security guidance, restrict network and filesystem access, and isolate jobs. Local-file access is especially important when HTML can reference paths outside its working directory.

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

7. Make automated jobs reliable

  • Use deterministic inputs: pin the renderer version in your build environment and keep CSS, images and fonts available at capture time.
  • Wait for readiness: for JavaScript pages, use a deliberate delay or virtual-time budget, then verify that the expected content exists.
  • Check the artifact: test that the PDF exists, has a nonzero size and contains the expected number of pages or text for your workflow.
  • Control resources: set timeouts, limit concurrent jobs and cap input size when processing user files.
  • Review representative pages: visual inspection catches missing backgrounds, overflow and page-break errors that a successful process exit cannot.

PDF output quality is determined by the print renderer and by whether content and assets were available at capture time. No method documented here guarantees pixel-identical output for every HTML/CSS combination.

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.
Best Value
Doxillion Free Document Converter for Mac – Converts DOCX, DOC, PDF, WPS and Many More Files Quickly [Download]
  • Convert over 50 document file formats.
  • Preview your files from Doxillion before converting them.
  • Use batch conversion to convert thousands of files at once.
  • Enjoy an easy-to-use, intuitive interface with a Drag and Drop file option.
  • Burn your converted or original files directly to disc.

Or skip the browser setup

If your HTML is available at a public or otherwise reachable URL, ScreenshotNeo can return a PDF through one GET request. See the ScreenshotNeo API documentation for parameters and response details.

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 response, set the service’s PDF option documented in the API reference and choose a URL that serves your HTML. The same endpoint can also return PNG, JPEG or WebP screenshots.

Python

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
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}`);

ScreenshotNeo removes cookie-consent banners, newsletter popups and chat widgets before capture. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and each response reports the page verdict and billing status in X-Page-Verdict and X-Billed headers. Its MCP server exposes take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

Frequently asked questions

Frequently Asked Questions

Can I convert HTML to PDF without installing a converter?

Yes. Chrome’s built-in print flow can save an opened local HTML file as a PDF, so a separate converter is not required for a basic manual job.

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

Why does my PDF have extra blank pages?

Oversized elements, fixed-height containers, print margins or page-break rules can push content onto new sheets. Check the preview and adjust print CSS, scale, margins or paper size.

Will JavaScript and interactive controls work in the PDF?

The page is rendered into a static document. JavaScript may create content before capture, but animations, live controls and other interactive behavior are not guaranteed to remain functional.

Is it safe to convert HTML uploaded by users?

Only with isolation and input controls. Untrusted HTML/CSS can create security problems, especially when the renderer can access local files or external resources.

Quick Recap

Bestseller No. 1
PDF Converter Ultimate - Convert PDF files into Word, Excel, PowerPoint and others - PDF converter software with OCR recognition compatible with Windows 11 / 10 / 8.1 / 8 / 7
PDF Converter Ultimate - Convert PDF files into Word, Excel, PowerPoint and others - PDF converter software with OCR recognition compatible with Windows 11 / 10 / 8.1 / 8 / 7
Convert your PDF files into Word, Excel & Co. the easy way; Convert scanned documents thanks to our new 2022 OCR technology
$29.99
Bestseller No. 2
Doxillion Free Document Converter – Converts DOCX, DOC, PDF, WPS and Many More Files Quickly [Download]
Doxillion Free Document Converter – Converts DOCX, DOC, PDF, WPS and Many More Files Quickly [Download]
Convert over 50 document file formats.; Preview your files from Doxillion before converting them.
Bestseller No. 3
PDF Extra Ultimate | Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Yearly License | 1 Windows PC & 2 Mobile Devices | 1 User
PDF Extra Ultimate | Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Yearly License | 1 Windows PC & 2 Mobile Devices | 1 User
READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.; CREATE, COMBINE, SCAN and COMPRESS PDFs
$83.88
Bestseller No. 4
PDF Extra Lifetime - Professional PDF Editor - Best Adobe Acrobat Pro Alternative - Lifetime License for Windows PC
PDF Extra Lifetime - Professional PDF Editor - Best Adobe Acrobat Pro Alternative - Lifetime License for Windows PC
Perfect Adobe Acrobat Pro alternative – lifetime license for Windows 10 and 11.; EDIT text, images, pages, hyperlinks, designs in PDF documents. ORGANIZE PDFs.
$99.99
Bestseller No. 5
Doxillion Free Document Converter for Mac – Converts DOCX, DOC, PDF, WPS and Many More Files Quickly [Download]
Doxillion Free Document Converter for Mac – Converts DOCX, DOC, PDF, WPS and Many More Files Quickly [Download]
Convert over 50 document file formats.; Preview your files from Doxillion before converting them.

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.