Skip to main content

OnlineSupport4u

wkhtmltopdf install

By PrasadNaik
July 20, 2015

if you are facing issues with install of  wkhtmltopdf

please follow below steps

Download the zip file using wget

root@hostonlinesupport4u.in[/home/online/public_html/onlinesupport4u.in/cgi-bin]#

wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2

–2015-07-20 03:15:00– http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2
Resolving wkhtmltopdf.googlecode.com… 64.233.168.82, 2607:f8b0:4003:c07::52
Connecting to wkhtmltopdf.googlecode.com|64.233.168.82|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 8218260 (7.8M) [application/x-bzip2]
Saving to: `wkhtmltopdf-0.9.9-static-amd64.tar.bz2′

100%[====================================================================================================================================================================================================>] 82,18,260 15.3M/s in 0.5s

2015-07-20 03:15:00 (15.3 MB/s) – `wkhtmltopdf-0.9.9-static-amd64.tar.bz2′ saved [8218260/8218260]

FINISHED –2015-07-20 03:15:00–
Downloaded: 1 files, 7.8M in 0.5s (15.3 MB/s)

 

Unzip the file using tar

root@hostonlinesupport4u.in[/home/online/public_html/onlinesupport4u.in/cgi-bin]#

tar xvjf wkhtmltopdf-0.9.9-static-amd64.tar.bz2

wkhtmltopdf-amd64
root@host234 [/home/fantasti/public_html/mealmerge.com/cgi-bin]# ls -la
total 54640
drwxr-xr-x. 2 fantasti fantasti 4096 Jul 20 03:15 ./
drwxr-x—. 5 fantasti nobody 4096 Jul 20 02:36 ../
-rwxr-xr-x. 1 fantasti fantasti 39419552 Jun 26 05:26 wkhtmltopdf*
-rw-r–r–. 1 root root 8218260 May 24 2010 wkhtmltopdf-0.9.9-static-amd64.tar.bz2
-rwxr-xr-x. 1 1000 1000 8301444 May 24 2010 wkhtmltopdf-amd64*

 

Rename wkhtmltopdf-amd64 to wkhtmltopdf
root@hostonlinesupport4u.in[/home/online/public_html/onlinesupport4u.in/cgi-bin]# mv wkhtmltopdf-amd64 wkhtmltopdf

 

Change Permissions using chmod to executable

root@hostonlinesupport4u.in[/home/online/public_html/onlinesupport4u.in/cgi-bin]# chmod +x wkhtmltopdf1

Now execute the file to see if any errors

# ./wkhtmltopdf1
You need to specify atleast one input file, and exactly one output file
Use – for stdin or stdout

Name:
wkhtmltopdf 0.9.6

Synopsis:
wkhtmltopdf [OPTIONS]… <input file> [More input files] <output file>

Description:
Converts one or more HTML pages into a PDF document, using wkhtmltopdf patched
qt.

General Options:
-b, –book Set the options one would usually set when
printing a book
–collate Collate when printing multiple copies
–copies <number> Number of copies to print into the pdf
file (default 1)
–cover <url> Use html document as cover. It will be
inserted before the toc with no headers
and footers
-H, –default-header Add a default header, with the name of the
page to the left, and the page number to
the right, this is short for:
–header-left='[webpage]’
–header-right='[page]/[toPage]’ –top 2cm
–header-line
–extended-help Display more extensive help, detailing
less common command switches
-h, –help Display help
-O, –orientation <orientation> Set orientation to Landscape or Portrait
-s, –page-size <size> Set paper size to: A4, Letter, etc.
–password <password> HTTP Authentication password
-p, –proxy <proxy> Use a proxy
-q, –quiet Be less verbose
-t, –toc Insert a table of content in the beginning
of the document
–username <username> HTTP Authentication username
-V, –version Output version information an exit

Contact:
If you experience bugs or want to request new features please visit
<http://code.google.com/p/wkhtmltopdf/issues/list>, if you have any problems
or comments please feel free to contact me: see
<http://www.madalgo.au.dk/~jakobt/#about>

 

now test conversion using below command

root@hostonlinesupport4u.in[/home/online/public_html/onlinesupport4u.in/cgi-bin]#

./wkhtmltopdf www.google.com google.pdf
Loading pages (1/5)
Resolving links (2/5)
Counting pages (3/5)
Printing pages (5/5)
Done