Re: PDF and FDF
| From: | Cesar Cordovez | Date: | Mon, 08 Sep 2003 19:49:49 +0000 |
| Subject: | Re: PDF and FDF | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-21329@lists.php.net to get a copy of this message | ||
Hi List,
Answering my own question... I found this user comment at php.net/pdf_open_file. As you can see is dated feb 2002 (kind of old) Is this still true? Does anyone knows gbl@bso2001.com?
Help! =)
Thanks.
Cesar
gbl at bso2001 dot com
19-Feb-2002 08:30
Appending to PDF files: plainly, you can't. PDF files have an internal structure that would get corrupted by just appending to the file. You'd need to parse the PDF, create a new PDF and mix your additions with the old PDF. Just creating a new one should be *much* easier.
Reading back the results: do a fopen() on the temporary file and use fgets() to read it. In your example where you just want to output the file, passthru should do the trick.
Cesar Cordovez wrote:
Hi List! I'm using the following code to open a pdf form, place a picture and then save it. This is very new for me, and the code is giving me some errors like (Fatal error: PDFlib error: Empty document in c:\Inetpub\wwwroot\pdf_forms\dbtree.php on line 415 ). Can somebody help? (line 415 is empty, line 414 is "pdf_close") TIA. Cesar // Begin ------------------ $pdf = pdf_new(); pdf_open_file($pdf); $pdi = pdf_open_pdi($pdf, $formfile, NULL, 0); $page= pdf_open_pdi_page($pdf, $pdi, 1, ""); // write the commands to place the image here. pdf_close_pdi_page($pdf, $page); // pdf_end_page($pdf); pdf_close($pdf); // end ------------------ $formfile is "c:/Inetpub/wwwroot/pdfforms/aform.pdf"