如何使用PHP从图像文件创建PDF文档 [英] How to create PDF documents from image files, using PHP

查看:75
本文介绍了如何使用PHP从图像文件创建PDF文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用PHP应用程序,我必须从一组图像生成单个PDF文档.

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

哪个是实现此目标的最佳方法?我可以使用TCPDF库吗,可以举个例子吗?

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

推荐答案

最简单的方法是使用TCPDF(http://www.tcpdf.org)并将图像设置为完整的背景,如示例n所示. 51.

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

例如:

// 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();

// ...

这篇关于如何使用PHP从图像文件创建PDF文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆