views:

232

answers:

1

I want to generate multiple pdf reports on click of single print button and zip all the pdf's and store it in a folder.

Any help please. I need this functionality in my project.

A: 

According to http://stackoverflow.com/questions/560583/which-is-the-best-pdf-library-for-php , the best pdf php library is FPDF.

They also mention that Zend has a nice PDF Lib. If you are using CodeIgniter you may wish to use the Zend library, as Zend libraries work nicely inside of CodeIgniter. (A simple Google search will show up several tutorials on using Zend libs as CI libs).

Someone on the CI Forums has instructions on using FPDF with CodeIgniter: http://codeigniter.com/forums/viewthread/45365/

As for the second part of your question, wrapping data in a zip file is easily done with with CodeIgniter Zip Encoding library as detailed in the user guide.

Natebot
Actually i am using dompdf for PDF generation. But on click of a button i need to generate multiple pdf without user's knowledge and create as a zip and show the zip file as the save as or open dialog .
ASD
DOMPDF::output() outputs your pdf as string, which you can pass to Zip::add_data()Please read the CI docs on the Zip class and the DOMPDF Usage page. I would suggest considering writing the pdf to disk and then operating on it with the Zip class. Future requests need not use DOMPDF, but serve the cached zip file up directly. Manage your cache with cron.
Natebot
To clarify - The CodeIgniter Zip class allows you multiple calls to add_data() in order to add several files to your archive.And you should access the dompdf class directly in your controller. See the section "Using the dompdf class directly" on http://www.digitaljunkies.ca/dompdf/usage.php#class
Natebot
Its working great. Thanks a ton.
ASD