wkhtmltopdf
Home page: https://wkhtmltopdf.org/
wkhtmltopdf and wkhtmltoimage are open source (LGPLv3) command line tools to render HTML into PDF and various image formats using the Qt WebKit rendering engine. These run entirely “headless” and do not require a display or display service.
Step 1:
yum install -y urw-fonts libXext libXrender fontconfig zlib freetype qt
Step 2:
yum install -y xorg-x11-fonts-75dpi
Result:
[root@tutorialspots ~]# yum install -y xorg-x11-fonts-75dpi Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile epel/x86_64/metalink | 15 kB 00:00 * base: mirror.compevo.com * epel: pubmirror1.math.uh.edu * extras: mirror.sesp.northwestern.edu * ius: dfw.mirror.rackspace.com * nux-dextop: mirror.li.nux.ro * remi-safe: mirror.bebout.net * updates: mirror.oss.ou.edu base | 3.6 kB 00:00 epel | 5.3 kB 00:00 extras | 2.9 kB 00:00 http://dfw.mirror.rackspace.com/ius/stable/CentOS/7/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found Trying other mirror. To address this issue please refer to the below wiki article https://wiki.centos.org/yum-errors If above article doesn't help to resolve this issue please use https://bugs.centos.org/. http://ius.mirror.constant.com/stable/CentOS/7/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found Trying other mirror. http://mirrors.kernel.org/ius/stable/CentOS/7/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found Trying other mirror. ius | 2.6 kB 00:00 mysql-connectors-community | 2.5 kB 00:00 mysql-tools-community | 2.5 kB 00:00 mysql57-community | 2.5 kB 00:00 nodesource | 2.5 kB 00:00 nux-dextop | 2.9 kB 00:00 remi-safe | 3.0 kB 00:00 updates | 2.9 kB 00:00 (1/12): epel/x86_64/group_gz | 90 kB 00:00 (2/12): base/7/x86_64/group_gz | 165 kB 00:00 (3/12): mysql-connectors-community/x86_64/primary_db | 53 kB 00:00 (4/12): mysql-tools-community/x86_64/primary_db | 69 kB 00:00 (5/12): mysql57-community/x86_64/primary_db | 198 kB 00:00 (6/12): extras/7/x86_64/primary_db | 159 kB 00:00 (7/12): base/7/x86_64/primary_db | 6.0 MB 00:00 (8/12): remi-safe/7/primary_db | 1.7 MB 00:00 (9/12): epel/x86_64/updateinfo | 1.0 MB 00:00 (10/12): updates/7/x86_64/primary_db | 5.9 MB 00:00 (11/12): epel/x86_64/primary_db | 6.9 MB 00:00 (12/12): nux-dextop/x86_64/primary_db | 1.8 MB 00:01 Resolving Dependencies --> Running transaction check ---> Package xorg-x11-fonts-75dpi.noarch 0:7.5-9.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: xorg-x11-fonts-75dpi noarch 7.5-9.el7 base 2.8 M Transaction Summary ================================================================================ Install 1 Package Total download size: 2.8 M Installed size: 2.9 M Downloading packages: xorg-x11-fonts-75dpi-7.5-9.el7.noarch.rpm | 2.8 MB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : xorg-x11-fonts-75dpi-7.5-9.el7.noarch 1/1 Verifying : xorg-x11-fonts-75dpi-7.5-9.el7.noarch 1/1 Installed: xorg-x11-fonts-75dpi.noarch 0:7.5-9.el7 Complete!
Step 3: goto page https://wkhtmltopdf.org/downloads.html to find link depend on your OS (CentOS 6,7,8)
For CentOS 7:
rpm -vih https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox-0.12.5-1.centos7.x86_64.rpm
Result:
[root@tutorialspots ~]# rpm -vih https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox-0.12.5-1.centos7.x86_64.rpm Retrieving https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox-0.12.5-1.centos7.x86_64.rpm Preparing... ################################# [100%] Updating / installing... 1:wkhtmltox-1:0.12.5-1.centos7 ################################# [100%]
Done, now you can use wkhtmltopdf and wkhtmltoimage.
You can install some packages like:
yum groupinstall Fonts
rpm -ivh http://download-ib01.fedoraproject.org/pub/epel/testing/7/x86_64/Packages/u/unifont-fonts-10.0.07-2.el7.noarch.rpm
Result:
[root@tutorialspots ~]# rpm -ivh http://download-ib01.fedoraproject.org/pub/epel/testing/7/x86_64/Packages/u/unifont-fonts-10.0.07-2.el7.noarch.rpm Retrieving http://download-ib01.fedoraproject.org/pub/epel/testing/7/x86_64/Packages/u/unifont-fonts-10.0.07-2.el7.noarch.rpm Preparing... ################################# [100%] Updating / installing... 1:unifont-fonts-10.0.07-2.el7 ################################# [100%]