Skip to content

Instantly share code, notes, and snippets.

@rafaelqm
Last active August 5, 2019 14:59
Show Gist options
  • Save rafaelqm/6bbcbd27c3b0d6456da89b526192b045 to your computer and use it in GitHub Desktop.
Save rafaelqm/6bbcbd27c3b0d6456da89b526192b045 to your computer and use it in GitHub Desktop.
How to install WKHTMLtoPDF on Linux Ubuntu

Installing WKHTMLtoPDF 0.12.4 (fixed DPI error)

cd ~
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
cd wkhtmltox/bin/
sudo mv wkhtmltopdf  /usr/bin/wkhtmltopdf
sudo mv wkhtmltoimage  /usr/bin/wkhtmltoimage
sudo ln -s /usr/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf

Instalar pacotes auxiliares

sudo apt-get install libfontconfig1 libxrender1

EDIT . SSL ERROR ON 16.04.4 LTS

sudo apt remove libssl-dev
sudo apt autoremove
sudo apt-get update
sudo apt-get install libssl-dev=1.0.2g-1ubuntu4.10
# In case not found 4.10 use 4.15
sudo apt-get install libssl-dev=1.0.2g-1ubuntu4.15

# Return back the PHP version which you are using
sudo apt-get install php7.1-dev

sudo apt-cache policy libssl-dev

# Test this version
wkhtmltopdf --lowquality --dpi '52' --margin-bottom '10mm' --margin-left '0' --margin-right '0' --margin-top '10mm' --orientation 'landscape' --no-outline --viewport-size '1280x1024' http://www.google.com google.pdf

# If is everything ok hold this version
sudo apt-mark hold libssl-dev

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