Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TCPDF inline vs save-to-file image quality

Tags:

php

tcpdf

I am generating PDFs with TCPDF. I have a test script that generates an inline pdf, as well as a script that saves a PDF to the server and then emails it out.

The PDFs that are saved to file have extremely poor image quality on some images. You can see this below:

Poor image

The PDFs shown inline (in the browser) have perfect image quality: Good image

Does anyone know why there would be a difference between the two? Same code, just saved differently as per the documentation:

$pdf->Output(self::$base_url.$filename, 'I');

vs

$pdf->Output(self::$base_url.$filename, 'F');

like image 720
Gurnzbot Avatar asked Nov 20 '22 13:11

Gurnzbot


1 Answers

Turns out that the image supplied to me was sent as a .jpg, however the image was actually a .png. I guess TCPDF got confused and hence distorted the image.

I re-saved the image for web as .jpg using Photoshop and all is well.

Soooo.... the client is to blame ;) (For reals, because I was told to use the exact image given).

like image 156
Gurnzbot Avatar answered Dec 19 '22 01:12

Gurnzbot