ODOO Unable To Find Wkhtmltopdf On This System.

本文解决在使用Odoo版本8时遇到的找不到Wkhtmltopdf导致报告显示为html的问题。通过升级Wkhtmltopdf版本到0.12.1,可以解决此错误并生成正确的PDF文件。

if you are using ODOO version 8 and getting some error like –

Unable to find Wkhtmltopdf on this system. The report will be shown in html.

It means you need to upgrade the version of Wkhtmltopdf library on your server.

Let me elaborate this problem first-

As we all know, when we install ODOO-version 8 on the server, we have also install some necessary libraries too like – python-decorator, python-werkzeug and many more libraries. ” Wkhtmltopdf ” is also one of them. Now, lets come to the main problem, when we install “wkhtmltopdf” on server, using command like –

sudo apt-get install -y wkhtmltopdf

this command install an outdated wkhtmltopdf and odoo generate a wrong pdf (with 0 byte ) and popup error saying to update to the new wkhtmltopdf. So this is not a ODOO Error, but we can say it`s a wkhtmltopdf issue(moreover it`s a version issue).

Solution is to upgrade ” wkhtmltopdf ” to 0.12.1 like this –

1) Download wkhtmltopdf version from wkhtmltopdf depending on your system arch (32 or 64 bit) –

# For 64-bit - Linux (Ubuntu Trusty) - Ubuntu 14.04
 
sudo wget http://sourceforge.net/projects/wkhtmltopdf/files/archive/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
 
# For 64-bit - Centos- 7.1.1503 (Core) 
 
sudo wget http://sourceforge.net/projects/wkhtmltopdf/files/archive/0.12.1/wkhtmltox-0.12.1_linux-centos7-amd64.rpm

2) Install the downloaded package as –

# For Ubuntu 
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
 
# For Centos 
sudo rpm -Uvh wkhtmltox-0.12.1_linux-centos7-amd64.rpm

3) Copy files as –

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

4) Restart Odoo server and then try again.

That`s it !!! I hope it will help someone.

转载于:https://my.oschina.net/u/241688/blog/630474

<think>好的,用户现在在问如何在Ubuntu 22.04上安装wkhtmltopdf。让我先看看之前的对话记录。用户之前遇到了下载wkhtmltox_0.12.6-1.focal_amd64.deb的问题,我给了他们几种解决方法,包括使用新链接、第三方仓库和解决依赖问题。现在用户引用了几个站内的资料,包括腾讯云主机安装Odoo17的步骤,提到了安装libssl1.1和中文字体,以及从源代码安装Odoo17时下载jammy版本的wkhtmltopdf。用户现在明确想找在Ubuntu 22.04上的安装方法。 首先,我需要确认用户的需求。他们可能是在安装Odoo17,因为引用的内容都涉及Odoo的安装,而wkhtmltopdfOdoo的依赖项之一。所以用户的实际场景可能是在部署Odoo17时遇到wkhtmltopdf安装的问题。Ubuntu 22.04的代号是Jammy,所以之前的focal(20.04)版本可能不兼容,需要找对应的jammy版本。 在之前的回答中,我提到了使用jammy的deb包,用户现在提供的引用[3]里也提到了这个链接。所以正确的步骤应该是下载jammy版本的deb文件,安装,并处理可能的依赖问题,比如libssl1.1。用户可能之前尝试了错误的focal版本导致问题,现在需要明确指导他们使用正确的包。 另外,用户引用中提到了安装中文字体,这可能和wkhtmltopdf生成PDF时需要中文字体支持有关。但用户现在的问题集中在安装wkhtmltopdf,所以可能需要提醒他们如果需要中文支持,安装相关字体。 用户之前的问题是关于无法下载focal的deb,现在引用[3]提供了正确的jammy链接,所以需要强调版本匹配的重要性。同时,用户可能已经尝试过某些步骤,但遇到依赖问题,比如libssl1.1,需要指导如何解决这些依赖。 总结步骤应该是:1)下载正确的jammy版本deb;2)安装依赖如libssl1.1;3)安装deb包;4)处理可能的依赖错误。此外,可以提到使用apt安装的方法,但可能版本较旧,或者通过第三方仓库安装。 需要确保用户不会再次下载错误的focal版本,同时提供多种方法,比如直接下载deb、使用第三方仓库、或者从源码编译。但根据引用内容,最直接的是使用jammy的deb包。此外,用户可能已经按照某些教程操作,但需要纠正其中的版本问题,比如引用[1]中提到的安装focal版本在22.04上可能不合适,需要指出正确的方法。 最后,用户可能需要验证安装是否成功,所以建议添加验证步骤,比如运行wkhtmltopdf --version。同时,相关问题可以包括如何解决依赖冲突、验证安装等,延续之前的思考。</think>根据您在Ubuntu 22.04(Jammy Jellyfish)安装wkhtmltopdf的需求,结合引用内容及系统版本特性,提供以下完整方案: ### 一、官方推荐安装(首选) ```bash # 下载Jammy版本安装包(专为Ubuntu 22.04编译) wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb # 安装依赖库(解决libssl1.1问题) sudo apt-get update && sudo apt-get install -y libssl1.1 xfonts-75dpi xfonts-base # 安装主程序 sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb # [^3] ``` ### 二、替代安装方案 #### 方案A:通过系统仓库安装 ```bash # 添加第三方仓库(适用于需要最新版本) sudo apt-get install -y gnupg wget -qO - https://repo.odoo.com/odoo.key | sudo gpg --dearmor -o /usr/share/keyrings/odoo-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/odoo-archive-keyring.gpd] http://nightly.odoo.com/17.0/nightly/deb/ ./" | sudo tee /etc/apt/sources.list.d/odoo.list sudo apt-get update && sudo apt-get install wkhtmltopdf # [^1] ``` #### 方案B:源码编译安装 ```bash # 安装编译依赖 sudo apt-get install -y git cmake qt5-default libqt5webkit5-dev g++ # 克隆源码仓库 git clone --recursive https://github.com/wkhtmltopdf/wkhtmltopdf.git cd wkhtmltopdf cmake . make -j4 sudo make install ``` ### 三、中文字体支持(PDF生成必需) ```bash sudo apt-get install -y ttf-wqy-zenhei ttf-wqy-microhei # [^2] ``` ### 四、验证安装 ```bash wkhtmltopdf --version # 应显示"wkhtmltopdf 0.12.6.1 (with patched qt)" echo "<html><body>测试</body></html>" | wkhtmltopdf - test.pdf # 验证中文PDF生成 ``` ### 五、常见问题解决 **Q:出现`libssl1.1`依赖错误?** ```bash # 手动安装旧版openssl库 wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb # [^1] ``` **Q:遇到X server错误?** ```bash # 无头模式运行(适用于服务器环境) xvfb-run -a -s "-screen 0 1024x768x24" wkhtmltopdf [参数] ``` --相关问题--: 1. 如何解决wkhtmltopdf生成的PDF中文乱码? 2. Ubuntu 22.04安装旧版软件包的正确方法? 3. Odoo17安装后如何验证wkhtmltopdf集成?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值