Linux系统版本:openEuler系统
[odoo14@localhost ~]$ cat /etc/os-release NAME="openEuler" VERSION="21.03" ID="openEuler" VERSION_ID="21.03" PRETTY_NAME="openEuler 21.03" ANSI_COLOR="0;31"
1.下载wkhtmltopdf
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox-0.12.5-1.centos8.x86_64.rpm
我用的centos8系统版本 64位的,你们也可以下载自己适合的版本:wkhtmltopdf官网下载
2.安装wkhtmltopdf
rpm -ivh wkhtmltox-0.12.5-1.centos8.x86_64.rpm
这里遇到问题报错:
[odoo14@localhost ~]$ rpm -ivh wkhtmltox-0.12.5-1.centos8.x86_64.rpm
错误:依赖检测失败:
xorg-x11-fonts-Type1 被 wkhtmltox-1:0.12.5-1.centos8.x86_64 需要
出现依赖错误,先安装相应依赖:
[odoo14@localhost ~]$ sudo yum install xorg-x11-fonts-Type1
如果缺乏其他依赖也是一样先安装上:yum install -y libpng libjpeg openssl icu libX11 libXext libXrender xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi
安装好依赖好,继续安装就正常了直接安装成功
[odoo14@localhost ~]$ sudo rpm -ivh wkhtmltox-0.12.5-1.centos8.x86_64.rpm Verifying... ################################# [100%] 准备中... ################################# [100%] 正在升级/安装... 1:wkhtmltox-1:0.12.5-1.centos8 ################################# [100%]
3.测试是否安装成功
[odoo14@localhost ~]$ wkhtmltopdf www.baidu.com ~/baidu.pdf Loading pages (1/6) Counting pages (2/6) Resolving links (4/6) Loading headers and footers (5/6) Printing pages (6/6) Done
如果没有报错并且生成了pdf文件则说明安装成功了。
其他版本安装方式
1 下载相应版本的wkhtmltopdf
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz (centos7 64)
2 解压文件
tar xvfJ wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
cd wkhtmltox/bin/
3 复制命令
cp ./wkhtmltoimage /usr/local/bin/
cp ./wkhtmltopdf /usr/local/bin/
4 安装相关依赖
yum install libXext*
5 重启odoo服务
ps:我最开始安装的是 wkhtmltox-0.12.4_linux-generic-amd64.tar.xz,这是最稳定的版本。但是测试时报以下错误,尝试进行了修复发现解决不了,就重新安装了新的版本
Loading pages (1/6) QSslSocket: cannot resolve CRYPTO_num_locks ] 10% QSslSocket: cannot resolve CRYPTO_set_id_callback QSslSocket: cannot resolve CRYPTO_set_locking_callback QSslSocket: cannot resolve sk_free QSslSocket: cannot resolve sk_num QSslSocket: cannot resolve sk_pop_free QSslSocket: cannot resolve sk_value QSslSocket: cannot resolve SSL_library_init QSslSocket: cannot resolve SSL_load_error_strings QSslSocket: cannot resolve SSLv23_client_method QSslSocket: cannot resolve SSLv23_server_method QSslSocket: cannot resolve X509_STORE_CTX_get_chain QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf QSslSocket: cannot resolve SSLeay QSslSocket: cannot call unresolved function CRYPTO_num_locks QSslSocket: cannot call unresolved function CRYPTO_set_id_callback QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback QSslSocket: cannot call unresolved function SSL_library_init QSslSocket: cannot call unresolved function SSLv23_client_method QSslSocket: cannot call unresolved function sk_num 段错误 (核心已转储)



