您好,登錄后才能下訂單哦!
本篇內(nèi)容主要講解“如何安裝wkhtmltopd 0.12.5”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“如何安裝wkhtmltopd 0.12.5”吧!
安裝環(huán)境:
Centos7.2
已可使用yum。不可使用的網(wǎng)上另找教程。
在https://wkhtmltopdf.org/downloads.html下載0.12.5版本, 為rpm文件
然后將下載好的wkhtmltox-0.12.5-1.centos7.x86_64.rpm上傳到服務(wù)器/mnt里面
到mnt目錄下執(zhí)行rpm -ivh wkhtmltox-0.12.5-1.centos7.x86_64.rpm 報錯,
需要先安裝一些依賴, 沒關(guān)系,他需要什么你就安裝什么
一個一個安裝,中間有需要詢問的,回y同意就好了
yum install xorg-x11-fonts-Type1* yum install xorg-x11-fonts-75dpi* yum install libjpeg* yum install libXext* yum install libfontconfig* yum install libXrender*
安裝完依賴再執(zhí)行rpm -ivh wkhtmltox-0.12.5-1.centos7.x86_64.rpm 又報錯
還需要多一個openssl
yum -y install openssl
安裝完再執(zhí)行rpm -ivh wkhtmltox-0.12.5-1.centos7.x86_64.rpm
這次完成了
執(zhí)行測試
wkhtmltopdf http://www.baidu.com ./test.pdf
但是打開test.pdf發(fā)現(xiàn)漢字居然方格
看來要安裝中文漢字支持。
首先安裝個這個
yum install -y fontconfig mkfontscale
再從windows里面將兩個字體拿出來
也就是這兩個
放到/usr/share/fonts/chinese/TrueType之下
進(jìn)入/usr/share/fonts/chinese/TrueType目錄執(zhí)行
cd /usr/share/fonts/chinese/TrueType mkfontscale mkfontdir fc-cache -fv source /etc/profile
執(zhí)行fc-list :lang=zh 發(fā)現(xiàn)的確有了中文字體
回到/mnt目錄下面執(zhí)行
wkhtmltopdf http://www.baidu.com ./test2.pdf
打開test2.pdf . 噢。一天都光曬
到此,相信大家對“如何安裝wkhtmltopd 0.12.5”有了更深的了解,不妨來實際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。