How to correctly install wkhtmltopdf on debian 64 bit?
Asked Answered
M

10

29

I am trying to install wkhtmltopdf, but when I do:

sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb

I get :

Preparing to unpack wkhtmltox-0.12.1_linux-trusty-amd64.deb ...
Unpacking wkhtmltox (0.12.1) over (0.12.1) ...
dpkg: dependency problems prevent configuration of wkhtmltox:
  wkhtmltox depends on libjpeg-turbo8; however:
  Package libjpeg-turbo8 is not installed.

dpkg: error processing package wkhtmltox (--install):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.7.0.2-5) ...
Errors were encountered while processing:
 wkhtmltox

So I tried:

apt-get update
apt-get install libjpeg-turbo8

Then I get

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libjpeg-turbo8 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'libjpeg-turbo8' has no installation candidate

I'm using a 64 bit debian. I browsed the web to find a solution but infortunately didn't find any answers. How can I get the libjpeg-turbo8?

EDIT:

So I tried apt-get install wkhtmltopdf despite the fact it wasn't recommended.

The probleme with apt-get install wkhtmltopdf is that the version isn't always the good one and we should use 0.12.1

But:

root@dev01:/opt/odoo/modules_scndf# apt-cache policy wkhtmltopdf 
wkhtmltopdf:
  Installed: 0.12.1-2
  Candidate: 0.12.1-2
  Version table:
 *** 0.12.1-2 0
         500 http://ftp.debian.org/debian/ jessie/main amd64 Packages
         100 /var/lib/dpkg/status

Version seems to be the good one even with apt-get install wkhtmltopdf but when I launch my print on odoo I still get

Unable to find Wkhtmltopdf on this system. The report will be shown in html.

Which means he didn't installed as it should have.

EDIT 2:

Now when I try to print the report, I get a popup:

Wkhtmltopdf failed (Error code : -6). Message : The switch 
--header-html, is not support using unpatched qt, and will be 
ignored.The switch --footer-html, is not support using unpatched qt,
and will be ignored.QXcbConnection: Could not connect to display 
Mcquoid answered 8/7, 2016 at 8:29 Comment(1)
J
28

Ubuntu and Debian packages are compatible most times but not in all cases, i think this is the trouble you're having you're trying to use the Ubuntu's .deb for Debian instead you should get the Debian specific file, (it works for both jessie and wheezy)

wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.1/wkhtmltox-0.12.1_linux-wheezy-amd64.deb
sudo dpkg -i  wkhtmltox-0.12.1_linux-wheezy-amd64.deb

Then in the /etc/init.d/openerp-server or /etc/init.d/odoo-server script(s), depending on your which one you have

add /usr/local/bin to the front of path environment variable for example,

PATH=/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin, 

This tells odoo where to look for system binaries it requires or optionally you can copy the files to /usr/bin, if you don't want to mess with those files

sudo cp /usr/local/bin/wkhtmlto* /usr/bin/

Download page for wkhtmltopdf: https://wkhtmltopdf.org/downloads.html

Johnny answered 8/7, 2016 at 22:14 Comment(6)
I get this error while trying to do the sudo dpkg -i wkhtmltox-0.12.1_linux-wheezy-amd64.deb dpkg: error processing package wkhtmltox (--install): dependency problems - leaving unconfigured Processing triggers for man-db (2.7.0.2-5) ... Errors were encountered while processing: wkhtmltoxMcquoid
run sudo apt-get dist-upgrade, if the dependency problem is not resolved run sudo apt-get dist-upgrade -fJohnny
gna.org seems to be down - see here: en.wikipedia.org/wiki/Gna! which says: The service was shut down in 2017. Any suggestions on alternative download sources?Tibbetts
Yes there's an alternative source...from github directly, Example github.com/wkhtmltopdf/wkhtmltopdf/releases/0.12.1 I've updated the url in the answerJohnny
Here came Odoo 11, still using the version 0.12.1 but not running on debian Jessie or Wheezy anymore. So here, some addition to install this version of wkhtmltopdf on Stretch : You need to download ( find repo on google and wget ) and install ( using dpkg -i ) : libssl1.0.0_1.0.1t-1+deb8u7_amd64.deb libpng12-0_1.2.49-1+deb7u2_amd64.deb libjpeg8_8d-1+deb7u1_amd64.deb Then you can use the answer.Mcquoid
In my case I needed to download libjpeg8 package from packages.debian.org/es/wheezy/amd64/libjpeg8/download before installing wkhtmltox-0.12.1_linux-wheezy-amd64.deb with dpkg. After that it worked perfectly, thanks a lot!Patriapatriarch
F
16

That's works for me in Debian Stretch:

$ sudo apt-get -q update
$ sudo apt-get -qy install --no-install-recommends wget
$ wget -nv -O /tmp/wkhtmltox.deb https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb
$ sudo apt-get -qy install /tmp/wkhtmltox.deb
Frescobaldi answered 24/3, 2019 at 13:17 Comment(1)
thank you, it worked.Piapiacenza
L
15

I'm running Debian Stretch 9.2 64bit and I succeeded with the following:

    sudo apt update
    sudo apt install xfonts-75dpi xfonts-base gvfs colord glew-utils libvisual-0.4-plugins gstreamer1.0-tools opus-tools qt5-image-formats-plugins qtwayland5 qt5-qmltooling-plugins librsvg2-bin lm-sensors 
    sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb
    sudo dpkg -i wkhtmltox_0.12.5-1.stretch_amd64.deb
    sudo cp /usr/local/bin/wkhtmltopdf /usr/bin/
    sudo cp /usr/local/bin/wkhtmltoimage /usr/bin/

Then check the installation with:

    wkhtmltopdf -V

Which should return:

    wkhtmltopdf 0.12.5 (with patched qt)
Letishaletitia answered 20/2, 2020 at 11:56 Comment(2)
worked for me flawlessly on docker running python:3.7-slim-buster. thanks!Stephi
I have used this method with wkhtmltopdf 0.12.6 in Ubuntu 20.04 and it works for meMatronna
P
6

I was trying to use wkhtmltopdf with an existing debian based docker image. But I faced

Package libjpeg-turbo8 is not installed

Finally I fixed this by installating libjpeg-turbo8 using dpkg. Below are the docker commands:

ARG  jpeg=libjpeg-dev
ARG  ssl=libssl-dev
ENV  CFLAGS=-w CXXFLAGS=-w

RUN apt-get update && apt-get install -y -q --no-install-recommends \
    build-essential \
    libfontconfig1-dev \
    libfreetype6-dev \
    $jpeg \
    libpng-dev \
    $ssl \
    libx11-dev \
    libxext-dev \
    libxrender-dev \
    python \
    zlib1g-dev \
    xfonts-75dpi \
    xfonts-base \
    && rm -rf /var/lib/apt/lists/*
RUN wget http://archive.ubuntu.com/ubuntu/pool/main/libj/libjpeg-turbo/libjpeg-turbo8_2.0.6-0ubuntu2_amd64.deb
RUN dpkg -i libjpeg-turbo8_2.0.6-0ubuntu2_amd64.deb
RUN wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
RUN dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb
RUN apt --fix-broken install
Poulos answered 11/6, 2021 at 19:31 Comment(0)
K
2

Try with

sudo apt-get install -y wkhtmltopdf
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
sudo cp /usr/local/bin/wkhtmlto* /usr/bin/
Kiki answered 8/7, 2016 at 17:46 Comment(1)
This error occurs on "sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb dpkg: dependency problems prevent configuration of wkhtmltox: wkhtmltox depends on libjpeg-turbo8; however: Package libjpeg-turbo8 is not installed. dpkg: error processing package wkhtmltox (--install): dependency problems - leaving unconfigured Processing triggers for man-db (2.7.0.2-5) ... Errors were encountered while processing: wkhtmltoxMcquoid
S
1

This issue is due to broken wkhtmltopdf package.

You can try using commands below to install them -

First remove the broken wkhtmltopdf from your system. using -

sudo apt-get purge wkhtmltopdf

Then try using the commands below -

cd /tmp/

then Download the recommended version of wkhtmltopdf for Odoo server, currently 0.12.1: -

sudo wget http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb

then install the package using dpkg :-

sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb

To function properly we’ll need to copy the binaries to an adequate location:

sudo cp /usr/local/bin/wkhtmltopdf /usr/bin
sudo cp /usr/local/bin/wkhtmltoimage /usr/bin
Stoltzfus answered 20/2, 2017 at 14:25 Comment(1)
gna.org seems to be down - see here: en.wikipedia.org/wiki/Gna! which says: The service was shut down in 2017. Any suggestions on alternative download sources?Tibbetts
E
1

On Debian 12, I did:

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb
sudo apt install ./wkhtmltox_0.12.6.1-3.bookworm_amd64.deb
Erlindaerline answered 11/2, 2024 at 12:46 Comment(0)
P
0
wget http://nightly.odoo.com/extra/wkhtmltox-0.12.1.2_linux-jessie-amd64.deb
dpkg -i wkhtmltox-0.12.1.2_linux-jessie-amd64.deb
/etc/init.d/odoo restart
Personable answered 20/2, 2017 at 1:11 Comment(1)
When giving an answer it is preferable to give some explanation as to WHY your answer is the one.Constitutional
G
0

The download path got changed to the following ! Please have a try with the below link.

https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb

and then do install it by following command

sudo dpkg -i wkhtmltox-0.12.2.1_linux-trusty-amd64.deb


Second Option

sudo 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

Copy files to /usr/bin/ and Restart all running Odoo services

sudo cp ./wkhtmltox/bin/wkhtmltoimage /usr/bin/

sudo cp ./wkhtmltox/bin/wkhtmltopdf /usr/bin/

Gerlachovka answered 16/7, 2017 at 14:17 Comment(0)
G
0

I'm using Devuan ascii (which is Debian stretch based) and it's enough to

sudo apt install wkhtmltopdf

During install it pulled in some Qt5 packages as well. There's no need to copy around the executable from /usr/local/bin/ to /usr/bin/ because it's already there.

Gradeigh answered 26/6, 2018 at 20:8 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.