HTML to PDF Conversion using wkhtmltopdf



Wkhtmltopdf Features

·         Open source and cross platform.
·         Convert any HTML web pages to PDF files using WebKit engine.
·         Options to add headers and footers
·         Table of Content (TOC) generation option.
·         Provides batch mode conversions.
·         Support for PHP or Python via bindings to libwkhtmltox

Needed to install some fonts which are used for wkhtmltopdf

# yum install -y xorg-x11-fonts-75dpi
# yum install -y xorg-x11-fonts-Type1

To get the file please run the following
# wget https://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.10.0_rc2-static-amd64.tar.bz2

To extract the file
# tar -xvzf wkhtmltopdf-0.10.0_rc2-static-amd64.tar.bz2 -C /opt
# cd /opt
# mv wkhtmltopdf-amd64 wkhtmltopdf
# mv wkhtmltopdf /usr/local/bin


To convert any HTML web page to PDF, run the following example command. It will convert the given webpage to install-eclipse.pdf as as output to /opt directory.

# wkhtmltopdf http://google.com/  /opt/google.pdf

Sample Output :
Loading pages (1/6)
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done  

Please comments and suggestions are always welcome.

Keywords: wkhtmltopdf, wkhtml2pdf. HTML, PDF, HTML2PDF, HTMLtopdf



Comments

Popular posts from this blog

Observium: Configuring Microsoft Windows 2008 Server SNMP Agent

AWS: Introduction to AWS (Amazon Web Services)

System/Server Health Status using PowerShell