简体   繁体   English

在PHP中串联PDF

[英]Concatenating PDFs in PHP

I've got a grip of PDFs that I need to combine into one using PHP. 我掌握了一些PDF,需要使用PHP合并成一个PDF。 Googling around gives me very little that seems like a reasonable solution. 谷歌搜索给我的东西很少,这似乎是一个合理的解决方案。 The best thing I can find is to use exec() and pdftk but that's just ugly. 我能找到的最好的东西是使用exec()pdftk,但这很丑陋。 Does anyone know of a more elegant solution that doesn't involve me shelling out all the money on the planet for some non-free lib? 有谁知道一个更优雅的解决方案,该解决方案不涉及我为一些非自由的lib而花掉地球上所有的钱吗?

Would FPDF AND FPDI work? FPDFFPDI是否可以工作?

http://www.setasign.de/products/pdf-php-solutions/fpdi/demos/concatenate-fake/ http://www.setasign.de/products/pdf-php-solutions/fpdi/demos/concatenate-fake/

Make sure you have FPDF 1.6. 确保您具有FPDF 1.6。 This is what I tested with. 这就是我测试过的。

Regards. 问候。

You could utilize a PHP/Java bridge to get access to iText . 您可以利用PHP / Java桥来访问iText

Actually, the homepage of the bridge component has an example with concatenation of PDFs . 实际上,bridge组件的主页上有一个包含PDF串联的示例。

Not sure if there is a pure PHP-based solution, because exec() is really not that ugly as you might think. 不知道是否有一个纯粹的基于PHP的解决方案,因为exec()确实不像您想象的那么丑陋。 As an alternative for pdftk you can use Ghostscript : 作为pdftk的替代方法,您可以使用Ghostscript

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=merged.pdf header.pdf example.pdf

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

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