tcpdf: poor image quality

[亡魂溺海] 提交于 2019-12-30 17:31:51

问题


I am using TCPDF to create PDF files converted from HTML input using it's writeHTML() function. However, images within the PDF have poor quality, while the original images have a high quality (as expected). The images are in PNG format. I already tried to use SetJPEGQuality(100), but that had no effect.

What is causing this?


回答1:


Try using this:

$pdf->setImageScale(1.53); 

http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/4831671




回答2:


When using HTML to generate your PDFs you need to manually calculate the images dimensions by dividing it's original width and height by 1.53 and set the result as attributes.

For example, an image with dimensions of 200x100 pixels will become:

<img src="image.jpg" width="131" height="65" />

This is a nasty workaround and doesn't completely remove the blur, but the result is much better than without any scaling.




回答3:


Try To convert your Image to JPG or JPEG first. Until Now, I DOnt have a problem to convert image with TCPDF. I Think TCPDF is powerfull, because it can convert arabic language too. I HAve try convert arabic font with fpdf n it still fail




回答4:


Little Up.

I'd same quality problem and I solved it... When you save your picture, do it in 8bits instead of 24bits and you will see a "beautiful anti-aliasing".



来源:https://stackoverflow.com/questions/6031329/tcpdf-poor-image-quality

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