Hi,

Please help me out.How to add images in the PDF file using php?

I tried this coding :

<?php
               $pdf = PDF_new();
               PDF_open_file($pdf,'');
               PDF_begin_page($pdf,595,842);
               $image = PDF_load_image($pdf,"png","myimage.png","");
               PDF_place_image($pdf,$image,64,26,.24);
             ?>

But i am facing an error while running this code:

Fatal error: Uncaught exception 'PDFlibException' with message 'Handle parameter 'image'
has bad value 0' in C:\xampp\htdocs\pdf\pdf.php:39 Stack trace: #0 C:\xampp\htdocs\pdf\pdf.php(39): pdf_place_image() #1 {main} thrown in C:\xampp\htdocs\pdf\pdf.php on line 39

Thanks in advance.............

Check the order and necessity of the parameters for the $image = PDF_load_image($pdf,"png","myimage.png",""); set of code interacting to the PDF class.
Check the documentation.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.