How to Convert HTML to PDF on Windows
Windows includes built-in PDF printing capabilities through the Microsoft Print to PDF virtual printer, which means any browser or app that can open an HTML file can also export it as a PDF without installing additional software. Chrome and Microsoft Edge both provide polished print-to-PDF dialogs with quality controls. For developers and power users, wkhtmltopdf and headless Chrome provide command-line conversion. This guide covers four methods: Edge's print-to-PDF (the built-in Windows browser), Chrome's print-to-PDF, Microsoft Print to PDF from any application, and the command-line approach for batch or automated conversions. All methods described here are free. The right choice depends on whether you need a one-off conversion in a browser, or a repeatable automated workflow.
Method 1: Microsoft Edge's Print to PDF
Edge is Windows 10 and 11's built-in browser and includes a polished PDF export with a print preview that shows exactly how the output will look. Edge handles most modern web pages reliably and integrates with Windows sharing and storage features.
- 1Open the web page or HTML file in Microsoft Edge (use Ctrl+O to open a local HTML file)
- 2Press Ctrl+P to open Edge's print dialog
- 3In the Printer dropdown, select 'Save as PDF' (this is Edge's built-in PDF printer)
- 4Adjust orientation, paper size, margins, and enable 'Background graphics' if needed, then click 'Save' and choose the save location
Method 2: Chrome's Print to PDF on Windows
Chrome's print-to-PDF on Windows uses Chrome's own PDF generation (distinct from the Windows print subsystem) and generally produces high-fidelity output for complex CSS including custom fonts, gradients, and modern layout features. It is the preferred browser for HTML-to-PDF conversion when visual accuracy is important.
- 1Open the HTML file or web page in Chrome (Ctrl+O for local files)
- 2Press Ctrl+P to open the print dialog
- 3Set Destination to 'Save as PDF' — look in the dropdown and select it
- 4Under More Settings, enable 'Background graphics' for color backgrounds; set margins to fit your content; click Save
Method 3: Microsoft Print to PDF from Any App
Windows 10 and 11 include a 'Microsoft Print to PDF' virtual printer that appears in every application's print dialog. This means any Windows application that can open or display an HTML file — browsers, HTML editors, code editors with preview — can print to PDF without any third-party software. Open the file, press Ctrl+P, select 'Microsoft Print to PDF' as the printer, and click Print. Windows prompts you for a filename and save location. The quality of the output depends on how well the application renders the HTML. For styled HTML with CSS, use a browser (Edge or Chrome). For raw HTML code review or simple structured HTML, the Microsoft Print to PDF virtual printer works from any app. This approach is also useful for converting HTML email saved as .eml or .html by opening it in Edge or Chrome and printing to PDF.
- 1Open the HTML file in Edge, Chrome, or another capable application
- 2Press Ctrl+P to open the print dialog
- 3Select 'Microsoft Print to PDF' from the printer list
- 4Click Print, then enter a filename and choose a save location when prompted
Method 4: Command-Line Conversion for Automation on Windows
For batch conversion or automated PDF generation from HTML on Windows, two command-line tools are commonly used. wkhtmltopdf is available as a Windows installer from wkhtmltopdf.org — after installation, run `wkhtmltopdf input.html output.pdf` from Command Prompt or PowerShell. It uses the WebKit rendering engine and handles most CSS well. Headless Chrome on Windows works similarly: `'C:\Program Files\Google\Chrome\Application\chrome.exe' --headless --print-to-pdf=output.pdf file:///C:/path/to/file.html`. PowerShell scripts can loop over multiple files for batch conversion. For .NET developers, PuppeteerSharp provides a C# API for headless Chrome PDF generation. Node.js developers can use Puppeteer directly on Windows. These approaches are the foundation of professional HTML-to-PDF generation pipelines for invoices, reports, and certificates on Windows servers.
Frequently Asked Questions
What is the difference between Chrome's Save as PDF and Microsoft Print to PDF?
Chrome's 'Save as PDF' uses Chrome's internal PDF generation engine (PDFium), which is tightly integrated with Chrome's Blink rendering engine. Microsoft Print to PDF uses the Windows print subsystem and the XPS-to-PDF pathway. For HTML content displayed in Chrome, Chrome's own Save as PDF produces more accurate output because the same engine that rendered the page also generates the PDF. Microsoft Print to PDF is better when printing from apps other than Chrome that use the Windows print API.
Can I convert multiple HTML files to PDF at once on Windows?
Using wkhtmltopdf or headless Chrome from PowerShell, you can batch convert multiple HTML files. A PowerShell loop: `Get-ChildItem *.html | ForEach-Object { wkhtmltopdf $_.FullName ($_.BaseName + '.pdf') }` converts all HTML files in the current directory to PDF. For Edge or Chrome GUI, you process one file at a time. For high-volume or automated workflows on Windows Server, headless Chrome via Puppeteer is the most robust approach.
Why does my HTML file look wrong when printed to PDF on Windows?
Common causes: the HTML references external CSS or image files with relative paths that cannot be found during print, external fonts loaded from Google Fonts CDN are not fetched, or browser-specific CSS features are not supported by the rendering engine. Fix by inlining all CSS into a style tag in the HTML head, embedding images as base64, and testing in the browser before printing. For complex modern CSS, Chrome typically renders it most accurately. Edge also uses the Blink engine and performs comparably.