Search code examples
phpcodeigniterezpdf

Image not appearing using codeigniter and cezpdf


I built a PDF using Cezpdf and codeigniter in PHP. I have been asked to change the image in the PDF. I uploaded the new image, added it to my code, but nothing appears on the page. I do not get any errors either.

Here is my code:

       $pdfobj->selectFont('./fonts/Helvetica.afm');
       $pdfobj->addPngFromFile(FCPATH . 'img/logo.png', 20, 770, 180, 60);
       $pdfobj->ezSetDy(8);

With the old image, my code was exactly the same but the logo.png was orig-logo.png.

I've checked the path of the file and the x and y coordinates and the sizing and don't get any error messages, just a PDF without an image. Can anyone help?


Solution

  • The image size is 37 KB, which (surprisingly) is too large for the ezPdf. After resizing, everything works great.