[RESOLVED] Mulitiple PDF's with fpdf lib and CI in one controller. |
[eluser]Sheldon[/eluser]
Hi, I am using CI and FPDF with FPDFI, http://www.fpdfi.org I have it set up and working pretty well, and have been using theses to generate a lot of PDF's in the last couple of years, but now I have a different issue, I am trying to generate a bunch of separate PDF's inside a for loop. The Basic's of my controller are; Code: <?php This script run's and emails each record as expected, but it is concatinating my PDF's in to one PDF, EG; 1st loop, correct single page PDF, 2nd loop, 1st page is the previous record, second is a blank PDF page ? 15th record, as the first PDF correct, and a random amount of blank pages. My PDF View generates a single PDF fine, I have tried to reset thte PDF buffer after my output; Code: $this->pdf->Output($filename, 'F'); My CI PDF library includes the fpdfi library like so; Code: <?php
[eluser]Aken[/eluser]
I haven't played around with FPDF in a while, but I'm pretty certain you'll either need to delete the PDF file that's generated before creating a new one with the same name, or you'll need to use a different name for each PDF file created.
[eluser]Sheldon[/eluser]
[quote author="Aken" date="1261386346"]I haven't played around with FPDF in a while, but I'm pretty certain you'll either need to delete the PDF file that's generated before creating a new one with the same name, or you'll need to use a different name for each PDF file created.[/quote] Thanks Aken, Sorry that was an error in my post, In this instance, the filename is generated by the mySQL auto incrementing ID, and a rand md5() has in the file name, is is never the same.
[eluser]Sheldon[/eluser]
Here is the working code, CI is great for including a sinlge library instance, but there is no way ( That I know of ) to unset a library. Code: <?php
[eluser]noviceCODER[/eluser]
Quote:Hi, hi i have problem setting up fpdf, can u please help me?? thanks in advance |
Welcome Guest, Not a member yet? Register Sign In |