PDF Generation

TODCM administration related topics. Topics for administrating & maintaining a TODCM site, data imports etc.

PDF Generation

Postby chrisblessing » September 21st, 2012, 6:22 am

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
chrisblessing
 
Posts: 9
Joined: March 20th, 2012, 12:59 am

Re: PDF Generation

Postby David Tong » September 21st, 2012, 7:32 am

First, try updating the binaries (update both i386 and amd64 if you are not sure which) of Wkhtmltopdf in install/binary/pdf/linux from http://code.google.com/p/wkhtmltopdf/. 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.

David
David Tong - TODCM Founder.
http://todcm.org - TODCM open source project site.
http://www.tillersoft.net - Operator and maintainer of the TODCM project.
David Tong
TODCM Team
 
Posts: 94
Joined: June 4th, 2011, 4:17 pm

Re: PDF Generation

Postby chrisblessing » September 24th, 2012, 12:14 am

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 http://www.google.com 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.

Thanks.
Last edited by chrisblessing on September 24th, 2012, 5:59 am, edited 1 time in total.
chrisblessing
 
Posts: 9
Joined: March 20th, 2012, 12:59 am

Re: PDF Generation

Postby chrisblessing » September 24th, 2012, 5:28 am

Ok, since I already have Xserve running on the Ubuntu Server, I removed the static binary and installed the source wkhtmltopdf 0.9.9.3. 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.

Thanks,

Chris
chrisblessing
 
Posts: 9
Joined: March 20th, 2012, 12:59 am

Re: PDF Generation

Postby David Tong » September 25th, 2012, 6:07 am

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.
David Tong - TODCM Founder.
http://todcm.org - TODCM open source project site.
http://www.tillersoft.net - Operator and maintainer of the TODCM project.
David Tong
TODCM Team
 
Posts: 94
Joined: June 4th, 2011, 4:17 pm

Re: PDF Generation

Postby David Tong » September 25th, 2012, 6:27 am

Chris, is your site accessible from the internet?
David Tong - TODCM Founder.
http://todcm.org - TODCM open source project site.
http://www.tillersoft.net - Operator and maintainer of the TODCM project.
David Tong
TODCM Team
 
Posts: 94
Joined: June 4th, 2011, 4:17 pm

Re: PDF Generation

Postby chrisblessing » September 26th, 2012, 12:33 am

Hi David,

Anyhow: http://curriculum.mkis.edu.my. 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.

Thanks,

Chris
chrisblessing
 
Posts: 9
Joined: March 20th, 2012, 12:59 am

Re: PDF Generation

Postby chrisblessing » September 27th, 2012, 2:31 am

Ok, I ended up giving up on the source wkhtmltopdf (0.9.9.3), 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.
chrisblessing
 
Posts: 9
Joined: March 20th, 2012, 12:59 am


Return to Application Admin

Who is online

Users browsing this forum: No registered users and 0 guests

cron