简体   繁体   English

将1页添加到文件夹中的每个PDF

[英]Add 1 Page to each PDF in folder

I have a folder with 100s of PDF versions of PPT presentations. 我有一个文件夹,其中包含100多个PPT演示文稿的PDF版本。 I also have a one page PDF file that I want to add to the beginning of each PDF file. 我还有一页PDF文件,我想添加到每个PDF文件的开头。 Is there a way I can do this with PHP? 有没有办法可以用PHP做到这一点? Could I maybe use the Zend Framework? 我可以使用Zend框架吗?

It certainly can be done by Zend_Framework! Zend_Framework当然可以做到!

$pdf = Zend_Pdf::load($fileName);
$frontPdf = Zend_Pdf::load('/path/to/template.pdf');

$frontPage = $frontPdf->pages[0];

//prepend our template front page to PDF
array_unshift($pdf->pages, $frontPage);

//update original document
$pdf->save($fileName, true);

I haven't tested the code here but we have an application working on the same principle. 我没有在这里测试代码,但是我们有一个应用程序在相同的原理上工作。

Check the documentation for pages within Zend_Pdf if you have any problems. 如果有任何问题,请查看Zend_Pdf中的页面文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM