wkhtmltopdf +混合照片颜色
我有一个彩色和黑白页面白色图像,当我使用 wkhtmltopdf 从 html 文件生成 pdf 时,
我只得到彩色图像,如何让它打印所有图像,我已经尝试了高级选项,但没有成功。
如果我以灰度打印,那么所有图像都会出现,但我不需要灰度。
有什么帮助吗?
I have a page with color and black & white images, when I use wkhtmltopdf to generate a pdf from the html file,
I get only the color images, how can I get it to print all the images, I have tried the advance options, but no success.
If I print in grayscale, then all the images are coming, but I don't want grayscale.
Any help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我想出了如何解决这个问题,我尝试了一种反复试验的方法,并发现如果我们提供以下参数所有图像,无论颜色或黑白,它都会出现
wkhtmltopdf --image-quality 75
注意:任何值 <= 75 均可,较高值仅打印黑白图像的空白
I figured out how to solve this problem, I tried a trial-and-error method and figured out that if we provided the following parameters all the images irrespective of color or B&W, it would come up
wkhtmltopdf --image-quality 75
NOTE: Any value <= 75 works, higher value print a blank space for B&W images only
这个问题很旧,但我会添加这个问题,以防有人遇到类似问题并且无法升级。
我发现应用这个 CSS 解决了我的非彩色图像渲染问题。
img {不透明度:0.99;}
This question is old, but I'll add this in case someone has a similar issue and is unable to upgrade.
I found that applying this CSS solved the problem of non-color image rendering for me.
img {opacity: 0.99;}
继续我上面的评论:
目前还没有包含此修复程序的版本,因此您必须自己编译它。
如果您使用最新的staging分支编译,所有图像现在可以按预期工作。请记住按照“自己安装 QT”的说明进行编译。
此外,如果您想静态编译,请参阅我的注释(在编译 wiki 页面,于 2011 年 12 月 19 日发布)关于编辑两个文件以允许静态编译 webkit(需要更改的 2 个文件是
/tools/configure/configureapp.cpp
和configure)。
To follow on from my comment above:
There isn't a release yet with this fix, so you will have to compile it yourself.
If you compile using the latest staging branch, all images now work as expected. Remember to compile following the "Installing QT yourself" instructions.
Furthermore, if you want to compile statically, see my note (on the compilation wiki page, made on Dec 19, 2011) about editing two files to allow static compiling of webkit (the 2 files that need to change are
/tools/configure/configureapp.cpp
andconfigure
).