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 use wkhtmltopdf in Docker, install a build that matches the container’s Linux distribution and architecture, include its runtime libraries and fonts, then convert HTML to a PDF in a directory that persists after the container exits. wkhtmltopdf runs headlessly, so the upstream project says a display service is not required. Compatibility and security need care: the project describes its Qt/WebKit foundation as old and warns against processing untrusted HTML or JavaScript.

Build an image with a compatible wkhtmltopdf package

There is no single official Dockerfile that works for every base image. The wkhtmltopdf downloads page explains that packages are distribution-specific and that even builds described as static still need system packages and runtime font configuration. Choose a package for the image’s operating system and CPU architecture; do not assume a generic Linux binary will run everywhere. The project’s downloads page documents available packages and an Amazon Linux 2 container example.

Alpine needs particular caution: it uses musl, while many Linux packages are built for glibc. Prefer a package intended for your image’s distribution and architecture rather than trying to make an incompatible binary work.

Example: Debian-based image

The following is a Dockerfile pattern for a Debian-based image. It installs the distribution’s wkhtmltopdf package and common font/runtime components. Package availability and version vary by Debian release; verify the package and libraries for the exact base image you select. The official project does not provide this as a universal Dockerfile.

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.
FROM debian:bookworm-slim

RUN apt-get update && apt-get install -y --no-install-recommends 
    wkhtmltopdf 
    fontconfig 
    fonts-dejavu-core 
    && rm -rf /var/lib/apt/lists/*

WORKDIR /work

CMD ["wkhtmltopdf", "--version"]

Build and check the installed executable:

docker build -t html-to-pdf .
docker run --rm html-to-pdf

The version check confirms that the binary starts; it does not prove that every feature your documents need is available. Distribution builds may differ from builds using patched Qt, which can affect such features as multi-object PDFs, headers, and footers. Check the actual binary and test a representative document before relying on those options.

Amazon Linux 2 binary-bundle pattern

The project’s downloads page illustrates a different approach for Amazon Linux 2: mount extracted files under /opt, then run the executable with the library and font paths set. It shows LD_LIBRARY_PATH=/opt/lib and FONTCONFIG_PATH=/opt/fonts. Those paths belong to that bundled setup; use the paths documented for your own package rather than copying them blindly.

docker run --rm 
  -v "$PWD/wkhtmltopdf-bundle:/opt:ro" 
  -v "$PWD/output:/output" 
  amazonlinux:2 
  sh -c 'LD_LIBRARY_PATH=/opt/lib FONTCONFIG_PATH=/opt/fonts 
    /opt/bin/wkhtmltopdf /input.html /output/result.pdf'

This example assumes /input.html is available in the container; mount it as well or adapt the input path. The project’s example is a pattern for a particular distribution and extracted bundle, not a recommendation that every Docker deployment use Amazon Linux.

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.

Convert a local HTML file or a URL

The basic command is wkhtmltopdf input.html output.pdf. A URL can be used in place of the local HTML input. The documented command syntax is wkhtmltopdf [GLOBAL OPTION]... [OBJECT]... <output file>; global options go before the document objects, and page-specific options can be applied to page objects. The command-line documentation describes the available options and object types.

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.

Run the converter in an already-built image

Mount the source and output directories so the PDF remains available on the host after the container exits:

mkdir -p output
docker run --rm 
  -v "$PWD:/work:ro" 
  -v "$PWD/output:/output" 
  html-to-pdf 
  wkhtmltopdf /work/input.html /output/result.pdf

For a page reachable from inside the container, pass its URL instead:

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.
docker run --rm 
  -v "$PWD/output:/output" 
  html-to-pdf 
  wkhtmltopdf https://example.com /output/page.pdf

Writing only to the container’s writable layer is not durable across container removal. Use a bind mount, Docker-managed storage, or the application’s persistent storage workflow for the output.

Combine pages, a cover, or a table of contents

wkhtmltopdf supports document objects for pages, covers, and tables of contents, arranged in the intended order. The exact options and behavior can depend on the build’s Qt variant, so verify the installed build before incorporating these features into a production workflow. Put global options before objects and object-specific page options with the relevant page object.

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

Supply fonts and runtime configuration

Missing or differently configured fonts can change line wrapping, page count, and layout. The project identifies font configuration as a runtime requirement, including fontconfig and freetype. Install the fonts your documents require in the image and make sure fontconfig can find them. A Qt linkage described as static does not remove all system package requirements.

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
  • Include fontconfig and the fonts required by the document’s language and design.
  • Test representative HTML containing the actual characters, font families, and page layouts used in production.
  • For bundled builds, follow that package’s documented library and font paths; the project’s Amazon Linux 2 example uses LD_LIBRARY_PATH=/opt/lib and FONTCONFIG_PATH=/opt/fonts.

Check version and feature compatibility

The project downloads page identifies 0.12.6 as the stable series and dates that release to June 11, 2020. That is dated release information, not confirmation that a given package is current or suitable for your image. Check the project’s current release and package listing when choosing and pinning a build. Its package table is tied to specific operating-system releases and architectures.

Before deployment, record the version shown by wkhtmltopdf --version and test the options that matter to your output. The project distinguishes patched-Qt builds from distribution builds; if you need headers, footers, or multi-object documents, verify those capabilities on the exact binary you will deploy.

Protect the container from unsafe input

The wkhtmltopdf project warns: “Do not use wkhtmltopdf with any untrusted HTML – be sure to sanitize any user-supplied HTML/JS, otherwise it can lead to complete takeover of the server it runs on!” The warning is especially important when a service converts user-provided markup or scripts. Do not treat running in a container as a substitute for sanitizing input or limiting the renderer’s privileges.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
  • Sanitize user-supplied HTML and JavaScript before conversion, or avoid accepting them.
  • Run the converter with least privilege and isolate it from sensitive files and services.
  • Consider mandatory access controls such as AppArmor or SELinux, which the project suggests considering.

The project’s status page describes the underlying stack as old: Qt 4 has been unsupported since 2015, and the WebKit version in it had not been updated since 2012. It also notes wkhtmltopdf’s reliance on the WebKit1 in-process API and warns about its security state. Treat it as a legacy rendering choice, particularly when processing dynamic or user-controlled content. Read the project’s status guidance.

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

Troubleshoot common Docker failures

  • Executable fails to start or reports a missing shared library: The binary may not match the base image, or a runtime dependency is missing. Use a package built for the image’s distribution and architecture, install required libraries, and consult the package’s documented runtime paths.
  • Alpine reports an incompatible binary: Alpine uses musl, while many packages target glibc. Select a compatible package or a base image supported by the package; do not assume a glibc-targeted binary will work unchanged.
  • Text is missing, substituted, or laid out differently: Install the needed fonts and fontconfig, confirm that font configuration can locate them, and retest with the same fonts in the deployed image.
  • PDF exists in the container but disappears afterward: The output was written to ephemeral container storage. Write it under a mounted output directory or the application’s persistent storage.
  • Headers, footers, or multiple objects do not behave as expected: Check whether the installed executable is a patched-Qt build and test the required feature on that exact version; distribution builds can differ.
  • A page does not render as expected: Confirm that the URL is reachable from inside the container, and check the command-line options and rendering requirements for the source page. The available evidence does not establish a universal fix for site-specific rendering problems.

When to keep wkhtmltopdf—and when to choose another renderer

The project suggests WeasyPrint or the commercial tool Prince for report generation from HTML you control, and Puppeteer or a wrapper for sites that depend on dynamic JavaScript. These are project recommendations, not a claim that one alternative is best for every workload.

Choose based on the security and maintenance of the rendering engine, compatibility with your CSS and JavaScript, package availability and runtime complexity for your container, and the document features you need—such as headers, footers, covers, a table of contents, or multi-page output. If wkhtmltopdf meets those requirements for controlled input, test and pin a compatible build; for new deployments, weigh its legacy Qt/WebKit foundation carefully.

Or skip the browser setup

If your goal is a screenshot or PDF of a live web page rather than a locally rendered document, ScreenshotNeo is a website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF; its options include PDF paper size, margins, landscape, and page ranges.

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

See the ScreenshotNeo API documentation for parameters and output options. Cookie and consent banners are accepted and removed along with 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the page verdict and billing status in headers. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

Does wkhtmltopdf require an X server in Docker?

No. The wkhtmltopdf project describes the converter as headless; its upstream build does not require a display service.

Can I use a generic static Linux wkhtmltopdf binary in any Docker image?

No. Static Qt linkage does not remove every runtime dependency, and packages can depend on distribution, architecture, and libc compatibility.

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.