My favorites | Sign in
Project Home Downloads Wiki Issues
Search
for
static  
Updated Jul 20, 2011 by antial...@gmail.com

This page presents some common trouble shooting for the static binary, if you have any questions or answers, please post them in the comments.

  • I'm using the static binary but the fonts are wrong, squares or all black

    This is most likely because you do not have X11 installed or not the right X11 fonts

  • wkhtmltopdf dies silently on my 64 bit machine

    You're probably missing the 32bit libraries. Try:

    sudo aptitude install ia32-libs
  • wkhtmltopdf does not work on https sites

    Try installing openssl, if this does not work your best option it to compile wkhtmltopdf your self (see compilation)

Comment by googelyb...@gmail.com, Oct 8, 2009

Here's an addition to wkhtmltopdf dies silently on my 64 bit machine I ran wkhtmltopdf 0.8.3 on a Ubuntu 9.04 x64 server (with the xorg meta-package installed) and installed the ia32-libs as described above. But still no output was generated when wkhtmltopdf was called from my program. However when I ran it directly on the command line it worked fine. I fixed this by creating the following shell script:

#!/bin/bash
/usr/local/bin/wkhtmltopdf.bin $* > /dev/null 2>&1

(wkhtmltopdf.bin is the actual wkhtmltopdf static binary)

So if you face the same issue give it a shot, maybe you're lucky and it works for you as it did for me ;-)

Comment by googelyb...@gmail.com, Nov 13, 2009

v0.9.0 (beta2) works fine for me with the wrapper script above. However the weird timezone issue with US timezones is still present. Workaround: simply add an 'export TZ=Europe/Zurich' in the wrapper script before calling the binary.

Comment by t...@behrendsen.com, Mar 27, 2010

I was having the font "wrong, squares or all black" problem on Fedora 12. After much thrashing around trying to figure out why one server worked and the other didn't, I figured out that installing the package a2ps loaded the right fonts. On my Fedora 12, install a2ps forced the installation of the following packages:

GConf2.x86_64 0:2.28.0-4.fc12.1 ImageMagick?.x86_64 0:6.5.4.7-3.fc12 ImageMagick?-perl.x86_64 0:6.5.4.7-3.fc12 ghostscript.x86_64 0:8.71-4.fc12 ghostscript-fonts.noarch 0:5.50-23.fc12 groff-perl.x86_64 0:1.18.1.4-18.fc12 html2ps.noarch 0:1.0-0.3.b5.fc12 kpathsea.x86_64 0:2007-47.fc12 libcroco.x86_64 0:0.6.2-3.fc12 libgsf.x86_64 0:1.14.15-4.fc12 libpaper.x86_64 0:1.1.23-6.fc12 librsvg2.x86_64 0:2.26.0-3.fc12 libwmf-lite.x86_64 0:0.2.8.4-21.fc12 netpbm.x86_64 0:10.47.07-1.fc12 netpbm-progs.x86_64 0:10.47.07-1.fc12 openjpeg-libs.x86_64 0:1.3-6.fc12 perl-Compress-Raw-Zlib.x86_64 0:2.023-87.fc12 perl-Compress-Zlib.x86_64 0:2.008-87.fc12 perl-HTML-Parser.x86_64 0:3.64-1.fc12 perl-HTML-Tagset.noarch 0:3.20-3.fc12 perl-IO-Compress-Base.x86_64 0:2.015-87.fc12 perl-IO-Compress-Zlib.x86_64 0:2.015-87.fc12 perl-URI.noarch 0:1.40-1.fc12 perl-libwww-perl.noarch 0:5.834-1.fc12 poppler.x86_64 0:0.12.4-2.fc12 poppler-data.noarch 0:0.4.0-1.fc12 psutils.x86_64 0:1.17-33.fc12 psutils-perl.noarch 0:1.17-33.fc12 sgml-common.noarch 0:0.6.3-31.fc12 tex-preview.noarch 0:11.86-1.fc12 texinfo.x86_64 0:4.13a-9.fc12 texinfo-tex.x86_64 0:4.13a-9.fc12 texlive.x86_64 0:2007-47.fc12 texlive-dvips.x86_64 0:2007-47.fc12 texlive-latex.x86_64 0:2007-47.fc12 texlive-texmf.noarch 0:2007-34.fc12 texlive-texmf-dvips.noarch 0:2007-34.fc12 texlive-texmf-errata.noarch 0:2007-7.fc12 texlive-texmf-errata-dvips.noarch 0:2007-7.fc12 texlive-texmf-errata-fonts.noarch 0:2007-7.fc12 texlive-texmf-errata-latex.noarch 0:2007-7.fc12 texlive-texmf-fonts.noarch 0:2007-34.fc12 texlive-texmf-latex.noarch 0:2007-34.fc12 texlive-utils.x86_64 0:2007-47.fc12 urw-fonts.noarch 0:2.4-9.fc12

I also installed Firefox for good measure, figuring that probably has some web-useful fonts, but it didn't make a difference in my particular test. a2ps was the key install for the fonts.

Comment by polar...@gmail.com, May 24, 2010

I find that for FreeBSD 7 on amd64, it's simpler to use the Linux 32-bit ABI compatibility layer to use the 32-bit static wkhtmltopdf than attempting to compile and wkhtmlpdf on FreeBSD 7/amd64.

Install

  • linux-expat-1.95.8_2 Linux/i386 binary port of Expat XML-parsing library
  • linux-fontconfig-2.2.3_9 Linux/i386 binary of Fontconfig
  • linux-xorg-libs-6.8.2_7 Xorg libraries, linux binaries
  • linux_base-fc-4_15 Base set of packages needed in Linux mode (for i386/amd64)

then download and run the 32-bit linux static version of wkhtmltopdf

Comment by polar...@gmail.com, May 24, 2010

Regarding FreeBSD 7/amd64, compiling successfully under FreeBSD without segmentation faults at run time probably requires targetting the FreeBSD 32-bit ABI somehow, but not completely obvious to me how to do that.

Comment by rngant...@gmail.com, Aug 25, 2010

What would be the minimal amount of x11 packages needed to run this? Is it necessary to install xorg, or would x11-common and a few other libraries be enough? (I'm trying to use this on a debian webserver which has no need for all the extra x11 stuff)

Any ideas?

Comment by dk.k...@gmail.com, Sep 13, 2010

I am running Ubuntu Server. There is a gap in my knowledge (and as far as I can see online any documentation) as to how to get the static binary installed. Can anyone list out steps.

My attempts at downloading and trying to execute the file have failed and am sure I am missing something.

Comment by structur...@gmail.com, Sep 20, 2010

Ps, I wrote a bit on getting the static binary installed to Ubuntu Server here, which might clear up confusion on how to succeed at this for someone who might need a little more info:

http://blog.structuralartistry.com/2010/09/20/installing-wkhtmltopdf-on-ubuntu-server/

Comment by joost.ru...@gmail.com, Sep 23, 2010

I got it working great except it's not rendering the correct font-family...

"This is most likely because you do not have X11 installed or not the right X11 fonts"

Anyone can give me a hint as to how to install the right X11 fonts? Thanks a million?

Comment by alexpo...@gmail.com, Sep 27, 2010

Thrashed around for hours trying to get the fonts working ("black boxes" problem.) Yum installed pretty much everything with an "X" in it (I'm a PHP coder, not a sysadmin!) The key was urw-fonts.

#yum install urw-fonts

NB I had tried a2ps, but this package was not included (CentOs? 5.3)

Cheers

Your mileage will almost certainly vary :)

Comment by ukr.webm...@gmail.com, Oct 2, 2010

I fully understand the installation requirements for the static wkhtmltopdf. I have it running on a dedicated sever (where I was able to install the required x11 libs), for a Drupal site.

My problem is, I have several sites in a shared hosting environment, where I am not able to convince the hosting company to install the x11 libs. I saw (on Stack Overflow), where someone came up with a solution using a shell script wrapper and the lib files that they obtained for their distribution. I don't know if that would work or not because I cannot test it.

The shared hosting I have is cPanel on a CentOS 4 server.

Are there any future plans for the static wkhtmltopdf to be totally self-sufficient with the x11 libs, so that it can run in shared hosting environments? I am hoping so!

Is there any way to get the wkhtmltopdf to run on cPanel shared hosting? I can't even locate all of the .so files for the distribution to even test the shell wrapper. I just wonder if there is an alternate way to handle it.

Basically, most Drupal sites are left with using dompdf or TCPDF. But wkhtmltopdf creates a MUCH MORE IMPRESSIVE result in the PDF's it outputs. And I am astonished by the bookmarking that it does as well!

...I have sites that have cyrillic text and wkhtmltopdf handles it beautifully, without any hassle! TCPDF is such a PAIN and dompdf doesn't look that great.

If anyone can help me, please do!

Comment by namo...@gmail.com, Oct 28, 2010

when I run as root on FreeBSD I get the expected text, the font isn't quite right, but it's readable. When I run as another user, I only see black boxes. Anyone know why? I'm using the static binary with linux compat.

Comment by zabra...@gmail.com, Nov 5, 2010

Hi guys,

I'm desperately trying to get the statically linked version of "wkhtmltopdf-i386" (beta 5) works under PCBSD8.1 (so FreeBSD) using Linux compatibilty layer.

This is how it fails:

# file ./wkhtmltopdf-i386

./wkhtmltopdf-i386: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, stripped

# brandelf -t Linux wkhtmltopdf-i386

# ./wkhtmltopdf-i386

PROT_EXEC|PROT_WRITE failed.

# truss ./wkhtmltopdf-i386

linux_mmap(0xbfbfed28,0x1000,0xc01000,0x16b6bc6,0x0,0x6) ERR#22 'Invalid argument' 

write(2,"PROT_EXEC|PROT_WRITE failed.\n",29) ERR#9 'Bad file descriptor'

process exit, rval = 127

# kdump

 29785 ktrace   RET   ktrace 0

 29785 ktrace   CALL  execve(0xbfbfee1b,0xbfbfed04,0xbfbfed0c)

 29785 ktrace   NAMI  "./wkhtmltopdf-i386"

 29785 wkhtmltopdf-i386 RET   execve 0

 29785 wkhtmltopdf-i386 CALL  dup2(0xbfbfed3c)

 29785 wkhtmltopdf-i386 RET   dup2 -1 errno 22 Invalid argument

 29785 wkhtmltopdf-i386 CALL  write(0x2,0x16b6b4e,0x1d)

 29785 wkhtmltopdf-i386 GIO   fd 2 wrote 29 bytes
       "PROT_EXEC|PROT_WRITE failed. "

 29785 wkhtmltopdf-i386 RET   write 29/0x1d

 29785 wkhtmltopdf-i386 CALL  exit(0x7f)

Does someone knows a workaround?

N.B: moreover, when trying to build if from source, the "qmake-qt4" returns immediately without generating the "configure.sh" script.

Regards Z.

Comment by CollinMA...@gmail.com, Nov 8, 2010

Wow. This static binary worked much much better than I expected. Praise God. I am using CentOS 5.5, and these are the packages that I needed to install:

sudo yum install urw-fonts libXext openssl-devel

Comment by sola...@gmail.com, Nov 9, 2010

I use Ubuntu server 10.10.

The static binary work fine, but all chinese character show squares.

anyone can tell me what can I do for it?

Comment by exnordes...@gmail.com, Jan 4, 2011

@zabrane3:

I was getting this exact same 'PROT_EXEC|PROT_WRITE failed.' error on my 64 bit freeBSD 8.1 machine.

Turns out the problem was the upx compression of the binary. Try uncompressing it:

upx -d wkhtmltopdf-i386

Worked a treat for me.

Comment by mordonez...@gmail.com, Jan 30, 2011

with a minimal installation of Ubuntu Server. only its necesary install the package libx11-dev:

sudo apt-get install libx11-dev

Comment by yoz...@gmail.com, Apr 12, 2011

Would there be any way to feed multiple HTML documents (I have them as character arrays) via STDIN to produce a combined PDF via STDOUT?

I would like to do this from a Java servlet, where I have the static HTML files in my database.

I am using wkhtmltopdf-0.10.0_rc2-static-i386 and this works great from the command line, but I'm hoping I can somehow do this without actually writing the HTML files to disk, run wkhtmltopdf and then do file cleanup.

I know this may not be possible since STDIN would have no understanding of multiple inputs, but when I tried concatenating multiple HTML files for processing, it sort of did it, but I don't think it actually did them as separate HTMLs and so combined styles, etc. rather than using the styles defined in each of the separate <html> elements.

Any ideas on this? Thanks for this terrific tool as it seems to work really well and easily for us.

Comment by pantpradeep, May 4, 2011

I was getting different size of PDF in Windows and Linux for the same file. In Linux (Cent OS) the size is much higher. I have solved this by installing True Type Fonts on Cent OS .. see my blog entry below for steps:

http://pradeeppant.com/2010/07/19/installing-microsoft-truetype-fonts-ttf-on-centos-4-6/

Comment by eugeniop...@gmail.com, May 17, 2011

I simply love this post... Finally got it working... After hours searching and getting black squares instead of text I read the post on the packages needed on CentOS:

sudo yum install urw-fonts libXext openssl-devel

Worked like a charm! Thanks a lot!!!

Comment by dmitriy....@gmail.com, May 25, 2011

I am using libwkhtmltox-0.10.0_rc2.zip ("libwkhtmltox-0.10.0_rc2 Windows Static Library (i368)") c-bindings library from C# project. The library itself is amazing! However I have some problems with setting some object parameters for loading web page. It's not intuitively clear how to set "load.post", "load.cookies" and "load.customHeaders" object settings using the wkhtmltopdf_set_object_setting() function. I managed to set the post data using the following sequence of wkhtmltopdf_set_object_setting(ptr, name, value) calls:

name value
"load.post.append" null
"load.post.append" null
... ...
"load.post[0]name" "name1"
"load.post[0]value" "value1"
"load.post[1]name" "name2"
"load.post[1]value" "value2"
... ...

I cannot figure out though how to set extra cookies or custom headers :( The following doesn't work for me:

name value
"load.cookies.append" null
"load.cookies.append" null
... ...
"load.cookies[0]" "name1,value1"
"load.cookies[1]" "name2,value2"
... ...

I'd appreciate any ideas on how I can make it work.

Comment by basiliot...@gmail.com, Oct 12, 2011

I've compiled static version of wkhtmltopdf for FreeBSD 8.2 amd64 - http://wkhtml.ms1.ru/wkhtmltopdf-0.10.0.r2.tbz

Package includes /usr/local/etc/fonts as part of statically linked fontconfig, so it will conflict with installed fontconfig package.

Also, wkhtmltopdf requires ttf fonts, so you should install port x11-fonts/webfonts. However, that port depends on fontconfig, which is statically linked already. I've provided modified package, without dependencies: http://wkhtml.ms1.ru/webfonts-0.30_6.tbz

You can install these packages by running

pkg_add http://wkhtml.ms1.ru/wkhtmltopdf-0.10.0.r2.tbz
pkg_add http://wkhtml.ms1.ru/webfonts-0.30_6.tbz
Comment by iwantva...@gmail.com, Nov 14, 2011

Does it work with cygwin?

Comment by vahan4...@gmail.com, Mar 27, 2012

Hi I try install wkhtmltopdf on hostmonster and after placing that static binaries in /home/bin directory from shell it recognizes command, but I get Bus error after executing? I perform my test command like " wkhtmltopdf-i386 --help ". Can anyone help me to install it ?

Comment by shado...@gmail.com, Apr 10, 2012

FreeBSD now has wkhtmltopdf in the ports tree

cd /usr/ports/converters/wkhtmltopdf 
make clean 
sudo make install
Comment by nickruff...@gmail.com, May 10, 2012

I'm using wkhtmltoimage and it works reasonably well with @font inclusions, but for some fonts, such as UglyQua?, the rendering includes a bunch of extra noise in the image. When I change the font to anything else, it renders fine. The text DOES render using UglyQua?, just adds a bunch of noise. Did anyone else encounter this? BTW when rendering in browser it renders the HTML file fine without noise.


Sign in to add a comment
Powered by Google Project Hosting