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.

To convert an .htm file to PDF, render it and print or export the rendered page as a PDF. Do not just rename the extension. For one file, open the HTM document in a browser and choose its print-to-PDF destination. For repeatable conversion, use wkhtmltopdf or Playwright’s page.pdf(). The right method depends on whether the file uses JavaScript, local images and stylesheets, print-specific CSS, or remote resources.

What an HTM-to-PDF conversion actually does

HTM is an HTML document extension. A PDF conversion renders the document, applies its CSS and available assets, lays the result out on pages, and writes those pages to a PDF file. Renaming report.htm to report.pdf changes only the name; it does not create PDF data and will not produce a readable document.

Rendering can differ from the browser window. Print CSS, paper size, margins, background graphics, page breaks, JavaScript timing, fonts, and access to local or remote assets all affect the result. Always inspect the generated PDF rather than assuming that a successful command means the layout is correct.

Fastest method for one local HTM file: print to PDF

This is the practical choice when you are converting a single file interactively. Browser menu names vary by browser and operating system, but the workflow is generally the same.

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
DeskFX Free Audio Effects & Audio Enhancer Software [PC Download]
  • Transform audio playing via your speakers and headphones
  • Improve sound quality by adjusting it with effects
  • Take control over the sound playing through audio hardware
  1. Keep the document’s assets together. If the HTM references images/, CSS files, fonts, or scripts with relative paths, leave those files in the locations expected by the document.
  2. Open the file in a browser. Use the browser’s Open File command or drag the .htm file into a window. Let images and scripts finish loading.
  3. Open the print dialog. Use the browser menu’s Print command or the operating system’s print shortcut.
  4. Select the PDF destination. Choose the browser’s Save to PDF, Print to PDF, or equivalent destination instead of a physical printer.
  5. Set page options. Choose paper size, portrait or landscape orientation, scale, margins, and whether background graphics should be included. If the document contains page-specific print CSS, leave the browser’s print-style option enabled.
  6. Save the file and inspect it. Check the first and last pages, headings, tables, images, hyperlinks, page breaks, and any footer or header added by the print dialog.

The exact labels and locations are browser-specific and can change between releases, so treat the names above as functional descriptions rather than a universal menu path.

Print-dialog settings that commonly change the result

Setting When to change it What to check afterward
Paper size Match the intended page, such as A4 or Letter. Tables and wide content should not be clipped.
Orientation Use landscape for wide tables, diagrams, or dashboards. Text should remain readable and margins should be balanced.
Margins Reduce excessive whitespace or increase margins when content touches the edge. No text, borders, or images should run beyond the printable area.
Scale Use only when the natural layout overflows or creates an unwanted extra page. Small text should remain legible; avoid hiding content by excessive shrinking.
Background graphics Enable when color blocks, background images, or shaded table cells are part of the design. Verify that decorative backgrounds did not make text hard to read.
Headers and footers Disable browser-added URLs, dates, or page titles when a clean document is required. Make sure required page numbers or document headings were not removed.

Prepare an HTM document before rendering

Keep relative resources available

A local document often points to neighboring images, stylesheets, JavaScript files, or fonts. A converter can render the HTML while silently omitting an asset it cannot read. Preserve the directory structure and relative paths, and run the conversion from an environment that can access those files.

Decide whether remote resources are required

Some documents load images, styles, fonts, or data from the network. A renderer must be allowed to reach those addresses, and the resources must be available when the conversion runs. If the source is intended to work offline, download the required assets and update the document to use local paths before converting.

Account for JavaScript-generated content

If the visible content is inserted after page load, a simple HTML-to-PDF command may capture an empty container or an incomplete page. Use a renderer with JavaScript support and wait for a known selector or application-ready condition before creating the PDF.

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

Use print-oriented CSS deliberately

Print CSS can hide navigation, change colors, and define page breaks. Playwright uses print CSS by default for page.pdf(). Other renderers expose switches for print media; confirm the behavior of the installed build rather than assuming that every package uses the same defaults.

Rank #2
MixPad Multitrack Recording Software for Sound Mixing and Music Production Free [Mac Download]
  • Mix an audio, music and voice tracks
  • Record single or multiple tracks simultaneously
  • Intuitive tools to split, trim, join, and many other editing features
  • Loaded with audio effects including EQ, compression, reverb, and more.
  • Load an audio file and export to all popular audio formats from studio quality wav to high compression formats

Automated conversion with wkhtmltopdf

wkhtmltopdf is an open-source, headless command-line utility that renders an input page or file to PDF using Qt WebKit. The basic form is:

wkhtmltopdf input.htm output.pdf

The input can also be a URL:

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

The wkhtmltopdf manual documents page objects and options related to JavaScript, print media, loading errors, and local-file access. The manual identifies version 0.12.6 with patched Qt; downstream packages and builds can differ, so check the version installed on your machine before relying on a particular switch.

Useful options for local and dynamic documents

wkhtmltopdf --enable-local-file-access --print-media-type --javascript-delay 1000 input.htm output.pdf
  • --enable-local-file-access allows the renderer to read permitted local resources when the build restricts local-file access.
  • --print-media-type requests print media styling when supported by the build.
  • --javascript-delay 1000 waits before rendering, which can help content that appears shortly after load. Choose a delay appropriate to the document rather than treating one value as universal.

Use the least local access necessary. A document that references assets outside its expected directory may still fail if the renderer or operating system blocks those paths. If a command reports a loading error, read the command’s output and test the input URL or file independently.

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

Batch conversion from a shell

For a directory of files, call the converter once per input and give each output a distinct name. A simple POSIX shell pattern is:

for f in *.htm; do
  wkhtmltopdf --enable-local-file-access "$f" "${f%.htm}.pdf"
done

Review failures individually. A batch loop can continue while producing a missing, partial, or blank PDF for one problematic document.

Rank #3
Free Fling File Transfer Software for Windows [PC Download]
  • Intuitive interface of a conventional FTP client
  • Easy and Reliable FTP Site Maintenance.
  • FTP Automation and Synchronization

Automated conversion with Playwright

Playwright controls a real browser engine and exposes page.pdf(). Its documented PDF controls include paper formats such as A4 and Letter, margins, background graphics, page ranges, and honoring the document’s CSS page-size preference. The API generates a PDF using print CSS by default.

Node.js example for a local HTM file

Install Playwright and its browser for the version you choose, then save this as convert.mjs:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import { chromium } from 'playwright';
import { pathToFileURL } from 'node:url';

const input = process.argv[2] || 'input.htm';
const output = process.argv[3] || 'output.pdf';
const browser = await chromium.launch();
const page = await browser.newPage();

await page.goto(pathToFileURL(input).href, { waitUntil: 'load' });
// Replace this delay with page.waitForSelector('your-ready-selector')
// when the document fills itself with JavaScript.
await page.waitForTimeout(500);

await page.pdf({
  path: output,
  format: 'A4',
  printBackground: true,
  preferCSSPageSize: true,
  margin: { top: '20mm', right: '15mm', bottom: '20mm', left: '15mm' }
});

await browser.close();

Run it with:

node convert.mjs input.htm output.pdf

For a document whose content becomes ready only after a specific request or component renders, replace the fixed delay with a selector wait. A selector-based wait is more predictable than guessing how many milliseconds a page needs.

Python example

With the Playwright Python package and its browser installed, this script performs the same operation:

import asyncio
import sys
from pathlib import Path
from playwright.async_api import async_playwright

async def main():
    source = Path(sys.argv[1] if len(sys.argv) > 1 else 'input.htm').resolve()
    target = sys.argv[2] if len(sys.argv) > 2 else 'output.pdf'
    async with async_playwright() as p:
        browser = await p.chromium.launch()
        page = await browser.new_page()
        await page.goto(source.as_uri(), wait_until='load')
        await page.wait_for_timeout(500)
        await page.pdf(
            path=target,
            format='A4',
            print_background=True,
            prefer_css_page_size=True,
            margin={'top': '20mm', 'right': '15mm', 'bottom': '20mm', 'left': '15mm'}
        )
        await browser.close()

asyncio.run(main())

Playwright’s API is version-sensitive. If an option is rejected, compare the option name and supported values with the documentation for the installed version.

Page ranges and long documents

When you need only part of a document, Playwright supports page ranges through its PDF options. Generate the complete file first when diagnosing layout problems; narrowing the range can otherwise hide a page-break or resource-loading issue.

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

Which workflow should you choose?

Need Best starting point Main consideration
One local file and visual inspection Browser print to PDF Fastest setup, but menu labels and defaults vary by browser.
Repeatable command-line jobs wkhtmltopdf Simple automation and documented switches, with behavior dependent on the installed build.
JavaScript-heavy pages or browser-level control Playwright More control over readiness, CSS, margins, backgrounds, and page ranges, at the cost of browser automation setup.
Publicly reachable pages without maintaining a browser runtime A hosted capture service Check how it handles consent banners, failed loads, billing, authentication, and PDF output.

Troubleshooting HTM-to-PDF conversion

The PDF is blank

  • Confirm that the source opens with visible content in a browser.
  • For JavaScript applications, wait for a ready selector or increase the renderer’s wait period.
  • Check whether the page requires authentication or a network request that the converter cannot make.

Images or styles are missing

  • Verify relative paths and keep the referenced files beside the HTM document in the expected structure.
  • For wkhtmltopdf, review local-file-access restrictions and use the documented access option only when needed.
  • Check whether remote URLs are reachable from the conversion environment.

The PDF uses the wrong colors or layout

  • Enable background graphics in a browser print dialog or set the renderer’s background option.
  • Check print media behavior and print-specific CSS.
  • Set the intended paper format, orientation, margins, and scale explicitly.

Content is cut off or creates unexpected page breaks

  • Try the document’s intended paper size and orientation before changing scale.
  • Inspect wide tables, fixed-width elements, and CSS page-break rules.
  • Use Playwright’s CSS page-size preference when the document defines a page size deliberately.

The command is not found or behaves differently on another machine

Install the tool in that environment and record its version. wkhtmltopdf packages can differ in Qt patches and available options; Playwright behavior depends on the installed library and browser version.

The conversion hangs

  • Look for scripts that keep connections open or pages that never reach an idle state.
  • Prefer a specific selector wait or bounded delay instead of waiting indefinitely for all network activity.
  • For remote pages, test DNS, TLS, authentication, and resource availability from the same machine running the converter.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability, and cost considerations

Browser printing has almost no setup cost for an occasional file, but it is difficult to standardize across people and machines. wkhtmltopdf is convenient for shell automation and can run without an interactive browser, while Playwright provides stronger control for modern, JavaScript-driven pages but requires a browser runtime and version management.

For reliable jobs, make the input deterministic: pin the renderer version, keep local assets available, set paper and margin options explicitly, wait for a known ready condition, and preserve logs. Treat a zero exit status as only one check; open or validate the resulting PDF and record failures separately.

Rendering time increases with page count, JavaScript work, remote assets, and large images. If you convert many files, process them in bounded batches rather than starting an unrestricted number of browser instances.

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

Or skip the browser setup

If your HTM page is publicly reachable by URL, ScreenshotNeo provides a hosted capture API and an MCP server for developers. It can return PNG, JPEG, WebP, or PDF output; for an AI-agent workflow, its MCP tools include capture_pdf, along with take_screenshot and get_page_info. A local file must first be hosted at an address the service can reach.

The API accepts a URL in one request. This example follows the documented call format:

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

See the ScreenshotNeo API documentation for the current output and PDF parameters. Equivalent requests in Python and Node.js are:

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)
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 and consent banners, newsletter popups, and chat widgets before capture; each cleanup step can be disabled. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed as clean shots, and the response reports the page verdict and billing status in X-Page-Verdict and X-Billed headers. It also supports custom CSS and JavaScript, waits, selectors, device and viewport settings, PDFs with paper and margin controls, signed links, asynchronous jobs, bulk capture, and an MCP connection for AI clients such as Claude or Cursor.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Plan Allowance and price
Free 1,000 shots per month, no card
Starter $5 for 3,000 shots
Growth $15 for 15,000 shots
Pro $39 for 60,000 shots
Scale $99 for 250,000 shots
Business $249 for 1,000,000 shots

Every feature is included on every plan, and yearly billing gives two months free. Create a free ScreenshotNeo account to start with 1,000 screenshots a month and no card.

Quick Recap

Bestseller No. 1
DeskFX Free Audio Effects & Audio Enhancer Software [PC Download]
DeskFX Free Audio Effects & Audio Enhancer Software [PC Download]
Transform audio playing via your speakers and headphones; Improve sound quality by adjusting it with effects
Bestseller No. 2
MixPad Multitrack Recording Software for Sound Mixing and Music Production Free [Mac Download]
MixPad Multitrack Recording Software for Sound Mixing and Music Production Free [Mac Download]
Mix an audio, music and voice tracks; Record single or multiple tracks simultaneously; Intuitive tools to split, trim, join, and many other editing features
Bestseller No. 3
Free Fling File Transfer Software for Windows [PC Download]
Free Fling File Transfer Software for Windows [PC Download]
Intuitive interface of a conventional FTP client; Easy and Reliable FTP Site Maintenance.; FTP Automation and Synchronization

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.