pealo86 Posted December 1, 2010 Share Posted December 1, 2010 This is a bit of a long shot, but hopefully somebody can point me in the right direction. I have a wordpress website that has a 'Wine List' page, in which it lists over 100 'custom posts' detailing each wine. I have tried out several plugins to convert the wine list into a PDF but none work in the way that I require. So now I'm thinking to just do it outside of wordpress and find a PHP script that may help me. I imagine it would be impossible to simply execute a script at the bottom of a page for it to convert whatever HTML has been generated into a PDF? Or is there anything that would allow me to specify what records from the database to add to the PDF? E.g. for me to type a PHP script with a MySQL command and for that to be converted into a PDF? Thanks if anybody has any ideas what action I should take! Quote Link to comment https://forums.phpfreaks.com/topic/220360-convert-html-page-to-pdf/ Share on other sites More sharing options...
taquitosensei Posted December 1, 2010 Share Posted December 1, 2010 I've used this before http://code.google.com/p/dompdf/ but you'll want to run your html through a validator first. It's a little picky about compliance. Quote Link to comment https://forums.phpfreaks.com/topic/220360-convert-html-page-to-pdf/#findComment-1141847 Share on other sites More sharing options...
pealo86 Posted December 1, 2010 Author Share Posted December 1, 2010 Thanks I'll check that out Quote Link to comment https://forums.phpfreaks.com/topic/220360-convert-html-page-to-pdf/#findComment-1141858 Share on other sites More sharing options...
pealo86 Posted December 2, 2010 Author Share Posted December 2, 2010 Hmmm I'm a little stuck now. I've uploaded the relevant files and have added this code to the very top of my template: <?php if(is_page(235)) { require_once(TEMPLATEPATH . "/script/dompdf/dompdf_config.inc.php"); } ?> And this to the very bottom (going by the example code in the usage section): <?php if(is_page(235)) { require_once(TEMPLATEPATH . "/script/dompdf/dompdf_config.inc.php"); $dompdf = new DOMPDF(); $dompdf->load_html($html); $dompdf->render(); $dompdf->stream("sample.pdf"); } ?> However I cannot figure out how to actually view the PDF! If it's even being created that is. No error message is coming up (which I assume is a good thing?). I can also confirm that the two 'if' statements are evaluating to true from simply adding echo statements in to make sure. Does anyone know what I'm missing? Quote Link to comment https://forums.phpfreaks.com/topic/220360-convert-html-page-to-pdf/#findComment-1142235 Share on other sites More sharing options...
CarlB654 Posted January 7, 2011 Share Posted January 7, 2011 Sorry I'm so late to this discussion...have you tried something like DocRaptor.com? It's a web app that lets you convert html to pdf. There's a free plan that might work for what you want to do. Quote Link to comment https://forums.phpfreaks.com/topic/220360-convert-html-page-to-pdf/#findComment-1156063 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.