开发者

Add 1 Page to each PDF in folder

开发者 https://www.devze.com 2022-12-23 00:46 出处:网络
I have a folder with 100s of PDF versions of PPT presentations.I also have a one page PDF file that I want to add to the beginning of each PD开发者_高级运维F file.Is there a way I can do this with PHP

I have a folder with 100s of PDF versions of PPT presentations. I also have a one page PDF file that I want to add to the beginning of each PD开发者_高级运维F file. Is there a way I can do this with PHP? Could I maybe use the Zend Framework?


It certainly can be done by 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号