How To Install wkhtmltopdf In CentOS 7.0 for Odoo9

2016年8月4日13:13:17 发表评论 1,458 views

Introduction

On the previous post, the tutorial is almost the same, but this is for CentOS 7.0.

 

Audience

This tutorial intends for the people who, at least, have knowledge in CentOS.

Step 1: Preparation

Login to your CentOS machine. Make sure that you have root access. It is up to you on how you gain a root access by logging in directly as root user or do an su - command.

Step 2: Install Dependencies

Now that I mentioned it, there are two items needed in order to install the wkhtmltopdf:

  1. xorg-x11-fonts-Type1
  2. xorg-x11-fonts-75dpi

Install the two items with the following command

yum install -y icu fontconfig libpng libX11 libXext libXrender
yum install -y xorg-x11-fonts-75dpi
yum install -y xorg-x11-fonts-Type1
yum install -y xorg-x11-utils

安装文泉驿中文字体,否则pdf中文乱码。
yum install -y 'wqy-*'

Step 3: Install wkhtmltopdf

Next, download the wkhtmltopdf RPM file.

wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm

As of the published date, there is no 32-bit version of the said tool available for download. After the file has been downloaded, run the command:

rpm -Uvh wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm

Step 4: Testing

And now for the test. Run the command (and make sure that the computer is accessible to internet):

wkhtmltopdf http://www.google.com.ph google.pdf

During the generation, it will show something like this:

Loading pages (1/6)
Counting pages (2/6) 
Resolving links (4/6) 
Loading headers and footers (5/6) 
Printing pages (6/6)
Done

If the command generates the from the website to PDF file successfully, again, it is obvious that the wkhtmltopdf is working.

 

Step 5: Move

Copy binary or wkhtmltopdf  from ./usr/local/bin to /usr/bin, either use command or WinSCP

    sudo cp /usr/local/bin/wkhtmltopdf   /usr/bin/

 

Step 5: Restart

 use command to restart odoo service.     systemctl restart odoo

Notes

When the latest version of wkhtmltopdf is available, change the version number accordingly.

Update

Whoa! Thanks to the comments, which are already more than a month old (I apologize for very sluggish replies, am caught on the realities of my life), I changed the URL of the host to the new one.

 

 

 

If you are using Centos 7 minimal:

yum install xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi libjpeg-turbo libX11 libXext libXrender libpng

wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.2.1/wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm

rpm -Uvh wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm

 

  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 我的微信公众号
  • 我的微信公众号扫一扫
  • weinxin

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: