Friday, 10 July 2015

HTML to PDF Conversion using "wkhtmltopdf" on Linux

We can convert html to pdf using wkhtmltopdf.

You can download "wkhtmltox"  from official website http://wkhtmltopdf.org/downloads.html

Here i downloaded Centos 64bit.

[root@sysads ~]# wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-centos6-amd64.rpm


Install wkhtmltox using rpm command


First you need to install xorg-x11-fonts-75dpi dependencies package.

[root@sysads ~]# yum install xorg-x11-fonts-75dpi

 [root@sysads ~]# rpm -ivh wkhtmltox-0.12.2.1_linux-centos6-amd64.rpm
Preparing...                ########################################### [100%]
   1:wkhtmltox              ########################################### [100%]
[root@sysads ~]#

Now you can able to convert HTML to PDF format


[root@sysads ~]# wkhtmltopdf /home/sysads/Desktop/owasp_scan_report/test.html /home/sysads/Desktop/owasp_scan_report/test.pdf
Loading pages (1/6)
Counting pages (2/6)                                              
Resolving links (4/6)                                                      
Loading headers and footers (5/6)                                          
Printing pages (6/6)
Done                                                                           
[root@sysads ~]#


No comments:

Post a Comment