Answered html (url) to pdf with wkthml2pdf on unix

webguy

Member
I have a question related to wkthml2pdf. This command line utility works great for converting html to pdf but my problem is that I need to run it as command on unix (AIX) which is where webspeed transaction server resides. Has anyone successfully compiled this program to run on Unix ,or specifically AIX? Are there any other command line utilities for unix that can convert html to pdf and "contain" css styles defined in the document? That's the beauty of wkthml2pdf or PrinceXML. PrinceXML is very pricey.
 

Cecil

19+ years progress programming and still learning.
Hi WebGuy. I know quite a bit about wkhtmltopdf running on Linux and the complexities of trying to compile the utility, which I personally never been successful in doing. I know nothing about AIX but to help save you time trying to do the impossible can I recommend and alternative method.

From the AIX server run an rsh session to a second Linux server (CentOS, Ubuntu, Redhat) where you then run the wkhtmltopdf utility under an Linux environment. Once the command has been successfully been executed scp or rsync the resulted PDF file back to the AIX server. All of this can be done from a WebSpeed Session.

It is crude form of distributed processing. Depending on the size of the HTML you are rendering, wkhtmltopdf can be very CPU intensive. Also if you are using the latest release of wkhtmltopdf you will need to utilize a virtual screen buffer.

Here is my example of using the virtual Screen Buffer:

xvfb-run --server-args="-screen 0, 1280x1024x24" wkhtmltopdf-i386 --use-xserver http://www.stuff.co.nz stuff.co.nz.pdf

Hope this helps.
 

webguy

Member
Hi WebGuy. I know quite a bit about wkhtmltopdf running on Linux and the complexities of trying to compile the utility, which I personally never been successful in doing. I know nothing about AIX but to help save you time trying to do the impossible can I recommend and alternative method.

From the AIX server run an rsh session to a second Linux server (CentOS, Ubuntu, Redhat) where you then run the wkhtmltopdf utility under an Linux environment. Once the command has been successfully been executed scp or rsync the resulted PDF file back to the AIX server. All of this can be done from a WebSpeed Session.

It is crude form of distributed processing. Depending on the size of the HTML you are rendering, wkhtmltopdf can be very CPU intensive. Also if you are using the latest release of wkhtmltopdf you will need to utilize a virtual screen buffer.

Here is my example of using the virtual Screen Buffer:

xvfb-run --server-args="-screen 0, 1280x1024x24" wkhtmltopdf-i386 --use-xserver htt stuff.co.nz.pdf

Hope this helps.

Cecil thanks for your response. I ended up using an aspx page that I can feed with a url to generate the pdf. Our webserver running the messengers is on Win server 2003. I just installed wkhtmltopdf on the webserver. I can call the pdftourl converter from my webspeed app to convert the url to pdf. Obviously I would rather call wkhtmltopdf within my webspeed app and generate the file and stream it to the browser. This was an easy workaround. Also by running this on IIS7 I was able to create an app pool just for this utility to control memory usage.
 
Top