Jump to content
Larry Ullman's Book Forums

Bonus Chapter On Creating Pdfs-Pdf_Invoice3.Php Giving Me An Error


Recommended Posts

Hello all i am using PDFlib GmbH Version 7.0.4p4. When i run the scrip pdf_invoice3.php, i get the error: "A pdflib exception occured:Handle parameter or option of type 'image' has bad value 0".

 

Does anyone understand what that means and how to correct it?

 

Php version 5.3.1

Mysql version 5.1.41

xammp 1.7.3

windows OS

Link to comment
Share on other sites

Is there a line number associated with the error?

 

Larry,

 

Thanks for the reply. There is no line number associated with the error. This is strange to me. The new thing introduced is the image so i believe will be a problem with either the fit_image function or the load_image function.

Link to comment
Share on other sites

Hello all,

 

I solved the problem by doing two (2) things:

 

1. Although, i had "logo.png" in the same directory as the script "pdf_invoice3.php", i got results by providing the full path:

so change $image=$pdf->load_mage('auto','logo.png',NULL); to

 

$image=$pdf->load_mage('auto','/path/logo.png',NULL); eg $image=$pdf->load_mage('auto','D:/xampp/htdocs/advance/bonus/logo.png',NULL);

 

2. Change the argument in the fit image function by deleting the first "0.0":

so change $pdf->fit_image(0.0,$image,(INCH/2),(PAGE_HEIGHT-(INCH/2)-$h),"scale $scale"); to

$pdf->fit_image($image,(INCH/2),(PAGE_HEIGHT-(INCH/2)-$h),"scale $scale");

 

Hope this helps someone.

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...