How to create PDF documents from image files, using PHP

有些话、适合烂在心里 提交于 2019-11-29 19:02:24

问题


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

Which is best way to achieve this? Can I use TCPDF library, and can you give me some example?


回答1:


The easiest way is to use TCPDF (http://www.tcpdf.org) and set the images as full background as on the example 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();

// ...



回答2:


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




回答3:


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



来源:https://stackoverflow.com/questions/6865651/how-to-create-pdf-documents-from-image-files-using-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!