Page 1 of 1

PDF Generation

PostPosted: September 21st, 2012, 6:22 am
by chrisblessing
When we attempt to view as PDF we get this message: "Sorry, failed to generate PDF document. Please notify your IT administrator"

This doesn't appear to be browser issue, but a server issue. Any ideas? Ubuntu 12.04 Server edition.

Thank you.

Chris Blessing

Re: PDF Generation

PostPosted: September 21st, 2012, 7:32 am
by David Tong
First, try updating the binaries (update both i386 and amd64 if you are not sure which) of Wkhtmltopdf in install/binary/pdf/linux from Make sure the file execution permission is still on after the update.

If this doesn't help then try updating your Linux packages (these were for CentOS but you should have similar packages):

yum install libXext.i386
yum install libXfont.i386
yum update freetype.i386
yum install a2ps.i386
yum install urw-fonts libXext openssl-devel
yum install libX11-devel.i386
yum install libXfont-devel.i386
yum install libXt
yum install bitmap-fonts bitmap-fonts-cjk bitstream-vera-fonts
yum install dejavu-lgc-fonts fontconfig-devel fonts-ISO8859-2 fonts-ISO8859-2-100dpi fonts-ISO8859-2-75dpi fonts-KOI8-R fonts-KOI8-R-100dpi fonts-KOI8-R-75dpi
yum install fonts-arabic fonts-bengali fonts-chinese fonts-gujarati fonts-hebrew fonts-hindi fonts-japanese fonts-kannada fonts-korean fonts-malayalam fonts-oriya fonts-punjabi fonts-sinhala fonts-tamil fonts-telugu
yum install libXfontcache
yum install tetex-fonts
yum install xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-fonts-ISO8859-1-100dpi xorg-x11-fonts-ISO8859-1-75dpi xorg-x11-fonts-ISO8859-14-100dpi xorg-x11-fonts-ISO8859-14-75dpi xorg-x11-fonts-ISO8859-15-100dpi xorg-x11-fonts-ISO8859-15-75dpi xorg-x11-fonts-ISO8859-2-100dpi xorg-x11-fonts-ISO8859-2-75dpi xorg-x11-fonts-ISO8859-9-100dpi xorg-x11-fonts-ISO8859-9-75dpi xorg-x11-fonts-Type1 xorg-x11-fonts-base xorg-x11-fonts-cyrillic xorg-x11-fonts-ethiopic xorg-x11-fonts-misc xorg-x11-fonts-syriac xorg-x11-fonts-truetype
yum install libXrender

yum install gettext-devel expat-devel curl-devel zlib-devel openssl-devel

yum groupinstall "X Window System"
yum groupinstall Graphics
yum groupinstall "Development Libraries"
yum install gd-devel.i386

Installing these packages ensures Wkhtmltopdf has all the libraries and fonts it needs.

If all fails then you should consider our PDF web service. Any TODCM site can utilize our web service to generate all PDF documents; your server needs internet access to utilize this service. Please let me know if you need this service.


Re: PDF Generation

PostPosted: September 24th, 2012, 12:14 am
by chrisblessing
Hi David, and thanks for the reply. Here's what I've done so far:

I updated the wkhtmltopdf binary (0.9.9-amd64). I copied the executable wkhtmltopdf from /usr/bin to /var/www/curriculum/install/binary/pdf/linux. I changed owner to www:data (my Apache user), and changed permissions of the /linux directory to writable. I was able to run "wkhtmltopdf test.pdf" successfully generate the test.pdf to the /linux directory. So wkhtmltopdf is functional on the server. I was also successful leaving owner as root, allowing me to run without sudo from the /linux directory.

However, I'm still getting the same error from our TODCM page. Seems like I'm missing some critical step.


Re: PDF Generation

PostPosted: September 24th, 2012, 5:28 am
by chrisblessing
Ok, since I already have Xserve running on the Ubuntu Server, I removed the static binary and installed the source wkhtmltopdf What a step backwards. Whereas the static binary could at least generate a pdf from a shell, if not from the web page, the source install fails with "wkhtmltopdf: cannot connect to X server". And, just to make sure, I installed xvfb (as one would when there is no Xserver running). That gets rid of the Xserver connection error, and the pdf is generated, but still no dice from the page.

I'm pretty stuck here. I appreciate the offer of connecting to your server, but until we get a working demo in-house I'm not going to get any support from administration. Our goal was to get our server running, then contract with your company to make other modifications.



Re: PDF Generation

PostPosted: September 25th, 2012, 6:07 am
by David Tong
Hi Chris, wkhtmltopdf should work in TODCM if you can get it to run on command line, I am very surprised it is not working in your particular environment. I suspect it might have something to do with the shell environment variables or the security-enhanced Linux feature (SELinux). I will send you a email about our PDF web service.

The wkhtmltopdf source compile is huge and very complex. I had done 3 years of system level UNIX software integration for different UNIX platforms that required in depth knowledge of the CC/GCC compiler but I had trouble getting wkhtmltopdf to compile; it was more like I quit after spending half a day and I was still getting compiler errors. I am sure I could get it to compile if I had spent an extra day but it was an experiment and not a requirement for me.

Re: PDF Generation

PostPosted: September 25th, 2012, 6:27 am
by David Tong
Chris, is your site accessible from the internet?

Re: PDF Generation

PostPosted: September 26th, 2012, 12:33 am
by chrisblessing
Hi David,

Anyhow: Supply me an email and I'll send admin credentials if you'd like.

I should also mention that we had an earlier version of TODCM installed on the same machine and the PDF generation worked. Sadly, I can't test this because I already scrubbed it.



Re: PDF Generation

PostPosted: September 27th, 2012, 2:31 am
by chrisblessing
Ok, I ended up giving up on the source wkhtmltopdf (, while the Google code binary (0.9.9) simply didn't function from the our TODCM site. Both iterations worked from a shell. As a final resort I tried the 0.11.0 RC1 stable binary, and it worked.

It's worth noting here that I have Xserver installed on my Ubuntu server, so I should have been able to use 0.9.6 as well, but the results were the same as above.