Hello Coders, I am trying to generate the pdf file using php, I successfully generated the php file and then I tried to insert an image in the pdf file using php and got this error, I have the image and file in the same directory and don't know why the code is failing please help me.
Error:
Fatal error: Uncaught exception 'PDFlibException' with message 'Couldn't open JPEG file 'test.jpg' for reading (file not found)' in C:\xampplite\htdocs\score\scorepass\pdfgeneration.php:13 Stack trace: #0 C:\xampplite\htdocs\score\scorepass\pdfgeneration.php(13): pdf_open_image_file(Resource id #5, 'jpeg', 'test.jpg', '', 0) #1 {main} thrown in C:\xampplite\htdocs\score\scorepass\pdfgeneration.php on line 13
<?php
$pdf = pdf_new();
pdf_open_file($pdf,"c:\scorefm.pdf");
pdf_set_info($pdf, "Author", "Author");
pdf_set_info($pdf, "Title", "Title");
pdf_set_info($pdf, "Creator", "Author");
pdf_set_info($pdf, "Subject", "Coupoun");
pdf_begin_page($pdf, 504, 264);
$image = pdf_open_image_file($pdf, "jpeg", "test.jpg", "", 0);
pdf_place_image($pdf, $image, 504, 504, 1);
$font = pdf_load_font($pdf, "Courier","iso8859-1", "");
pdf_setfont($pdf, $font, 10);
pdf_end_page($pdf);
pdf_close($pdf);
?>
Please Please help me.