Page 1 of 1

HTML to PDF

Posted: Sat Mar 10, 2007 2:17 pm
by tecktalkcm0391
I am trying to use the HTML to PDF class here:
http://html2fpdf.sourceforge.net/

I can get it to make the file fine, but it doesn't display the PDF file, it makes it so you download it, when its suppost to just display the file.... here is my code... PS. There is an auto_append and auto_prepend so i have to cancel them out

Code: Select all

<?
ob_end_clean();
require_once('html2fpdf.php');
require_once('function.php');
define('HTML_URL','http://google.com/');

$html = get_url_contents(HTML_URL);

ob_end_clean();
$pdf = new HTML2FPDF();
$pdf->DisplayPreferences('HideWindowUI');
$pdf->AddPage();
$pdf->WriteHTML($html);
$pdf->Output('doc.pdf','I');
?>
function.php wrote:

Code: Select all

<?php
function get_url_contents($url){
        $crl = curl_init();
        $timeout = 5;
        curl_setopt ($crl, CURLOPT_URL,$url);
        curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
        $ret = curl_exec($crl);
        curl_close($crl);
        return $ret;
}
?>
How do I get it to display the PDF file in the webpage window?

Posted: Sat Mar 10, 2007 2:33 pm
by feyd
What a browser does with the content-type application/pdf is chosen by the browser and its plugin that handles PDF files.

Posted: Sat Mar 10, 2007 2:37 pm
by tecktalkcm0391
Ok, cause I am using IE6 to test and it shows fine on the source website, but not on mine... :(