October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Convert HTML Files to PDF Without Losing Local Images

Local images appear in an HTML-to-PDF export only when the renderer can resolve their paths and read the files. Here’s how to convert and check the result.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To preserve local images when converting HTML to PDF, make sure the renderer can read the image files and resolve their paths relative to the HTML document. Then create the PDF with browser printing, WeasyPrint, or wkhtmltopdf and inspect the result. Saving as PDF does not repair a broken path or bypass local-file access restrictions.

Why local images go missing

An HTML document usually refers to images by URL or path. A relative path such as images/photo.jpg must be resolved against the right base location—often the HTML file’s directory, unless a <base> element or renderer setting changes it. The converter must also be permitted to read the resource. If the path is wrong, the file is inaccessible, or the renderer cannot handle how the image is supplied, changing the output format will not make it appear.

As an Amazon Associate I earn from qualifying purchases.

Image loading and final rendering can vary with the document, tool, version, and runtime configuration. The tools’ documentation describes options, not universal image-preservation guarantees.

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

Choose a conversion method

  • Browser print dialog: a straightforward choice for a page that already displays correctly in your browser.
  • Chrome Headless: useful for a command-line workflow. Its official documentation provides --print-to-pdf and a timeout option; validate local-file handling in your installed Chrome.
  • WeasyPrint: a Python option that accepts a local filename and supports a base URL for resolving relative resources.
  • wkhtmltopdf: a command-line renderer with image-loading and local-file-access options. Its stated engine is Qt WebKit, so do not assume its output will match every modern browser.

Consider whether the page relies on JavaScript, whether relative paths resolve correctly, the layout fidelity you need, how often you will convert, and whether the tool’s file-access policy fits your environment. The cited official documentation does not establish a benchmark comparing the fidelity of these approaches.

#1 Best Overall
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner
  • PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
  • QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
  • VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
  • INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
  • EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0

Use the browser print dialog

  1. Open the HTML file in the browser and check that its images display before printing.
  2. Open the browser’s print dialog and choose Save to PDF as the destination.
  3. Save the file, then reopen it and check pages containing images.

For scripted Chrome conversion, the Chrome Headless documentation shows chrome --headless --print-to-pdf input and the --no-pdf-header-footer option. It also documents --timeout=5000 as an example wait limit. The timeout limits how long Chrome waits; it does not guarantee that delayed images have loaded or that inaccessible files can be read. The documented examples target URLs, so confirm how your Chrome installation handles a local file URL and its assets. See the Chrome Headless CLI documentation.

Convert with WeasyPrint

WeasyPrint’s API accepts a local filename and lets you provide base_url for resolving relative URLs. If the HTML contains <img src="images/photo.jpg">, point the base URL at the directory against which that relative path should resolve—commonly the HTML file’s parent directory.

Rank #2
Sale
Brother DS-640 Compact Mobile Document Scanner, (Model: DS640)
  • FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
  • READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
  • WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
  • OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)
from weasyprint import HTML

HTML(
    filename="/path/to/page.html",
    base_url="/path/to/"
).write_pdf("page.pdf")

Adjust both paths to your files. WeasyPrint documents support for local files and raster image formats as well as SVG in image elements; check the documentation for the release you have installed: API reference and first steps.

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.

Convert with wkhtmltopdf

wkhtmltopdf documents image loading as enabled by default; --no-images disables it. Its usage documentation says local-file access is disabled by default. To permit local assets, use --enable-local-file-access or allow specific paths with --allow. Where practical, allow only the asset directory the document needs rather than granting broad access.

Rank #3
Sale
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
  • STAY ORGANIZED – Easily convert your paper documents into digital formats like searchable PDF files, JPEGs, and more.Power Consumption : 2.5W or less (Energy Saving Mode: 0.7W). Suggested Daily Volume : 500 scans..Does it contain liquid: no
  • CONVENIENT AND PORTABLE –lightweight and small in size, you can take the scanner anywhere from home offices, classrooms, remote offices, and anywhere in between
  • HANDLES VARIOUS MEDIA TYPES – Digitize receipts, business cards, plastic or embossed cards, reports, legal documents, and more
  • FAST AND EFFICIENT – No technical hurdles or complicated setups here; easily scan both sides of a document at the same time, in color or black-and-white, at up to 12 pages-per-minute, and with a 20 sheet automatic feeder
  • BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer

The usage documentation also lists load-error and media-error handling options that can help diagnose missing resources. Check the flags supported by your installed version and consult the official usage documentation. The project homepage describes wkhtmltopdf as an open-source command-line renderer based on Qt WebKit; that description is not a guarantee of modern-browser rendering parity.

Check the PDF and troubleshoot missing images

  1. Verify the source first. Open the HTML and confirm the image displays there.
  2. Check each resource reference. Review image src values and CSS url(...) references. Determine whether paths are relative to the HTML file, a <base> element, or an absolute filesystem path.
  3. Check the renderer’s access and base settings. For WeasyPrint, confirm base_url. For wkhtmltopdf, check local-file-access and image/media options. In a browser, confirm it can read the local assets.
  4. Allow time for rendering where needed. A wait limit may help with a page that takes longer to render, but it cannot fix a wrong path or a blocked resource.
  5. Inspect every relevant PDF page. Check that images are present and legible, especially large images, CSS backgrounds, and images that load late.

If an image still does not appear, the markup may depend on unsupported behavior or script-generated resources. The cited documentation does not settle every compatibility case; test the specific document with the installed tool and inspect its output.

Rank #4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
  • IRIScan Express, portable scanner : scans color and black and white documents a blazing speed up to 8ppm simplex. Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • IRIScan Express mobile scanner is powered via an included micro USB 2. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan. USB cable provided. AC Adapter not provided and not needed.
  • IRIScan flatbed scanner uses a simplex scanning mode allows for quick and straightforward scanning of single-sided documents. IRIScan with its full portable features is the ideal document scanners for computers.
  • IRIScan document scanner : Versatile scanning capabilities, including scanning to Word, PDF, and Excel formats with companion software provided Readiris OCR
  • Receipt scanner and card scanner with Additional features include scanning business cards directly to Outlook, photo scanning, and receipt scanning for efficient document management
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 you need a screenshot of a web page rather than a PDF of a local HTML file, ScreenshotNeo is a website screenshot API and MCP server for developers. Its one-call API returns an image or PDF:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" 
  -d access_key=YOUR_API_KEY 
  --data-urlencode url=https://stripe.com 
  -o shot.pdf

See the ScreenshotNeo API documentation for request options. It accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status. Its MCP server includes take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up for 1,000 free screenshots a month, with no card.

Quick Recap

SaleBestseller No. 3
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer; This product is not intended for scanning photographs on photo paper / photographic media
$153.00
Bestseller No. 4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
Find our Software here : irislink.com/start; IRIScan Express is only compatible Windows platform and not macintosh
$129.00
Bestseller No. 5
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Scanner type: Document; Connectivity technology: USB; With Auto Scan Mode, the scanner automatically detects what you're scanning
$75.00
Best Value
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
  • Scanner type: Document
  • Connectivity technology: USB
  • With Auto Scan Mode, the scanner automatically detects what you're scanning
  • Digitize documents and images

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.