• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How To Install Wkhtmltopdf (HTML Page To PDF Converter)

{{postValue.id}}

To Install Wkhtmltopdf (HTML Page To PDF Converter) in RHEL, CentOS, Fedora

In this article we will learn, how to install Wkhtmltopdf in centos7.

Features

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

To install Evince (PDF Viewer)

Use the following command to install evince.

[root@linuxhelp ~]# yum install evince
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* epel: mirror.pregi.net
* extras: ftp.iitm.ac.in
* nux-dextop: li.nux.ro
* updates: ftp.iitm.ac.in
Resolving Dependencies
-->  Running transaction check
--->  Package evince.x86_64 0:3.14.2-5.el7 will be installed
-->  Finished Dependency Resolution
..
..
Total download size: 2.3 M
Installed size: 9.0 M
Is this ok [y/d/N]: y
Downloading packages:
evince-3.14.2-5.el7.x86_64.rpm | 2.3 MB 00:17
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : evince-3.14.2-5.el7.x86_64 1/1
Verifying : evince-3.14.2-5.el7.x86_64 1/1

Installed:
evince.x86_64 0:3.14.2-5.el7

Complete!

To Download Wkhtmltopdf Source File

On RHEL/CentOS/Fedora 32-bit OS

Use the following command to download Wkhtmltopdf.

wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.10.0_rc2-static-i386.tar.bz2

On RHEL/CentOS/Fedora 64-bit OS

Use the following command to download Wkhtmltopdf.

[root@linuxhelp ~]# wget https://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.10.0_rc2-static-amd64.tar.bz2
--2016-04-02 14:32:17-- https://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.10.0_rc2-static-amd64.tar.bz2
Resolving wkhtmltopdf.googlecode.com (wkhtmltopdf.googlecode.com)... 74.125.200.82, 2404:6800:4003:c00::52
Connecting to wkhtmltopdf.googlecode.com (wkhtmltopdf.googlecode.com)|74.125.200.82|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10995568 (10M) [application/x-bzip2]
Saving to: ‘ wkhtmltopdf-0.10.0_rc2-static-amd64.tar.bz2’ 

100%[======================================> ] 10,995,568 175KB/s in 51s

2016-04-02 14:33:10 (209 KB/s) - ‘ wkhtmltopdf-0.10.0_rc2-static-amd64.tar.bz2’  saved [10995568/10995568]

To Install Wkhtmltopdf

Use the following command to extract files to directory like, opt.

For RHEL/CentOS/Fedora 64-Bit OS

[root@linuxhelp ~]# tar -xvf wkhtmltopdf-0.10.0_rc2-static-amd64.tar.bz2 -C /opt/
wkhtmltopdf-amd64

Install the wkhtmltopdf to the directory /usr/local/bin for easy execution of program from any path.

For RHEL/CentOS/Fedora 64-Bit OS

[root@linuxhelp ~]# cd /opt/
[root@linuxhelp opt]# ls -l
total 10812
-rwxr-xr-x. 1 user1 user1 11068596 Jan 30 2011 wkhtmltopdf-amd64
[root@linuxhelp opt]# mv wkhtmltopdf-amd64 wkhtmltopdf
[root@linuxhelp opt]# ls -l
total 10812
-rwxr-xr-x. 1 user1 user1 11068596 Jan 30 2011 wkhtmltopdf
[root@linuxhelp opt]# mv wkhtmltopdf /usr/local/bin/

Uses of Wkhtmltopdf

To Convert Remote HTML Page to PDF File

Run the following command to convert any HTML web page to PDF and it will convert the given webpage to linuxhelp.pdf as output to /opt directory.

[root@linuxhelpopt]# wkhtmltopdf http://onlinesignature.netaxisstudio.com/fancy-signature.html /opt/linuxhelp.pdf
Loading pages (1/6)
QSslSocket: cannot call unresolved function SSLv3_client_method58%
QSslSocket: cannot call unresolved function SSL_CTX_new
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function ERR_get_error
..
..
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done

To View Generated PDF File

Run the following command, to verify that the file is created.

[root@linuxhelp opt]# file /opt/linuxhelp.pdf
/opt/linuxhelp.pdf: PDF document, version 1.4

To view Information of Generated PDF File

Run the following command, to view the information of generated file.

[root@linuxhelp opt]# pdfinfo /opt/linuxhelp.pdf
Title: Fun and Fancy Signature Creator Online: OnlineSignature.in
Creator:
Producer: wkhtmltopdf
CreationDate: Mon Apr 4 09:14:38 2016
Tagged: no
UserProperties: no
Suspects: no
Form: none
JavaScript: no
Pages: 3
Encrypted: no
Page size: 595 x 842 pts (A4)
Page rot: 0
File size: 123280 bytes
Optimized: no
PDF version: 1.4

To view Created PDF File

Run the following command to view the created file.

[root@linuxhelp opt]# evince /opt/linuxhelp.pdf

To Create TOC (Table of Content) of a Page to PDF

Use the following command to create a table of content for a PDF file.

[root@linuxhelp opt]# wkhtmltopdf http://onlinesignature.netaxisstudio.com/fancy-signature.html /opt/linuxhelp1.pdf
Loading pages (1/6)
QSslSocket: cannot call unresolved function SSLv3_client_method60%
QSslSocket: cannot call unresolved function SSL_CTX_new
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function ERR_get_error
..
..
Counting pages (2/6)
Loading TOC (3/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done

To view the toc pdf file

[root@linuxhelp opt]# evince /opt/linuxhelp1.pdf
(evince:8999): EggSMClient-WARNING **: Failed to connect to the session manager: None of the authentication protocols specified are supported

Tags:
michael
Author: 

Comments ( 1 )

alextrask
Hi. How can I add blank page on end gerated file?
Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

How to install wkhtmltopdf on a Linux based (shared hosting) web server?

A

The command to install wkhtmltopdf on a Linux based


$ wget {relavant url to binary from link above}


$ tar -xvf {filename of above wget'd file}

Q

How to install wkhtmltopdf in python using API?

A

By this command to download and install the plugin

$ python -m wkhtmltopdf.api &

$ wget http://localhost:8888/?url=example.com&output_file=example.pdf

Q

What is a command to check version in wkhtmltopdf?

A

The command to check the version of the whkhtmltopdf

Syntax: "wkhtmltopdf -V"

Q

How to do page numbering in header/footer HTML with wkhtmltopdf?

A

By this, you can add header and footer in wkhtmltopdf
var pdfInfo = {};
var x = document.location.search.substring(1).split('&');
for (var i in x) { var z = x[i].split('=',2); pdfInfo[z[0]] = unescape(z[1]); }
function getPdfInfo() {
var page = pdfInfo.page || 1;
var pageCount = pdfInfo.topage || 1;
document.getElementById('pdfkit_page_current').textContent = page;
document.getElementById('pdfkit_page_count').textContent = pageCount;

Q

What is the package to install plugin wkhtmltopdf in ubuntu?

A

The package is to install in the wkhtmltopdf

$ sudo apt-get install flash plugin-nonfree

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Lucas ?
Various options in Top command

Am using Top command only to view the load average, what are the various options in Top command..??

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.