ayan.lee Posted March 14, 2011 Share Posted March 14, 2011 i am trying to create a sample report using pdf file...everytime i run my code...there is no error...but when i click the submit button...the pdf file won't appear...instead the window will display...."failed to load pdf document"...is there something with my code...or do i need to upgrade my pdf reader....please help me... :)here is my code: ----index.php--- <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>PDF Example #1 - Picture Title & Description</title> <style type="text/css"> <!-- #apDiv1 { position:absolute; width:304px; height:48px; z-index:1; left: 268px; top: 40px; } #apDiv2 { position:absolute; width:220px; height:29px; z-index:1; left: 23px; top: 41px; } #apDiv3 { position:absolute; width:131px; height:26px; z-index:2; left: 637px; top: 33px; } #Layer1 { position:absolute; width:344px; height:257px; z-index:1; left: 437px; top: 101px; } body,td,th { font-family: Verdana; font-size: 14px; } .style1 { font-size: 24px; font-weight: bold; } --> </style> </head> <body> <form action="create.php" method="post" enctype="multipart/form-data"> <p align="center" class="style1">Join the fun! Add a title and description for this picture! </p> <p align="left">#1) Title <br /> <label> <input name="header" type="text" style="height:30px; font-size:28px; font:Helvetica,Verdana;" id="header" /> </label> </p> <p align="left">#2) Add Description </p> <p align="left"> <textarea name="body" cols="45" rows="15"></textarea> </p> <div id="Layer1"><img src="yellow_rock.gifs" width="346" height="262" /></div> <p align="left">#3) Click Button </p> <p align="left"> <input name="input" type="submit" value="Create PDF" /> </p> <p align="left"> </p> <p> </p> </form> </body> </html> ---create.php--- <?php $header =$_POST['header']; $body =$_POST['body']; include ('class.ezpdf.php'); $pdf =& new Cezpdf(); $pdf->addJpegFromFile('jawbone.jpg',199,$pdf->y-200,200,0); $pdf->selectFont('./fonts/Helvetica.afm'); $pdf->ezText($header . "\n\n",25,array('justification'=>'centre')); $pdf->ezText("\n\n\n\n\n\n\n" . $body,16,array('justification'=>'centre')); $pdf->output(); $pdf->ezStream(); ?> tanx.. Quote Link to comment https://forums.phpfreaks.com/topic/230582-please-help-me/ Share on other sites More sharing options...
RussellReal Posted March 14, 2011 Share Posted March 14, 2011 This will probably be moved to Other Libraries and Frameworks. the reason being, nobody knows what is in the included file.. also even if we did see it, nobody would want to review a whole class of working code, to understand why your 10 lines of broken code doesn't work, they'll be able to help you better there, sorry we can't help you in this category .. I can however, offer you some advice, try forcing a text content-type.. Try error handling. If your page has an error it will usually show you the error, but when you're not in a plain text content-type, you usually can't see the error messages Quote Link to comment https://forums.phpfreaks.com/topic/230582-please-help-me/#findComment-1187311 Share on other sites More sharing options...
ayan.lee Posted March 14, 2011 Author Share Posted March 14, 2011 hhmmmm...ok....i'll try error handling...im a newbie to PHP... anyway...tanx for the help.. Quote Link to comment https://forums.phpfreaks.com/topic/230582-please-help-me/#findComment-1187367 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.