ABPAM Posted April 26, 2009 Share Posted April 26, 2009 Hi, Two weeks ago I started to search HTML -> PDF Converter in PHP. I found FPDF and, which's very good, and now I'm really close to success, but i need a function which return a compiled HTML code. Here's my code: <?php include("create_text_html.php"); //Create products_mysql.html. Dont watch this it's ok define('FPDF_FONTPATH','font/'); //In the whole internet this define is required to work the class fine require('fpdf.php'); //Dont have to explain this $pdf=new FPDF(); //This too $pdf->AddFont('Verdana','','verdana.php'); //This is a function in the class and I need to add it if i want to use definite font (In my case a cyrillic Verdana) $pdf->AddPage(); //Starts creation of new PDF doc $pdf->SetFont('Verdana','',15); //Sets the font mationed up $file_name = !!!ATTENTION!!!"products_mysql.html"; //A little explaining in next rows $pdf->Cell(0,10,$file_name); //This Writes the variable $pdf->Output('test.pdf', 'F'); //And this saves the PDF ?> OK. Everything works fine except the !!!ATTENTION!!! row. My Q is which PHP function to use to return a compiled, executed(or something like this) html file. I try with file_get contents(), but nothing. In PDF it wrote this: http://img12.imageshack.us/img12/3962/28079502.png With file() it wrote Array(like text) I dont know which function to use. Plese help me. Thank u in advance. Quote Link to comment https://forums.phpfreaks.com/topic/155700-return-compiledor-something-html-code/ Share on other sites More sharing options...
Mchl Posted April 26, 2009 Share Posted April 26, 2009 What do you mean by 'compiled' HTML? What you have in the picture is HTML. Quote Link to comment https://forums.phpfreaks.com/topic/155700-return-compiledor-something-html-code/#findComment-819531 Share on other sites More sharing options...
thebadbad Posted April 26, 2009 Share Posted April 26, 2009 FPDF can't render HTML. Found this for you: http://www.macronimous.com/resources/Converting_HTML2PDF_using_PHP.asp Quote Link to comment https://forums.phpfreaks.com/topic/155700-return-compiledor-something-html-code/#findComment-819533 Share on other sites More sharing options...
Mchl Posted April 26, 2009 Share Posted April 26, 2009 FPDF can't render HTML. ORLY? http://www.fpdf.org/en/script/script41.php http://www.fpdf.org/en/script/script42.php Quote Link to comment https://forums.phpfreaks.com/topic/155700-return-compiledor-something-html-code/#findComment-819535 Share on other sites More sharing options...
ABPAM Posted April 26, 2009 Author Share Posted April 26, 2009 1-st By Compiled I mean executed. I have a html file and when i file_get_contents() it, in PDF is written text(<html><head... like on the pic). I need a function which returns me a content of this HTML like in browser. I hope u understood me 2-nd Im sure that FPDF renders HTML, because i saw it but in latin. Function WriteHTML writes HTML only in latin. I need a cyrillic Quote Link to comment https://forums.phpfreaks.com/topic/155700-return-compiledor-something-html-code/#findComment-819537 Share on other sites More sharing options...
thebadbad Posted April 26, 2009 Share Posted April 26, 2009 FPDF can't render HTML. ORLY? http://www.fpdf.org/en/script/script41.php http://www.fpdf.org/en/script/script42.php Damn you, you're not supposed to look more into it than me! But those scripts are actually extensions, right? So in a strict sense I was right. ORLY? Yes, really. Quote Link to comment https://forums.phpfreaks.com/topic/155700-return-compiledor-something-html-code/#findComment-819538 Share on other sites More sharing options...
Mchl Posted April 26, 2009 Share Posted April 26, 2009 Bad luck for you. I actually use (U)FPDF in my everyday's work. Will you say that PHP cannot work with MySQL? It needs extension for that. Quote Link to comment https://forums.phpfreaks.com/topic/155700-return-compiledor-something-html-code/#findComment-819544 Share on other sites More sharing options...
thebadbad Posted April 26, 2009 Share Posted April 26, 2009 No, I consider the MySQL functionality built-in, since it's bundled with PHP. Quote Link to comment https://forums.phpfreaks.com/topic/155700-return-compiledor-something-html-code/#findComment-819547 Share on other sites More sharing options...
Mchl Posted April 26, 2009 Share Posted April 26, 2009 I wonder why so many people have problems enabling it then Quote Link to comment https://forums.phpfreaks.com/topic/155700-return-compiledor-something-html-code/#findComment-819548 Share on other sites More sharing options...
ABPAM Posted April 26, 2009 Author Share Posted April 26, 2009 So... which PHP function i have to use...? Quote Link to comment https://forums.phpfreaks.com/topic/155700-return-compiledor-something-html-code/#findComment-819557 Share on other sites More sharing options...
thebadbad Posted April 26, 2009 Share Posted April 26, 2009 I wonder why so many people have problems enabling it then Noobs. It's there. @ ABPAM You will have to rely on whatever custom functions you can find that parses HTML into PDF content. A Google search shows quite a few alternatives to FPDF: http://www.google.com/search?hl=en&q=html+2+pdf+php&btnG=Search Quote Link to comment https://forums.phpfreaks.com/topic/155700-return-compiledor-something-html-code/#findComment-819612 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.