RubyPDF Blog tutorial GNURoot in Action–Install and Run wkhtmltopdf

GNURoot in Action–Install and Run wkhtmltopdf

wkhtmltopdf and wkhtmltoimage are open source (LGPLv3) command line tools to render HTML into PDF and various image formats using the Qt WebKit rendering engine. These run entirely “headless” and do not require a display or display service.

Install wkhtmltopdf is very easy

apt-get install wkhtmltopdf

but this version is not headless, we still need install X Server, because headless version is only for static binary,

apt-get install xvfb
Xvfb :1 -screen 5 1024x768x8 &
export DISPLAY=:1.5
wkhtmltopdf http://localhost:8080/info.php phpinfo.pdf  #output is about 1.5M
wkhtmltoimage http://localhost:8080/info.php phpinfo.png #output is about 73M


2 thoughts on “GNURoot in Action–Install and Run wkhtmltopdf”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.