WKHTMLTOPDF Installation error on Ubuntu
Asked Answered
M

3

22

We require features like header, footer, table of contents and cover page of pdf, which we want to generate from html/css. We tried WKHTML on windows and it worked like a charm, when moving to our server, we installed WKHTML on our ubuntu server, installation process was successful but it had only limited features, it was able to generate pdf from HTML but all features mentioned (i-e header, footer , table of content and cover page) wasn't working. Following is the error which it was producing.

"The switch -t, is not support using unpatched qt, and will be ignored. Error: This version of wkhtmltopdf is build against an unpatched version of QT, and does not support more then one input document."

We followed many tutorials and installed it with QT patched, one of the tutorial is here (https://code.google.com/p/wkhtmltopdf/wiki/compilation) . We are not sure if we skipped something or did something wrong, it is installed and few of features has started to work but not all. we are able to generate header and footer but cover page and table of content are still not working. which we really need.

Margetts answered 12/9, 2013 at 7:54 Comment(0)
M
36

In case anybody is having the similar issue, I got it fixed by following this article.

All features are working perfectly now.


Article contents:

The wkhtmltopdf shell utility is used to generate PDF documents from HTML using WebKit. I’ve tried a few ruby gem wrappers that make use of wkhtmltopdf, but I’ve found that I like using the wicked_pdf gem the best. Regardless of what wrapper you use to call wkhtmltopdf, here are the steps to get wkhtmltopdf installed on Ubuntu (minor adjustments will be needed for non Debian based distributions).

  1. Remove wkhtmltopdf installed using apt-get previously (if previously installed).

     sudo apt-get remove --purge wkhtmltopdf
    
  2. Install dependencies.

     sudo apt-get install openssl build-essential xorg libssl-dev
    
  3. Download the static binary as per the architecture (i386/amd64). Extract it, change the owner and then copy it to /usr/local/bin.

     wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-i386.tar.bz2
     tar xvjf wkhtmltopdf-0.9.9-static-i386.tar.bz2
     sudo chown root:root wkhtmltopdf-i386
     sudo cp wkhtmltopdf-i386 /usr/local/bin/wkhtmltopdf
    

For amd64 bit

wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvJf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz 
sudo cp wkhtmltox/bin/wkhtmlto* /usr/bin/
Margetts answered 19/9, 2013 at 21:56 Comment(4)
web.archive.org/web/20130608010833/http://wingdspur.com/2012/12/…Kistner
Thank you very much! Just want to emphasize the importance of making sure you are using the version that matches your architecture... I was on Ubuntu amd 64 but installed the i386 version, it doesnt give any errors but doesnt do anything... very deceiving. Hope this helps someone! :-)Hit
Using this answer I solved the problem by removing the old version and downloading the latest stable version from the web site: wkhtmltopdf.org/downloads.htmWraith
Link from artifex should end in html - then it still works.Blab
V
10

For those trying this now, the download.gna.org url no longer works, but the previous answers are still valid: I just had to install using the new location like so:

wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvJf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz 
sudo cp wkhtmltox/bin/wkhtmlto* /usr/bin/

Just did this on an Ubuntu 16.04.2 machine. Thanks for the original answer, Rasikh!

Veliger answered 25/7, 2017 at 23:48 Comment(0)
C
8

As I cant comment, here is the new Point 3 for the correct answer for Ubuntu 64 Bit. Thanks for the help @Rasikh Mashhadi

wget http://download.gna.org/wkhtmltopdf/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvJf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
sudo cp wkhtmltox/bin/wkhtmlto* /usr/bin/
Cryptonym answered 19/1, 2017 at 12:52 Comment(1)
After some days looking for a solution I solve it with this. Thanks !!!Sannyasi

© 2022 - 2024 — McMap. All rights reserved.