How to install wkhtmltopdf on CentOS?

CentOS 7:

yum install -y libpng
yum install -y libjpeg
yum install -y openssl
yum install -y icu
yum install -y libX11
yum install -y libXext
yum install -y libXrender
yum install -y xorg-x11-fonts-Type1
yum install -y xorg-x11-fonts-75dpi

wget https://bitbucket.org/wkhtmltopdf/wkhtmltopdf/downloads/wkhtmltox-0.13.0...
rpm -Uvh wkhtmltox-0.13.0-alpha-7b36694_linux-centos7-amd64.rpm

CentOS 6:

First, we need to know which version of wkhtmltopdf binary - 32bit or 64 bit- we need. To do so run this command in CLI:

getconf LONG_BIT

Now depending on the version of your CentOS dowload the first or the second link respectively for 32 and 64 bits:


cd /usr/src
wget https://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.11.0_rc1-static-i386.tar.bz2
wget https://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.11.0_rc1-static-amd64.tar.bz2

Install necessary packages:

yum install xz urw-fonts libXext openssl-devel libXrender
tar xjf wkhtmltopdf*
cp wkhtmltopdf* /usr/bin/wkhtmltopdf

and test wkhtmltopdf:

wkhtmltopdf google.com test.pdf

Tags:

Comments

After the install I run following code to test it:
wkhtmltopdf google.com test.pdf

But I am getting following error :
root@host [/]# wkhtmltopdf google.com test.pdf
Loading pages (1/6)
Counting pages (2/6)

Resolving links (4/6)

Loading headers and footers (5/6)

Printing pages (6/6)
terminate called after throwing an instance of 'std::bad_alloc'Page 1 of 1
what(): std::bad_alloc
Aborted

What is going wrong here ? What am I missing ?

Add new comment

Filtered HTML

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.