teynon Posted May 23, 2009 Share Posted May 23, 2009 I am making a system that will write to a pdf file. I can't get it to apply images. It adds text fine. Error: Fatal error: Uncaught exception 'PDFlibException' with message 'Handle parameter 'image' has bad value 0' in C:\wamp\www\arms\pdf_test.php:11 Stack trace: #0 C:\wamp\www\arms\pdf_test.php(11): pdf_place_image(Resource id #2, 0, 50, 650, 1) #1 {main} thrown in C:\wamp\www\arms\pdf_test.php on line 11 $myimage = PDF_open_image_file($mypdf, "jpeg", $_SERVER['DOCUMENT_ROOT'] . "2062.jpg", "", 0); PDF_place_image($mypdf, $myimage, 50, 650, 1); Link to comment https://forums.phpfreaks.com/topic/159408-solved-pdf_open_image_file-pdf-add-image/ Share on other sites More sharing options...
teynon Posted May 23, 2009 Author Share Posted May 23, 2009 Also: This is on a WAMP system. That system is not variable. (Meaning it must run on a windows machine.) Link to comment https://forums.phpfreaks.com/topic/159408-solved-pdf_open_image_file-pdf-add-image/#findComment-840856 Share on other sites More sharing options...
teynon Posted May 23, 2009 Author Share Posted May 23, 2009 That was easy... Directory was wrong. Code is fine. $myimage = PDF_open_image_file($mypdf, "jpeg", $_SERVER['DOCUMENT_ROOT'] . "arms/2062.jpg", "", 0); Tip though (How I figured it out easier): if ($myimage==0) { die(PDF_get_errmsg($mypdf)); } Link to comment https://forums.phpfreaks.com/topic/159408-solved-pdf_open_image_file-pdf-add-image/#findComment-840859 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.