Skip to content

Instantly share code, notes, and snippets.

@kai101
Last active August 24, 2023 09:10
Show Gist options
  • Save kai101/99d57462f2459245d28b4f5ea51aa7d0 to your computer and use it in GitHub Desktop.
Save kai101/99d57462f2459245d28b4f5ea51aa7d0 to your computer and use it in GitHub Desktop.
How to Install Wkhtmltopdf 12.4 with patched Qt?

How to Install Wkhtmltopdf 12.4 with patched Qt?

For earlier version whos suffering from versionlock syndrome. Please follow the instructions to rollback to older SSL interface. Do not alarm by the fallback ssl interface, they received security patches for vulnerability discovered.

Current version of apt-get wkhtmltopdf does not come with Qt patch. There are some issue going with both Qt patched and non-patched. Most common use case is compatible with the patched Qt.

wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz 
sudo mv wkhtmltox/bin/wkhtmlto* /usr/local/bin 
sudo apt-get install -y openssl libssl-dev libxrender-dev libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig

Fixing Wkhtmltopdf SSL error

ubuntu 17.10

sudo apt-get install libssl-dev=1.0.2g-1ubuntu13.3 openssl=1.0.2g-1ubuntu13.3

ubuntu 17.04

# end of life, forget it.

ubuntu 16.04

sudo apt-get install libssl1.0.0=1.0.2g-1ubuntu4.10 libssl-dev=1.0.2g-1ubuntu4.10 openssl=1.0.2g-1ubuntu4.10
@cherouvim
Copy link

I've found that there is no need to install all those dependencies (git-core, build-essential, ...). This did the job for me:
sudo apt-get install libfontconfig1 libxrender1 libxext6

@LaurentMarquet
Copy link

It solves the problem of https links but on next sudo apt update && sudo apt upgrade, libssl-dev and openssl are upgraded to the newest version which causes the problem to occur again... (Using Ubuntu 17.10)
Is there a way you know, to solve that?

@LaurentMarquet
Copy link

In fact downgrading SSL is the goal... So no way to fix it... I'll try to find another library...

@LaurentMarquet
Copy link

As I have found another solution, I share it there. I think that Wkhtmltopdf copies the css files inside the output pdf, so I have added the css content before html, wrapped in <style></style>, like this no problem with SSL or whatever.

@kai101
Copy link
Author

kai101 commented Apr 5, 2018

@Laurent3170
You can run the command again after the update.
sudo apt-get install libssl-dev=1.0.2g-1ubuntu13.3 openssl=1.0.2g-1ubuntu13.3
There is a way to fix the ssl version. I remember seeing them on fixing a mongoDb version, try some googling might help.

Element that can be inlined are great to bypass. Normally I would use file reader to inline them as well.

@festusngor
Copy link

See https://gist.github.com/srmds/2507aa3bcdb464085413c650fe42e31d for Installing wkhtmltopdf 0.12.4 on Ubuntu 16.04

@kai101
Copy link
Author

kai101 commented Sep 11, 2018

@Arkanius
Copy link

Worked well! Thanks!

@cymen
Copy link

cymen commented Apr 12, 2022

Is this still necessary with Ubuntu 20? I'm going to try to figure that out soon but figured I'd ask too (and update once I figure it out on my end).

@kai101
Copy link
Author

kai101 commented Apr 13, 2022

this might not be relevant for Ubuntu 20. But you can use it as a reference if you encounter same issues in Ubuntu 20.

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