TCPDF inline vs image preservation

I am creating PDF files with TCPDF. I have a test script that generates an embedded pdf, as well as a script that saves the PDF file to the server and then sends it via email.

PDF files saved in a file have extremely poor image quality on some images. You can see it below:

Bad image

The PDF files shown inline (in the browser) have excellent image quality: Good image

Does anyone know why there will be a difference between the two? The same code just saved in accordance with the documentation:

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

vs

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

+5
source share
2 answers

It turns out that the image provided to me was sent as .jpg, however the image was actually .png. I think TCPDF is confused and therefore distorted the image.

I saved the image for the web again as .jpg using Photoshop, and all is well.

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

0
source

Use "I" to open the PDF in the browser, and "F" to save it as a file.

-1
source

Source: https://habr.com/ru/post/1259233/


All Articles