pdflib help adding an image



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($mypdf, "Times-Roman", "host", 0);
pdf_setfont($mypdf, $myfont, 10);
pdf_show_xy($mypdf, "Sample PDF, constructed by PHP in real-time.",
50, 750);
pdf_show_xy($mypdf, "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($mypdf);
PDF_close($mypdf);
PDF_delete($mypdf);
?>

the error:

PHP Fatal error: Uncaught exception 'PDFlibException' with message
'Handle parameter 'image' has bad value 0' in C:\Inetpub\wwwroot\files
\hello6.php:11 Stack trace: #0 C:\Inetpub\wwwroot\files
\hello6.php(11): pdf_place_image(Resource id #1, 0, 50, 650, 0.6) #1
{main} thrown in C:\Inetpub\wwwroot\files\hello6.php on line 11

thanks in advance for your help.

.



Relevant Pages

  • PDFlib not working with explorer based on PHP created file in memory
    ... I have a page that points to a PHP page that dynamically creates a pdf file ... toolkits (PDFlib) in use for creating well defined printable documents so I ... download via "chunks" instead of getting the length except he wrote ...
    (php.general)
  • Re: php and pdf
    ... I know that PDFlib is there and that most of the examples are for PHP4, ... The problem I have is that this is on a hosted server and they do not provide PDFlib as part of their PHP installation. ... Another question is if there is a good "HTML code to PDF file" module/library/function/class that could convert HTML format and produce a PDF file. ...
    (alt.html)
  • Re: php and pdf
    ... I know that PDFlib is there and that most of the examples are for PHP4, ... The problem I have is that this is on a hosted server and they do not provide PDFlib as part of their PHP installation. ... Another question is if there is a good "HTML code to PDF file" module/library/function/class that could convert HTML format and produce a PDF file. ...
    (comp.lang.php)
  • Re: php and pdf
    ... not provide PDFlib as part of their PHP installation. ... Another question is if there is a good "HTML code to PDF file" ...
    (comp.lang.php)
  • Re: php and pdf
    ... not provide PDFlib as part of their PHP installation. ... install PHP). ... Zend framework has PDF generation. ...
    (alt.html)