views:

1045

answers:

6

I'm looking for a PHP library that will allow me to create a print-ready PDF. The imposition should include 1-up, 4-up, 24-up, etc. layouts, and crop marks.

FPDF, TCPDF and PHP's included PDF libraries allow me to create an image and plop it on a PDF, but the more advanced layouts and crop marks are a bit beyond me.

Thanks in advance!

+1  A: 

http://www.pdflib.com/download/

Here is a library you didn't mention that will allow the creation of PDFs using php. Hope it's sufficient.

cazlab
A: 

I've had a lot of success with PDFLib it's a very powerful library with PHP (and C, C#, Perl etc) bindings.

Mark Nold
A: 

FPDF has always worked out for me. There is a lot of robust functionality in there, and you just gotta keep at it to find it.

The ImageEPS class extension is VERY useful for making things print ready, though it is not without its issues (as its a rather old extension and doesn't support .ai and .eps files very well, save as backwards compatible as you can.)

You can use the drawing features to generate crop marks.

Header and footer set up is a bit counter-intuitive but it works. (http://www.fpdf.org/en/tutorial/tuto2.htm)

The orientation of the pages and the sizing are pretty easy to set.(http://www.fpdf.org/en/doc/fpdf.htm)

Multicell is a VERY useful function for dynamically generated content, though there is no way of handling overflow built it. You'll have to have some way of doing character counts and passing the data into blocks for complex layouts.

I believe there is an extension in the forums for pagination. (http://www.fpdf.org/en/script/script86.php)

plus I'm a cheapskate :)

Joshua Chavanne
+3  A: 

We used DOMPDF http://www.digitaljunkies.ca/dompdf/ successfully - just define what you want printed in regular HTML format, then pass the doc to DOMPDF, and it'll create a PDF from it.

Much more convenient than working with vector-based solutions that require you to essentially lay things out yourself on the page (like FPDF). Use HTML for layout! It's much easier.

Alex
+2  A: 

I'd highly recommend DOMPDF or PDFLib as others have mentioned.

DOMPDF supports XHTML and CSS2.1 and will allow you to render a PDF page from HTML.

PDFlib+PDI will allow you to merge PDF documents or append pages, place images, text, etc.

kRON
A: 

phpLiveDocx does exactly what you want. It is dead easy to use and allows you to populate templates created in a word processor with data in PHP. Learn more at http://www.phplivedocx.org/articles/brief-introduction-to-phplivedocx/