Home   Best Sellers   Blogging   Coding & Design   Technology   SEO   Travel & living   Career   Videos   Tips   Calculators     
Home  »     »     »     »  PDF generation in PHP

PDF generation in PHP

Friday, May 28, 2010

There are several ways to generate PDF files using PHP

OPTION #1

One of the most adorable features of PHP 4 is the PDFLib extension, which allows you to dynamically construct PDF documents in Adobe Portable Document Format. For this you must have the PDFLib library installed on your system. If you're working on Linux, you can download a copy from http://www.pdflib.com/ and compile it for your box.

If you're running Windows,a pre-built PDF library is bundled with your distribution, and all you need to do is activate it by uncommenting the appropriate lines in your PHP configuration file.

In addition to this a PDF viewer application like Adobe PDf reader must be installed in your machiine to view the PDF file.

More on PHPLib Extension



OPTION #2
Another option is to use the PDF genertion Class files available as opensources.

Example:

1. FPDF
2. TCPDF
3. MPDF




FPDF CLASS

FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say without using the PDFlib library. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.

FPDF has other advantages: high level functions. Here is a list of its main features:

* Choice of measure unit, page format and margins
* Page header and footer management
* Automatic page break
* Automatic line break and text justification
* Image support (JPEG, PNG and GIF)
* Colors
* Links
* TrueType, Type1 and encoding support
* Page compression

Some disadvantages is fpdf is less flexible in handling styles and HTMLs.
Website : FPDF CLASS



|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||



TCPDF CLASS

TCPDF is an Open Source PHP class for generating PDF documents.
TCPDF project was started in 2002 and now it is freely used all over the world by millions of people. TCPDF is a Free Libre Open Source Software (FLOSS).

An Advanced version of FPDF. FPDF class is modified to make it more flexible to handle in TCPDF.
This class has some limitations in handling some of the style and style sheet inclusions, but still user friendly class.

Main Features:

* no external libraries are required for the basic functions;
* all ISO page formats, custom page formats, custom margins and units of measure;
* UTF-8 Unicode and Right-To-Left languages;
* TrueTypeUnicode, OpenTypeUnicode, TrueType, OpenType, Type1 and CID-0 fonts;
* methods to publish some XHTML + CSS code, Javascript and Forms;
* images, graphic (geometric figures) and transformation methods;
* native support for JPEG, PNG and SVG images;
* 1D and 2D barcodes: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index - Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS, QR-Code;
* Grayscale, RGB, CMYK, Spot Colors and Transparencies;
* automatic page header and footer management;
* document encryption and digital signature certifications;
* transactions to UNDO commands;
* PDF annotations, including links, text and file attachments;
* text rendering modes (fill, stroke and clipping);
* multiple columns mode;
* bookmarks and table of content;
* text hyphenation;
* automatic page break, line break and text alignments including justification;
* automatic page numbering and page groups;
* move and delete pages;
* page compression.

Website : TCPDF CLASS



|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||



MPDF CLASS

This can be considered as on of the best classes for PDF generation. mPDF is a PHP class which generates PDF files from UTF-8 encoded HTML. It is based on FPDF, HTML2FPDF, and UFPDF, with a number of enhancements.

Click Here for Features

Website : MPDF CLASS



How to link to this page?
If you wish to link to this page from your website, simply Copy and paste the above HTML code to your web page. It will appear on your page as:
PDF generation in PHP.




Share this!




comments powered by Disqus

This Weeks 7 Popular Posts


Subscribe to Recent Posts by Email
Stay connected to CROZOOM with regular Email notices of new Techie articles and IT Jobs. Updates will be delivered to your Inbox as soon as they are posted online.

Enter Your Email Address:  

Delivered by FeedBurner   RSS Feed

Search this Blog   



Urgent Openings for PHP trainees, Andriod / IOS developers and PHP developers in Kochi Trivandrum Calicut and Bangalore. Please Send Your updated resumes to recruit.vo@gmail.com   Read more »