Ubuntu 26.04 and 26.10 don’t package wkhtmltopdf anymore, so when you run sudo apt install wkhtmltopdf it stops with “has no installation candidate”. The fix is the patched jammy .deb from the archived wkhtmltopdf packaging releases. It installs cleanly on Ubuntu 26.10, 26.04 and 24.04, and the bookworm .deb does the same job on Debian 13 and 12. You have no repository to add and nothing to compile.
We’ll install the patched build, clear the 404 and dependency errors older guides run into, then fix what breaks once you start converting: blocked local images, missing CJK fonts, flexbox layouts and pdfkit. Every command below was run on Ubuntu 26.10, Ubuntu 26.04 (amd64 and arm64), Ubuntu 24.04, Debian 13 and Debian 12 in November 2026.
Pick the right package for your release
Two builds exist and they behave differently. The distro package links against stock Qt and ignores headers, footers, the table of contents and several page options. The patched build from the packaging repo bundles its own patched Qt and supports all of them. Here’s what you get on each release:
| Release | Distro package (apt) | Patched build to install |
|---|---|---|
| Ubuntu 26.10 | None, apt reports Candidate: (none) | jammy .deb |
| Ubuntu 26.04 LTS | None, apt reports Candidate: (none) | jammy .deb (amd64 or arm64) |
| Ubuntu 24.04 LTS | 0.12.6-2build2, unpatched Qt | jammy .deb |
| Debian 13 (trixie) | None, apt reports Candidate: (none) | bookworm .deb |
| Debian 12 (bookworm) | 0.12.6-2+b1, unpatched Qt | bookworm .deb |
No builds were ever published for the noble, resolute, stonking or trixie codenames, so a dedicated wkhtmltopdf Ubuntu 26.04 or 26.10 package doesn’t exist upstream either. The jammy package runs on all three current Ubuntu releases, and the bookworm package runs on both Debian releases. That mapping is the whole trick, and the script in the next section does it for you.
Where the distro package still exists, it’s the wrong one for you to install. On our Ubuntu 24.04 VM, with curl and poppler-utils already present, it pulled in 174 packages, most of them Qt 5 and its graphics stack, and on Debian 12 it pulled in 191. The patched .deb needed 8 on the same machines. The unpatched build then refuses a footer flag and writes a PDF without the footer:

The grep -c count of 0 shows the footer text never reached the PDF, and the producer line names Qt 5.15.13 instead of the patched Qt 4.8.7. Debian 12 printed the same warning with Qt 5.15.8. If which wkhtmltopdf returns /usr/bin/wkhtmltopdf, you have the distro build, so remove it before you continue:
sudo apt purge -y wkhtmltopdf
sudo apt autoremove -y
Don’t skip the autoremove. It clears the Qt 5 libraries that came in with the distro package, and nothing else on your server needs them.
Install the patched wkhtmltopdf build
Start with curl for the download and poppler-utils, which gives you pdfinfo and pdftotext to check the PDFs you produce:
sudo apt update
sudo apt install -y curl poppler-utils
The release tag, the package suite and the CPU architecture all go into the download URL. Detect all three instead of typing them, so you can paste the same block on any supported machine. The suite is jammy on Ubuntu and its derivatives and bookworm on Debian. The fallback tag only applies when the GitHub API rate limit returns nothing, and since the repo is archived it will never publish a newer one:
. /etc/os-release
case " $ID $ID_LIKE " in
*" ubuntu "*) WK_SUITE=jammy ;;
*" debian "*) WK_SUITE=bookworm ;;
*) echo "Unsupported distribution: $ID" ;;
esac
ARCH=$(dpkg --print-architecture)
WK_TAG=$(curl -s https://api.github.com/repos/wkhtmltopdf/packaging/releases/latest | grep -oP '"tag_name": "\K[^"]+')
WK_TAG=${WK_TAG:-0.12.6.1-3} # pin: archived repo, last tag https://github.com/wkhtmltopdf/packaging/releases
echo "$WK_TAG $WK_SUITE $ARCH"
If you see Unsupported distribution, stop here: the packaging repo only builds for the Debian and Ubuntu families. On Ubuntu 26.04 the three values came back as:
0.12.6.1-3 jammy amd64
Debian prints bookworm in the middle, and an ARM machine such as a Graviton or Ampere instance prints arm64 at the end. The last release ships amd64, arm64 and ppc64el files for both suites, plus i386 for bookworm, so a 32-bit armhf board gets a 404 here. Download the matching package and install it with apt, which resolves its dependencies from your own release:
curl -fsSLO "https://github.com/wkhtmltopdf/packaging/releases/download/${WK_TAG}/wkhtmltox_${WK_TAG}.${WK_SUITE}_${ARCH}.deb"
sudo apt install -y "./wkhtmltox_${WK_TAG}.${WK_SUITE}_${ARCH}.deb"
The leading ./ is what tells apt this is a local file rather than a package name. The package lands as wkhtmltox, and both binaries go to /usr/local/bin. Confirm the patched build is the one on your PATH:
wkhtmltopdf --version
which wkhtmltopdf wkhtmltoimage
On Ubuntu 26.10 the end of that sequence, from the detected values to the version check, looked like this:

Your version string must say “with patched qt”. Ubuntu 26.10 installed 9 new packages against 8 on the other releases, and the arm64 build on Ubuntu 26.04 gave the same result as amd64. Debian 13 needs the bookworm file, and the run there ended the same way:

The package also ships libwkhtmltox.so in /usr/local/lib, which is what language bindings that skip the CLI link against. Its runtime dependencies, read from the .deb with dpkg-deb -f, are short:
ca-certificates, fontconfig, libc6, libfreetype6, libjpeg-turbo8, libpng16-16, libssl3, libstdc++6, libx11-6, libxcb1, libxext6, libxrender1, xfonts-75dpi, xfonts-base, zlib1g
The bookworm package lists libjpeg62-turbo in place of libjpeg-turbo8. That one difference is why you can’t swap the files between Ubuntu and Debian. No X server is involved: the patched Qt renders headless, so it runs fine on a minimal cloud image.
Fix the common install errors
Four errors account for nearly every failed install we’ve seen on current releases, and you’ll hit them in roughly this order:
- apt has no wkhtmltopdf package to offer
- the download URL points at a file that never existed
- dpkg leaves the package unconfigured
- the shell or service runs the wrong binary, or none
Each one below was reproduced on the lab machines, so the messages match what you’ll see.
Error: Package ‘wkhtmltopdf’ has no installation candidate
This is what sudo apt install wkhtmltopdf prints on Ubuntu 26.04, Ubuntu 26.10 and Debian 13. Debian removed the package from testing in February 2025, before trixie shipped, and Ubuntu dropped it in 25.04, so 26.04 is the first LTS without it. apt only knows the name because other packages still mention it:

An empty candidate in apt-cache policy confirms there is nothing for you to install from the archive, and enabling universe or backports won’t change that. Install the patched .deb from the section above instead.
Error: curl: (22) The requested URL returned error: 404
Many guides build the download URL from lsb_release -cs. Of the five releases tested here, that works on Debian 12 only. Ubuntu 26.10 resolves to stonking, 26.04 to resolute, 24.04 to noble and Debian 13 to trixie, and the packaging repo never published those files:
curl: (22) The requested URL returned error: 404
Map the release to jammy or bookworm as the script does and your download succeeds. The other 404 comes when you copy an old file name. A URL such as wkhtmltox_0.12.6.1-2.bookworm_amd64.deb fails, because the 0.12.6.1-2 release from 2022 has no bookworm files. Its wkhtmltox_0.12.6.1-2.jammy_amd64.deb still downloads, but the 0.12.6.1-3 release from May 2023 is the last one and the only release with bookworm files, so use it on both families.
Error: dependency problems prevent configuration of wkhtmltox
Installing the file with dpkg -i instead of apt skips dependency resolution. dpkg unpacks the package, then leaves it unconfigured because fontconfig and the X11 font packages are missing. apt repairs it in one command:

sudo apt install -f -y pulled in the 7 missing packages and finished configuring wkhtmltox. If you use apt install ./file.deb from the start, you avoid the detour, which is why the install section uses it.
Error: wkhtmltopdf: command not found, or the wrong binary runs
The patched build lives in /usr/local/bin, which cron’s default PATH leaves out, as do services and app servers that set their own PATH. When a job works in your shell and fails under cron, call the binary by its full path or set PATH in the crontab. The opposite problem shows up when the distro package is still installed. which -a lists every copy in PATH order:
which -a wkhtmltopdf
A /usr/bin/wkhtmltopdf line means the unpatched build is installed. Purge it as shown earlier, otherwise anything with a PATH that lists /usr/bin first, or only /usr/bin, silently picks the copy that drops your footers.
Convert an HTML file to PDF
Create a working directory with a small invoice that references a local logo, which is where most real templates trip:
mkdir -p ~/invoices && cd ~/invoices
vim invoice.html
Paste the template and save it. Put any PNG named logo.png next to it. On a bare server, copy a small one over from your workstation with scp:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Invoice 2026-118</title>
<style>
body { font-family: "DejaVu Sans", sans-serif; padding: 24px; }
h1 { color: #2c3e50; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #ccc; padding: 8px; text-align: left; }
th { background: #f4f4f4; }
</style>
</head>
<body>
<img src="logo.png" width="64" alt="logo">
<h1>Invoice 2026-118</h1>
<p>Billed to: Example Corp</p>
<table>
<tr><th>Item</th><th>Price</th></tr>
<tr><td>VPS hosting (12 months)</td><td>$240.00</td></tr>
<tr><td>Managed backups</td><td>$60.00</td></tr>
<tr><td><strong>Total</strong></td><td><strong>$300.00</strong></td></tr>
</table>
</body>
</html>
Convert it with the plain two-argument form first:
wkhtmltopdf invoice.html invoice.pdf
It writes a PDF, but without the logo, and exits with status 1:
Warning: Blocked access to file /home/josphat/invoices/logo.png
Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown
Exit with code 1 due to network error: ProtocolUnknownError
Since 0.12.6, wkhtmltopdf blocks local file access by default. Scripts that worked on older builds break here, and a cron job that checks the exit code will report a failure every night even though a PDF appeared. Allow local files explicitly for templates you control, then check the result:
wkhtmltopdf --enable-local-file-access invoice.html invoice.pdf
pdfimages -list invoice.pdf
pdfinfo invoice.pdf | grep -E "Pages|Page size|Producer"
The logo is now embedded, and the producer line shows the Qt build doing the work:

Qt 4.8.7 is the engine inside the patched build, and it explains most of wkhtmltopdf’s CSS limits, which the layout section below tests. Never pass --enable-local-file-access when the HTML comes from users, since it lets that HTML read any local file the process can open.
Add page numbers, margins and a PDF title
Headers and footers are the main reason you want the patched build. Page size, orientation and margins are flags too:
wkhtmltopdf --enable-local-file-access \
--page-size A4 --orientation Portrait \
--margin-top 20mm --margin-bottom 20mm \
--title "Invoice 2026-118" \
--footer-center "Page [page] of [topage]" --footer-font-size 8 \
invoice.html invoice-styled.pdf
Check that the title and the footer text made it into the file:
pdfinfo invoice-styled.pdf | grep -E "Title|Pages"
pdftotext invoice-styled.pdf - | grep "Page 1"
Both are present:
Title: Invoice 2026-118
Pages: 1
Page 1 of 1
Templates written for the browser often carry a print stylesheet that hides buttons and navigation. wkhtmltopdf renders with the screen media type unless you ask otherwise. Create a small test page to see the difference:
vim media.html
Paste this page, which hides a “Pay online” paragraph in print:
<!DOCTYPE html>
<html><head><meta charset="utf-8"><style>
@media print { .no-print { display: none; } }
</style></head><body>
<p>Invoice body</p>
<p class="no-print">Pay online button (screen only)</p>
</body></html>
Render it twice, once with the default media type and once with the print rules:
wkhtmltopdf -q media.html screen.pdf
wkhtmltopdf -q --print-media-type media.html print.pdf
Running pdftotext on both files shows the screen-only line disappearing once the print rules apply:
--- default:
Invoice body
Pay online button (screen only)
--- --print-media-type:
Invoice body
The flags you’ll reach for most often:
| Flag | What it does | Example |
|---|---|---|
| –page-size | Paper size (A4, A3, Letter, Legal) | –page-size Letter |
| –orientation | Portrait or Landscape | –orientation Landscape |
| –margin-top / -bottom / -left / -right | Page margins in mm, cm or in | –margin-top 20mm |
| –header-center, –footer-center | Header or footer text; [page] and [topage] expand to numbers | –footer-center “Page [page] of [topage]” |
| –header-html, –footer-html | Use an HTML file as the header or footer | –footer-html footer.html |
| –title | PDF metadata title | –title “Invoice 2026-118” |
| –print-media-type | Apply @media print rules instead of screen | –print-media-type |
| –javascript-delay | Milliseconds to wait for scripts (default 200) | –javascript-delay 1000 |
| –enable-local-file-access | Allow file:// images, CSS and fonts | –enable-local-file-access |
| -q | Silence the progress bars in logs | -q |
The header and footer flags are the ones the distro package drops with the “unpatched qt” warning shown earlier, so a missing footer is the quickest sign the wrong build is on your PATH.
Install fonts for Chinese, Japanese and Korean text
If your documents contain Chinese, Japanese or Korean text, check fonts first, because a fresh server ships Latin fonts only. fc-list :lang=zh | wc -l returned 0 on every test machine, and wkhtmltopdf doesn’t warn about it. It renders each missing glyph as an empty box and still writes the PDF. This test page mixes simplified Chinese, Japanese and English:

Only the Latin text, the digits and the punctuation survive. Install the Noto CJK family, which covers Chinese, Japanese and Korean in one package:
sudo apt install -y fonts-noto-cjk
fc-list :lang=zh | wc -l
The count went from 0 to 30, and the same file rendered correctly with no change to the HTML or the command:

pdffonts on the new PDF lists NotoSansCJKjp-Regular and NotoSansCJKjp-Bold embedded next to DejaVu Sans, so the file displays the same for your customers even when their machines lack those fonts. wkhtmltopdf picks the fallback through fontconfig, so any font package that registers the language with fc-list works the same way.
Check which CSS layouts render
Some guides claim the patched build handles flexbox. It doesn’t handle display: flex. We rendered three two-column rows: one with display: flex, one with display: grid and one with the 2009 display: -webkit-box syntax:

Flex and grid fall back to block layout, so the boxes stack. Only -webkit-box with -webkit-box-flex: 1 on the children puts them side by side, and pdftotext -layout on the PDF agreed: only the WEBKITBOX row came out on one line. For your invoices, HTML tables or floats are the reliable choice. If your templates are built on a modern CSS framework, they will not lay out correctly here, and that’s the strongest reason to move them to one of the engines in the last section.
Save a web page URL as a PDF
Pass a URL instead of a file. The -q flag keeps the progress bars out of your logs:
wkhtmltopdf -q https://example.com example.pdf
ls -lh example.pdf
pdftotext example.pdf - | head -3
The page text is in the PDF:
-rw-rw-r-- 1 josphat josphat 9.1K Nov 22 13:18 example.pdf
This domain is for use in documentation examples
without needing permission. This is not a service;
avoid relying on it for testing and monitoring
Static pages are fine. Single-page apps are not. The 2012 WebKit can’t parse modern JavaScript, so React and Vue dashboards come out blank or half drawn no matter how long --javascript-delay waits. In our alternatives benchmark even ES2020 optional chaining failed. Those pages need a real browser, such as Chrome headless with –print-to-pdf or Playwright.
Generate images with wkhtmltoimage
The same package ships wkhtmltoimage, which writes PNG, JPG or SVG. Width is yours to set, and height follows the content:
wkhtmltoimage --enable-local-file-access --format png --width 1024 invoice.html invoice.png
file invoice.png
The result is a 1024 pixel wide PNG:
invoice.png: PNG image data, 1024 x 392, 8-bit/color RGBA, non-interlaced
The font and CSS rules above apply here too, since both tools share one rendering engine.
Use wkhtmltopdf from Python with pdfkit
Your application most likely reaches wkhtmltopdf through a wrapper. For Python that is pdfkit, which maps a dictionary onto the CLI flags. Install it in a virtual environment, since Ubuntu and Debian block system-wide pip installs:
sudo apt install -y python3-venv
python3 -m venv ~/pdfkit-env
~/pdfkit-env/bin/pip install pdfkit
pdfkit is only a wrapper. On a machine without the binary, the first call fails with this message, which is the one people paste into search when the apt install failed earlier:
OSError: No wkhtmltopdf executable found: "b''"
If this file exists please check that this process can read it or you can pass path to it manually in method call, check README. Otherwise please install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf
Installing the patched .deb fixes it, because pdfkit looks the binary up on PATH. When the app runs with a PATH that skips /usr/local/bin, pass configuration=pdfkit.configuration(wkhtmltopdf="/usr/local/bin/wkhtmltopdf") to the call. Now create the render script in the invoices directory:
vim ~/invoices/render.py
Add the following. The None value turns on a flag that takes no argument:
import pdfkit
options = {
"page-size": "A4",
"margin-top": "20mm",
"margin-bottom": "20mm",
"footer-center": "Page [page] of [topage]",
"encoding": "UTF-8",
"title": "Invoice 2026-118",
"enable-local-file-access": None,
}
pdfkit.from_file("invoice.html", "invoice-python.pdf", options=options)
print("Wrote invoice-python.pdf")
Run it and inspect the result:
cd ~/invoices
~/pdfkit-env/bin/python render.py
pdfinfo invoice-python.pdf | grep -E "Title|Pages"
pdfkit found the binary in /usr/local/bin without extra configuration:
Wrote invoice-python.pdf
Title: Invoice 2026-118
Pages: 1
The script ran unchanged on Python 3.14 (Ubuntu 26.04 and 26.10), 3.13 (Debian 13), 3.12 (Ubuntu 24.04) and 3.11 (Debian 12). pdfkit.from_string() and pdfkit.from_url() take an HTML string or a URL instead of a file, which suits Jinja2, Django and Flask templates. pdfkit hasn’t shipped a release since November 2021 either, so you should plan the migration for both at once.
Plan the move off wkhtmltopdf
The binary works, but nothing about it will change again. The main repository and the packaging repository are both archived, and the maintainer’s status page is blunt: the WebKit engine hasn’t been updated since 2012, and untrusted HTML can lead to a full takeover of the server running it. CVE-2022-35583 is a CVSS 9.8 SSRF in 0.12.6, and no fix is coming. Run it only on HTML your own application generates.
We benchmarked the replacements on the same invoice, report and JavaScript dashboard, and the full wkhtmltopdf alternatives comparison has the numbers. The short version, with a tested setup guide for each:
| Your wkhtmltopdf job | Move to | Why |
|---|---|---|
| Invoices and reports from your own templates | WeasyPrint | Full CSS paged media: running headers, page counters, footnotes. No browser needed. |
| A PDF service several apps call | Gotenberg in Docker | HTTP API over Chromium and LibreOffice, blocks file:// reads by default |
| JavaScript-heavy pages and dashboards | Playwright or Puppeteer | Real Chromium, header and footer templates, waits for the page to finish |
| Shell scripts and cron jobs | Chrome headless –print-to-pdf | One command, and the headless shell build matched wkhtmltopdf’s 0.29 s per-run time in our tests |
| PHP applications | Dompdf | Pure PHP via Composer, no external binary |
Our verdict: install the patched build to keep an existing invoice job or ERP running on Ubuntu 26.04 and Debian 13, and don’t start anything new on it. Header and footer flags have direct equivalents in every engine above, so most of the migration is moving --footer-center into an @page rule or a footer template. If Odoo or another platform calls wkhtmltopdf for you, keep this build until the platform ships its own replacement, and keep untrusted HTML away from it. On Rocky Linux or RHEL, follow our wkhtmltopdf install guide for RHEL-based systems instead.
Thanks for a nice explanation. it helped me a lot
was facing an issue while installing the lib.
The following packages have unmet dependencies:
wkhtmltox : Depends: libpng12-0 but it is not installed
Depends: libssl1.0.0 but it is not installed
Depends: xfonts-75dpi but it is not installed
Depends: xfonts-base but it is not installed
but fixed it by running
apt –fix-broken install
When I run that I get E: Invalid operation –fix-broken
just replace ‘–’ to ‘–‘
Thanks, was looking for this everywhere!
really help me, thanks a lot
THANKS
Gracias por la ayuda, lo solucione en Odoo 13 con servidor Debian, el eror era, que al imprimir no mostraba el encabezado ni el pie de pagina, ademas de no ostrar el logo.
Gracias
wkhtmltopdf can be installed with apt in ubuntu 20.04