Wkhtmltopdf

From KevinWiki

(Difference between revisions)
Jump to: navigation, search
Kevin (Talk | contribs)
(Created page with "Category:Linux = Installation = * Download the latest wkhtmltopdf from its download page http://code.google.com/p/wkhtmltopdf/downloads/list * Extract the file and copy to ...")
Newer edit →

Revision as of 15:37, 8 August 2013


Installation

e.g.)

$ tar -jxvf wkhtmltopdf-0.11.0_rc1-static-i386.tar.bz2 

$ mv wkhtmltopdf-i386 wkhtmltopdf-i386-0.11.0_rc1 

$ chown root:root wkhtmltopdf-i386-0.11.0_rc1 

$ mv wkhtmltopdf-i386-0.11.0_rc1 /usr/bin/ 
  • Create /usr/bin/wkhtmltopdf.sh
#!/bin/bash

xvfb-run -a -s "-screen 0 640x480x16" wkhtmltopdf-i386-0.11.0_rc1 $*

$ chmod a+x /usr/bin/wkhtmltopdf.sh 

$ cd /usr/bin 

$ ln -s wkhtmltopdf.sh wkhtmltopdf 

If running wkhtmltopdf causes the following error

wkhtmltopdf: cannot connect to X server 

Or

/usr/bin/wkhtmltopdf: line 4: xvfb-run: command not found

Install xvfb

$ apt-get install xvfb 
Personal tools