PHP and PDFs

Programming for Search Engines 101. An area for avid PHP and .NET developers to chat about Programming techniques and how to make better use of search engines.

Moderator: Moderators

PHP and PDFs

Postby Mike » Wed Sep 02, 2009 11:45 am

Wasn't all that long ago that using PHP to generate and manipulate PDFs was a painful, gruesome process. Installing either of the 2 PDF extensions into PHP was a complete nightmare.

A couple of years ago I discovered FPDF.



I'm using it for automated invoice generation for the small amount of freelance stuff I do. It took a little work to get the blank invoice tweaked just right, but I've printed off the PDF generated by this tool and a real invoice I create in Quickbooks, and there is no way to tell the difference, they are identical in every way.

Has anyone else tried this tool?

Mike
Mike
 

Re: PHP and PDFs

Postby douglas » Thu Sep 03, 2009 4:13 am

I have tried FPDF and chnaged to TCPDF because of lack of funtionality available in FPDF. I suggest to use TCPDF because it is much more powerful of FPDF, Well structured class and less buggy.

Some of the powerful features of TCPDF that are not included on FPDF are:

•Source code full documented.
•PHP5 class and PHP4 alternative.
•support for UTF-8 Unicode and Right-To-Left languages (including a bidirectional algorithm).
•includes support for backward editing (edit a previous page).
•support for document encryption;
•methods to publish some (x)HTML code including complex tables;
•a large number of graphic (geometric) and transformation functions;
•PDF bookmarks;
•Javascript and forms support (you can also save the forms content);
•supports user rights management so Adobe Reader users can save filled-in copies of forms they complete.
•method to render various barcode formats directly on PDF.
•support for TrueTypeUnicode, OpenTypeUnicode, TrueType, OpenType, Type1 and CID-0 fonts.
•supports custom page formats, margins and units of measure.
•includes methods for page header and footer that could be easily overwritten.
•supports page groups.
•supports clipping masks and stroke and clipping mode for text.
•supports CMYK, Spot Colors and transparency (in addition to Grayscale and RGB modes).
•supports links and annotations.

I didn't tried all features but created well formatted invoice with images.
Following is one of the sample report that i have created using TCPDF class.
milkbill.png
milkbill.png (65.77 KiB) Viewed 5273 times
douglas
 
Posts: 282
Joined: Fri Feb 20, 2009 3:56 am

Re: PHP and PDFs

Postby Mike » Thu Sep 03, 2009 8:05 am



Looks very nice, I'll give this a spin on the weekend.
Thanks for the info Sir.

Mike
Mike
 


Return to Programming

Who is online

Users browsing this forum: No registered users and 7 guests