By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,953 Members | 1,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,953 IT Pros & Developers. It's quick & easy.

pdflib and pdi calls

P: n/a
Does anyone have any experience using pdf_open_pdi or any other the other
calls to open existing pdf files to edit them? I have searched high and low
and have found nothing but one generic example on every single website that
mentions it:

http://fooassociates.com/phpfer/html/rn46re926.html

This does not work for me at all either. I have a pdf that I created text
input fields on and was wondering if there is an easy way to enter text into
that box just feeding it the name of the input. If there is not, I can also
do it by pixel location. However, I cannot even get the pdf to load and
display to the screen. Any examples would be appreciated.
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
john wrote:
Does anyone have any experience using pdf_open_pdi or any other the other
calls to open existing pdf files to edit them? I have searched high and low
and have found nothing but one generic example on every single website that
mentions it:

http://fooassociates.com/phpfer/html/rn46re926.html

This does not work for me at all either. I have a pdf that I created text
input fields on and was wondering if there is an easy way to enter text into
that box just feeding it the name of the input. If there is not, I can also
do it by pixel location. However, I cannot even get the pdf to load and
display to the screen. Any examples would be appreciated.


I have dabbled in PDF files recently - I don't have the experience
though that I would think to solve this - But I was wondering, when you
say you cannot even get the pdf to load and display on the screen...
well... what errors are you getting? Sorry if this sounds condesending
(I think you are further ahead with PDF manipulation than I have got)
but perhaps getting the PDF to correctly display first then start
working on text input fields might help...

Also... fyi: I am pretty sure that when I read reference to creating PDF
files, that it is possible to create and lock them (ie prevent them from
ever being changed/re-edited). So... to avoid problems, I'd make sure
you were working on a PDF that you can edit first...

Best of luck though... I hope someone can better direct you...
Jul 17 '05 #2

P: n/a
This is the error:

[Mon Nov 17 17:03:42 2003] [error] PHP Fatal error: PDFlib error [1118]
PDF_get_pdi_value: Handle parameter 'page' has bad value 0 in
/usr/home/www/site/content/pdftest.php on line 18

Using this code:

<?

$pdf = PDF_new();
$B13A = "/home/www/site/content/Property_Fact_Sheet.pdf";
PDF_open_file($pdf, "");

PDF_set_info($pdf, "Creator", "tst.php");
PDF_set_info($pdf, "Author", "Transtec Online");
PDF_set_info($pdf, "Title", "Export Declaration");

if ($form = PDF_open_pdi($pdf, $B13A, '', 0))
echo "GOOD<BR>";
if ($page = PDF_open_pdi_page($pdf, $form, 1, ''))
echo "GOOD<BR>";
else echo "FAILED";

/* get the dimensions of the imported form */
$width = PDF_get_pdi_value($pdf, "width", $form, $page, 0);
$height = PDF_get_pdi_value($pdf, "height", $form, $page, 0);
//Create new page and place existing form on the page
PDF_begin_page($pdf, $width, $height);
PDF_place_pdi_page($pdf, $page, 0, 0, 1, 1);
PDF_close_pdi_page($pdf, $page);
//Write data to the form
PDF_set_text_pos($pdf, 70, 486);

PDF_show($pdf, "Hello");

PDF_end_page($pdf);
PDF_close($pdf);
PDF_close_pdi($pdf, $form);

$buf = PDF_get_buffer($pdf);
$len = strlen($buf);

header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=B13A.pdf");
print $buf;

PDF_delete($pdf);
?>
The end result is it printing:

GOOD
FAILED

The pdf exists and was created with acrobat 6. Thanks
"Randell D." <pl*******************@news.group.com> wrote in message
news:ocYtb.408747$9l5.251750@pd7tw2no...
john wrote:
Does anyone have any experience using pdf_open_pdi or any other the other calls to open existing pdf files to edit them? I have searched high and low and have found nothing but one generic example on every single website that mentions it:

http://fooassociates.com/phpfer/html/rn46re926.html

This does not work for me at all either. I have a pdf that I created text input fields on and was wondering if there is an easy way to enter text into that box just feeding it the name of the input. If there is not, I can also do it by pixel location. However, I cannot even get the pdf to load and
display to the screen. Any examples would be appreciated.


I have dabbled in PDF files recently - I don't have the experience
though that I would think to solve this - But I was wondering, when you
say you cannot even get the pdf to load and display on the screen...
well... what errors are you getting? Sorry if this sounds condesending
(I think you are further ahead with PDF manipulation than I have got)
but perhaps getting the PDF to correctly display first then start
working on text input fields might help...

Also... fyi: I am pretty sure that when I read reference to creating PDF
files, that it is possible to create and lock them (ie prevent them from
ever being changed/re-edited). So... to avoid problems, I'd make sure
you were working on a PDF that you can edit first...

Best of luck though... I hope someone can better direct you...

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.