Skip to content

Instantly share code, notes, and snippets.

@slickplaid
Last active September 11, 2022 12:51
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save slickplaid/5557321 to your computer and use it in GitHub Desktop.
Save slickplaid/5557321 to your computer and use it in GitHub Desktop.
How to install version 0.12.0 (latest as of 5/10/13) of wkhtmltopdf on Ubuntu 12.04 LTS headless server.
How to install version 0.12.0 (latest as of 5/10/13) of
wkhtmltopdf on Ubuntu 12.04 LTS headless server.
You'll need to have the user in the sudoers group or
modify the script to properly execute the root commands
needed.
There might be a little bit of overkill on the font
inclusions, but I ran into a lot of issues with specific
fonts missing and this seems to fix it.
Reply to this gist if you have questions. If you know
how to build it as a static binary reliably, let me
know. Due to the build time and the number of attempts
I've made at it unsuccessfully, I haven't been able to
get a reproducible 0.12.0 build working yet. The build
time should take about 1/2 to a full hour, so be
prepared for it. A static build can take upwards of 3+
hours.
sudo apt-get update && sudo apt-get upgrade -y;
sudo apt-get build-dep -y libqt4-gui libqt4-network libqt4-webkit;
sudo apt-get install -y openssl build-essential xorg git git-core libssl-dev libxrender-dev t1-xfree86-nonfree xfonts-scalable ttf-ubuntu-font-family ttf-mscorefonts-installer poppler-utils libqt4-dev qt4-dev-tools;
cd ~;
git clone git://gitorious.org/~antialize/qt/antializes-qt.git wkhtmltopdf-qt;
git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf;
cd wkhtmltopdf;
qmake-qt4;
cd ../wkhtmltopdf-qt;
git checkout 4.8.4;
QTDIR=. ./bin/syncqt;
./configure -nomake tools,examples,demos,docs,translations -opensource -prefix ../wkqt;
make -j3 && make install;
cd ../wkhtmltopdf;
../wkqt/bin/qmake;
make -j3 && sudo make install;
@asmt3
Copy link

asmt3 commented May 2, 2014

the make fails for me on 12.04. I get:

/usr/bin/ld: ../../build/qrc_wkhtmltopdf.o: relocation R_X86_64_32 against .rodata' can not be used when making a shared object; recompile with -fPIC ../../build/qrc_wkhtmltopdf.o: could not read symbols: Bad value collect2: ld returned 1 exit status make[1]: *** [../../bin/libwkhtmltox.so.0.12.1] Error 1 make[1]: Leaving directory/home/ubuntu/wkhtmltopdf/src/lib'
make: *** [sub-src-lib-make_default-ordered] Error 2

Any idea what I'm doing wrong? I'm not sure where I'm supposed to put this flag "-fPIC"...

@jmcclelland
Copy link

I get the same error.

@lisandi
Copy link

lisandi commented Aug 14, 2015

http://wkhtmltopdf.org/downloads.html
Why don't you simply install the new .deb package?

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