Wkhtmltopdf

From KevinWiki

(Difference between revisions)
Jump to: navigation, search
(Created page with "Category:Linux = Installation = * Download the latest wkhtmltopdf from its download page http://code.google.com/p/wkhtmltopdf/downloads/list * Extract the file and copy to ...")
 
Line 3: Line 3:
= Installation =
= Installation =
-
* Download the latest wkhtmltopdf from its download page http://code.google.com/p/wkhtmltopdf/downloads/list
+
* Download the latest wkhtmltopdf from [http://wkhtmltopdf.org/downloads.html its download page]. <del>http://code.google.com/p/wkhtmltopdf/downloads/list</del>
-
* Extract the file and copy to /usr/bin
+
* <del>Extract the file and copy to /usr/bin</del>
 +
* It provides installation package for each well-known OS so just use the package for your OS to install.
 +
e.g.)
 +
* For Ubuntu
 +
<pre>
 +
dpkg -i wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
 +
</pre>
 +
You can also get it from the Ubuntu software repository but that version might not be the latest one.
 +
<pre>
 +
apt-get install wkhtmltopdf
 +
</pre>
 +
 +
* For Mac OS X, use [http://brew.sh/ Homebrew] [http://caskroom.io/ Cask] (You don't need to download the wkhtmltopdf package from the website).
 +
<pre>
 +
brew cask install wkhtmltopdf
 +
</pre>
 +
 +
== '''The following instructions are outdated.''' ==
e.g.)
e.g.)
<pre>
<pre>

Latest revision as of 03:35, 12 April 2015


Installation

e.g.)

  • For Ubuntu
dpkg -i wkhtmltox-0.12.2.1_linux-trusty-amd64.deb 

You can also get it from the Ubuntu software repository but that version might not be the latest one.

apt-get install wkhtmltopdf 
  • For Mac OS X, use Homebrew Cask (You don't need to download the wkhtmltopdf package from the website).
brew cask install wkhtmltopdf 

The following instructions are outdated.

e.g.)

$ tar -jxvf wkhtmltopdf-0.11.0_rc1-static-i386.tar.bz2 

$ mv wkhtmltopdf-i386 wkhtmltopdf-i386-0.11.0_rc1 

$ chown root:root wkhtmltopdf-i386-0.11.0_rc1 

$ mv wkhtmltopdf-i386-0.11.0_rc1 /usr/bin/ 
  • Create /usr/bin/wkhtmltopdf.sh
#!/bin/bash

xvfb-run -a -s "-screen 0 640x480x16" wkhtmltopdf-i386-0.11.0_rc1 $*

$ chmod a+x /usr/bin/wkhtmltopdf.sh 

$ cd /usr/bin 

$ ln -s wkhtmltopdf.sh wkhtmltopdf 

If running wkhtmltopdf causes the following error

wkhtmltopdf: cannot connect to X server 

Or

/usr/bin/wkhtmltopdf: line 4: xvfb-run: command not found

Install xvfb

$ apt-get install xvfb 
Personal tools