How to install wkhtmltopdf with patched qt?

我怕爱的太早我们不能终老 提交于 2019-12-20 09:48:35

问题


I want to convert html to pdf, and I use wkhtmltopdf.

But print size is smaller than I supposed. I want to try --disable-smart-shrinking option but error occured like

$ xvfb-run -- /usr/bin/wkhtmltopdf --disable-smart-shrinking $INPUT $OUTPUT
The switch --disable-smart-shrinking, is not support using unpatched qt, and will be ignored.Loading page (1/2)
Printing pages (2/2)
Done

Maybe I have to install wkhtmltopdf with patched qt, but I don't know how to install.

I saw following size, but gitorious.org doesn't work.

wkhtmltopdf patched qt?

My OS is Ubuntu14.04, and wkhtmltopdf version is 0.12.2.1

If you know other reason to be printed smaller, tell me please. thanks.


回答1:


You can install wkhtmltopdf with --disable-smart-shrinking option from wkhtmltopdf.

Download and Install it.

http://wkhtmltopdf.org/usage/wkhtmltopdf.txt

The Document say

wkhtmltopdf 0.12.2.1 (with patched qt)

and

--disable-smart-shrinking Disable the intelligent shrinking strategy used by WebKit that makes the pixel/dpi ratio none constant




回答2:


This straightforward solution (no need to install xvfb, neither compiling QT neither wkhtmltopdf) works like a charm on my Debian Jessie server :

cd mytmpfolder
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
sudo tar xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
sudo mv wkhtmltox/bin/wkhtmlto* /usr/bin/
#create simple html test file
echo "<html><body>test</body></html>" >> test.html
#perform conversion
sudo wkhtmltopdf  --disable-smart-shrinking  --lowquality --enable-external-links --enable-internal-links test.html test.pdf



回答3:


Steps to Install Version 0.12.3 on Ubuntu 16.04.

Because I wasted way too much time tracking this down, here it is for others stumbling on this:

cd ~
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
tar vxf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz 
cp wkhtmltox/bin/wk* /usr/local/bin/

And you can confirm with:

$ wkhtmltopdf --version
wkhtmltopdf 0.12.3 (with patched qt)

Btw, I chose 0.12.3 instead of 0.12.4 because of a strange page sizing issue, discussed here.



来源:https://stackoverflow.com/questions/34479040/how-to-install-wkhtmltopdf-with-patched-qt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!