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." <please.post.and.share@news.group.com> wrote in message
news:ocYtb.408747$9l5.251750@pd7tw2no...[color=blue]
> john wrote:[color=green]
> > Does anyone have any experience using pdf_open_pdi or any other the[/color][/color]
other[color=blue][color=green]
> > calls to open existing pdf files to edit them? I have searched high and[/color][/color]
low[color=blue][color=green]
> > and have found nothing but one generic example on every single website[/color][/color]
that[color=blue][color=green]
> > 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[/color][/color]
text[color=blue][color=green]
> > input fields on and was wondering if there is an easy way to enter text[/color][/color]
into[color=blue][color=green]
> > that box just feeding it the name of the input. If there is not, I can[/color][/color]
also[color=blue][color=green]
> > do it by pixel location. However, I cannot even get the pdf to load and
> > display to the screen. Any examples would be appreciated.
> >
> >[/color]
>
> 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...[/color]