0

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.............

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.

2
Contributors
1
Reply
3
Views
7 Years
Discussion Span
Last Post by codejoust
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.