首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将pdf打印为pdf内的图像

将pdf打印为pdf内的图像
EN

Stack Overflow用户
提问于 2014-05-30 06:22:39
回答 1查看 90关注 0票数 0

我正在创建一个web应用程序,并使用php FPDF脚本创建并打印出一个pdf。这也会在上传到应用程序的pdf图像上打印出来,这是没有问题的。然而,它需要为上传的pdf做同样的事情,这就是我的问题所在。如何使用fpdf将pdf打印为pdf内的图像?

我听说过imageMagick,但我不认为这是一个选择,因为它是一个软件,我不知道我应该在哪里运行它。

EN

回答 1

Stack Overflow用户

发布于 2014-06-02 14:38:56

您可以使用FPDI导入现有PDF文档的页面,并将其与FPDF一起放到新创建的页面上:

代码语言:javascript
复制
<?php
require_once('fpdf.php');
require_once('fpdi.php');

$pdf = new FPDI();

// load the document and get the total page count
$pageCount = $pdf->setSourceFile("the/document/you/want/to/import/a/page/from.pdf");
// import the first page
$tplIdx = $pdf->importPage(1);

// add a page
$pdf->AddPage();
// use the imported page on x=10, y=10 and a width of 90
$pdf->useTemplate($tplIdx, 10, 10, 90);
// output the PDF document
$pdf->Output();
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23944010

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档