littlemiss Posted July 13, 2007 Share Posted July 13, 2007 Hey, I am very very very very bad at PHP and I am trying to improve. But anyway, I found a great script which turns a HTML page into a PDF, but the problem is it turns the whole page, with layout etc, into the pdf, which looks really bad with all the navigation etc, on it. I am trying to come up with a function to only include in the pdf the actual things I want, if you understand me. This is the original code: <?php require('html_to_pdf.inc.php'); $htmltopdf = new HTML_TO_PDF(); //$htmltopdf->useURL(HKC_USE_EASYW); // default HKC_USE_ABC other HKC_USE_EASYW $htmltopdf->saveFile("abc.pdf"); $htmltopdf->downloadFile("abc.pdf"); //$result = $htmltopdf->convertHTML("<b>MY TEST</b>"); $result = $htmltopdf->convertURL("$value"); if($result==false) echo $htmltopdf->error(); ?> and so far this is all i managed to work out myself, $beginingofcontent = "<!--top-->"; $finishofcontent = "<!--bottom-->"; LOL, i know i am bad, but I am not asking for someone to code it for me, I am just asking on someone to give me tips on how and where to look, any help would be really great. Thanks Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 13, 2007 Share Posted July 13, 2007 Are you trying to convert html pages with .html extension to pdf or are your trying to convert HTML pages that are created from php files? If you are converting php created html files then I would make the following suggestion: On all you pages have two possible style sheets, one for normal viewing and one for pdf creation that hides or changes the display of elements for a better printed output. Then create a switch using a $_GET variable on each page to determine which style sheet to use. Something like: if (isset($_GET['pdf']) && $_GET['pdf']==true) { $stylesheet = "pdfstyle.css"; } else { $stylesheet = "userstyle.css"; } Quote Link to comment Share on other sites More sharing options...
littlemiss Posted July 19, 2007 Author Share Posted July 19, 2007 Thanks for your help 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.