|
Re: Printing And Really Big PDF's: msg#00267php.tcphp
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Mark Courtney wrote: > Hey Listers > > I'm trying to create a pdf that could potentially contain up to 150+ jpg > images of about 300Kb in size. I've been using fpdf, but it seems to die > when it tries to handle that many images. > > http://www.fpdf.org > > After digging into the fpdf code, I've found that it creates a buffer > containing the entire pdf, then presents the pdf inline to the browser, as > a local file on the Web server, or returns the binary pdf data to a php > script. This buffer creation seems to be where the script dies - probably > because it take a ton of memory to do this since all 150+ images are in > memory at once. > > The environment is IIS on Windows and PHP 5. > > The ultimate goal here is to be able to print these 150+ in one print job. > Seems easy enough, right? 8-) I've looked into printing directly from > the Web server too, but that doesn't seem to save any memory. > > Can anybody on the list throw a clue at me and/or give me an idea of how > to print a job that can potentially contain 150+ pdf's? I know this whole > thing seems pretty tricky, but this is what the customer wants... May not be really efficient, but I would first try creating multiple pdf files (as large as you can) using FPDI (http://fpdi.setasign.de/) Store the file names into an array as you are doing this, then try something like: require('fpdi.php'); class concat_pdf extends fpdi { var $files = array(); function concat_pdf($orientation='P',$unit='mm',$format='A4') { parent::fpdi($orientation,$unit,$format); } function set_files($files) { $this->files = $files; } function concat() { foreach($this->files AS $file) { $pagecount = $this->setSourceFile($file); for ($i = 1; $i <= $pagecount; $i++) { $tplidx = $this->ImportPage($i); $this->AddPage(); $this->useTemplate($tplidx); } } } } $pdf= new concat_pdf(); $pdf->set_files($file_list); $pdf->concat(); $pdf->Output($outputname,'I'); - -- Justin Koivisto, ZCE - justin-72EOUSqB708AvxtiuMwx3w@xxxxxxxxxxxxxxxx http://koivi.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD4DBQFCwEhQm2SxQ7JEbpoRAoCRAJwPaZLjb1ijl3nFWionphGBWapc7gCY830a qAOSmzxFZ3TNWI4EnPAsoQ== =OXPw -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx Please read and follow the list guidelines: http://www.tcphp.org/mailing_list/guidelines The tcphp.org mailing list is sponsored by pajunas interactive, inc. |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Strange mail() behaviors: 00267, Ryan Coleman |
|---|---|
| Next by Date: | Re: Printing And Really Big PDF's: 00267, Justin Koivisto |
| Previous by Thread: | Re: Printing And Really Big PDF'si: 00267, Jenifer |
| Next by Thread: | Re: Printing And Really Big PDF's: 00267, Justin Koivisto |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |