hi,
i am trying to create a pdf using pdflib in php which includes some
text and an image. however, the part that loads the image seems to
keep failing. can someone help please?
the code:
<?php
$mypdf = PDF_new();
pdf_open_file($ mypdf, "this_is_it.pdf ");
pdf_begin_page( $mypdf, 595, 842);
$myfont = PDF_findfont($m ypdf, "Times-Roman", "host", 0);
pdf_setfont($my pdf, $myfont, 10);
pdf_show_xy($my pdf, "Sample PDF, constructed by PHP in real-time.",
50, 750);
pdf_show_xy($my pdf, "Made with the PDF libraries for PHP.", 50, 730);
$myimage = pdf_load_image( $mypdf,"jpeg"," test.jpg","");
pdf_fit_image($ mypdf, $myimage, 390,575, ""); //place image within
page coordinates
pdf_close_image ($mypdf, $myimage);
PDF_end_page($m ypdf);
PDF_close($mypd f);
PDF_delete($myp df);
?>
the error:
PHP Fatal error: Uncaught exception 'PDFlibExceptio n' with message
'Handle parameter 'image' has bad value 0' in C:\Inetpub\wwwr oot\files
\hello6.php:11 Stack trace: #0 C:\Inetpub\wwwr oot\files
\hello6.php(11) : pdf_place_image (Resource id #1, 0, 50, 650, 0.6) #1
{main} thrown in C:\Inetpub\wwwr oot\files\hello 6.php on line 11
thanks in advance for your help.
i am trying to create a pdf using pdflib in php which includes some
text and an image. however, the part that loads the image seems to
keep failing. can someone help please?
the code:
<?php
$mypdf = PDF_new();
pdf_open_file($ mypdf, "this_is_it.pdf ");
pdf_begin_page( $mypdf, 595, 842);
$myfont = PDF_findfont($m ypdf, "Times-Roman", "host", 0);
pdf_setfont($my pdf, $myfont, 10);
pdf_show_xy($my pdf, "Sample PDF, constructed by PHP in real-time.",
50, 750);
pdf_show_xy($my pdf, "Made with the PDF libraries for PHP.", 50, 730);
$myimage = pdf_load_image( $mypdf,"jpeg"," test.jpg","");
pdf_fit_image($ mypdf, $myimage, 390,575, ""); //place image within
page coordinates
pdf_close_image ($mypdf, $myimage);
PDF_end_page($m ypdf);
PDF_close($mypd f);
PDF_delete($myp df);
?>
the error:
PHP Fatal error: Uncaught exception 'PDFlibExceptio n' with message
'Handle parameter 'image' has bad value 0' in C:\Inetpub\wwwr oot\files
\hello6.php:11 Stack trace: #0 C:\Inetpub\wwwr oot\files
\hello6.php(11) : pdf_place_image (Resource id #1, 0, 50, 650, 0.6) #1
{main} thrown in C:\Inetpub\wwwr oot\files\hello 6.php on line 11
thanks in advance for your help.
Comment