wkhtmltopdf + mixed photo colors

心不动则不痛 提交于 2019-12-08 04:43:24

问题


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?


回答1:


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




回答2:


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;}




回答3:


To follow on from my comment above:

  • Changing the image quality only helps some cases
  • I contacted the developer (antialize) and he has now fixed this issue on his staging branch.

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 and configure).



来源:https://stackoverflow.com/questions/5718660/wkhtmltopdf-mixed-photo-colors

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