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); Quote Link to comment 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.) Quote Link to comment 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)); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.