PHP PDF helpp plss!
Posted: Sun Apr 13, 2008 12:16 am
I am hving problem with creating pdf file through php..someone pls help
on the attachment ( test. jpg ) is my screen shot of my error msg ..i dunno wats wrong with it ..
below is the code tat pdf creation tat i hv written :
<?php
$mypdf = PDF_new();
PDF_open_file($mypdf, "");
PDF_begin_page($mypdf, 595, 842);
$myfont = PDF_findfont($mypdf, "Times-Roman", "host", 0);
PDF_setfont($mypdf, $myfont, 10);
//PDF_show_xy($mypdf, "Sample PDF, constructed by PHP in real-time.", 50, 750);
//PDF_show_xy($mypdf, "Made with the PDF libraries for PHP.", 50, 730);
//PDF_show_xy($mypdf, "A JPEG image, on 60 % of its original size.", 50, 710);
//$myimage = PDF_open_image_file($mypdf, "jpeg", "trump.jpg");
$myimage = PDF_load_image($mypdf, "jpeg", "D:\Wamp5\www\project & references\pdftesting\test.jpg", "");
//PDF_place_image($mypdf, $myimage, 50, 650, 0.6);
PDF_fit_image($mypdf, $myimage, 0, 700, "boxsize {200 100} fitmethod meet");
PDF_end_page($mypdf);
PDF_close($mypdf);
$mybuf = PDF_get_buffer($mypdf);
$mylen = strlen($mybuf);
header("Content-type: application/pdf");
header("Content-Length: $mylen");
header("Content-Disposition: inline; filename=".$user.".pdf");
print $mybuf;
PDF_delete($mypdf);
?>
Help me i really dunno wat is wrong here..
Screen Shot :
on the attachment ( test. jpg ) is my screen shot of my error msg ..i dunno wats wrong with it ..
below is the code tat pdf creation tat i hv written :
<?php
$mypdf = PDF_new();
PDF_open_file($mypdf, "");
PDF_begin_page($mypdf, 595, 842);
$myfont = PDF_findfont($mypdf, "Times-Roman", "host", 0);
PDF_setfont($mypdf, $myfont, 10);
//PDF_show_xy($mypdf, "Sample PDF, constructed by PHP in real-time.", 50, 750);
//PDF_show_xy($mypdf, "Made with the PDF libraries for PHP.", 50, 730);
//PDF_show_xy($mypdf, "A JPEG image, on 60 % of its original size.", 50, 710);
//$myimage = PDF_open_image_file($mypdf, "jpeg", "trump.jpg");
$myimage = PDF_load_image($mypdf, "jpeg", "D:\Wamp5\www\project & references\pdftesting\test.jpg", "");
//PDF_place_image($mypdf, $myimage, 50, 650, 0.6);
PDF_fit_image($mypdf, $myimage, 0, 700, "boxsize {200 100} fitmethod meet");
PDF_end_page($mypdf);
PDF_close($mypdf);
$mybuf = PDF_get_buffer($mypdf);
$mylen = strlen($mybuf);
header("Content-type: application/pdf");
header("Content-Length: $mylen");
header("Content-Disposition: inline; filename=".$user.".pdf");
print $mybuf;
PDF_delete($mypdf);
?>
Help me i really dunno wat is wrong here..
Screen Shot :