Reputation: 251
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?
Upvotes: 11
Views: 9324
Reputation: 16061
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.
Upvotes: 4
Reputation: 1
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".
Upvotes: 0
Reputation: 821
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
Upvotes: 0
Reputation: 182
Try using this:
$pdf->setImageScale(1.53);
http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/4831671
Upvotes: 8