tags:

views:

78

answers:

3

I've got a grip of PDFs that I need to combine into one using PHP. 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. 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?

A: 

Would FPDF AND FPDI work?

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

Make sure you have FPDF 1.6. This is what I tested with.

Regards.

mediaslave
@neoneye do you have another solution that is PHP driven? pdftk is what I would call a reliable solution using PHP's exec() function.
mediaslave
A: 

You could utilize a PHP/Java bridge to get access to iText.

Actually, the homepage of the bridge component has an example with concatenation of PDFs.

Jørn Schou-Rode
A: 

Not sure if there is a pure PHP-based solution, because exec() is really not that ugly as you might think. As an alternative for pdftk you can use Ghostscript:

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