Important
wkhtmltopdf has been abandoned and is not being updated anymore. Avoid using it for new projects.
Tip
Consider using Chrome in headless mode and just DIY-ing it instead of wkhtmltopdf:
google-chrome --headless --disable-gpu --run-all-compositor-stages-before-draw --print-to-pdf={$tempPath} --no-pdf-header-footer {$renderUrl}
Find the download URL for the latest binary from the official Downloads page.
Download the binary, and then install the package and its dependencies. For example, the latest version that works with Ubuntu 22.04 / 24.04:
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb
This will give you an installation error - that's expected. To complete the install, run:
sudo apt install -f