Skip to content

Instantly share code, notes, and snippets.

@roydejong
Last active June 24, 2025 12:36
Show Gist options
  • Save roydejong/7f36c1ded1dda627eeee9a0b332e9eff to your computer and use it in GitHub Desktop.
Save roydejong/7f36c1ded1dda627eeee9a0b332e9eff to your computer and use it in GitHub Desktop.
Set up wkhtmltopdf on Ubuntu server

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}

Install wkhtmltopdf

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
@elmaroufa
Copy link

Thanks , the tutorial sovle my problem

@ThomasHardness
Copy link

Thanks, i used the google chrome method and resolve all my problems with wkhtmltopdf not loading CSS correctly.

@lkr93
Copy link

lkr93 commented Jun 11, 2025

Thanks, it's okay for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment