How to create PDF documents from image files using PHP

With a PHP application, I have to generate individual PDF documents from a set of images.

What is the best way to achieve this? Can I use the TCPDF library, and can you give me an example?

+7
source share
4 answers

You can use this library . You can even convert html + css to pdf. It looks like some kind of browser engine written in PHP in this library. If you want something simpler, you can use this library

+4
source

The easiest way is to use TCPDF (http://www.tcpdf.org) and set the images as a full background, as in n. 51.

For example:

// disable auto-page-break $pdf->SetAutoPageBreak(false, 0); // set image 1 $pdf->AddPage(); $this->Image('image_demo1.jpg', 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0); $this->setPageMark(); // set image 2 $pdf->AddPage(); $this->Image('image_demo2.jpg', 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0); $this->setPageMark(); // ... 
+6
source

you can use dompdf . You can find a copy of the source documentation at this link.

+2
source

I don't know your requirements, but ImageMagick could probably do the trick. I believe that they also have a flash wrapper available for all image manipulation / transformation functions.

+1
source

All Articles