Showing posts with label pdf. Show all posts
Showing posts with label pdf. Show all posts

Thursday 28 November 2013

Convert html to pdf on Fedora

wkhtmltopdf is a linux program that convert a webpage(html) to pdf format. The installation instruction of wkhtmltopdf are as below.
yum install wkhtmltopdf
To convert, simply enter as below:
wkhtmltopdf http://google.com test.pdf
However it will errored as it needs a X server:
wkhtmltopdf: cannot connect to X server
To solve the problem, we can install:
yum install xorg-x11-server-Xvfb
Create a shell script as below:
vi wkhtmltopdf.sh
And save with these parameters:
xvfb-run -a -s "-screen 0 640x480x16" wkhtmltopdf $*
And this is the way to run in commandline
wkhtmltopdf.sh http://www.google.com test.pdf

search iomeweekly