Wkhtmltopdf

From KevinWiki

Revision as of 15:37, 8 August 2013 by Kevin (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


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