I've downloaded and installed HTML2PDF on my webserver. I've made sure all the paths, that I can think of, are correct. Here's my simple script just to see the application is working. It should take my index.php file and convert it to a PDF that is output to the browser.

Assume / is CWD

<?
// Load the FPDF Library
    require("./fpdf.php");
    require("./html2pdf/html2pdf.class.php");

// Generate the PDF
	$pdf=new HTML2PDF();
	$pdf->AddPage();
	$fp = fopen("index.php","r");
	$strContent = fread($fp, filesize("index.php"));
	fclose($fp);
	$pdf->WriteHTML($strContent);
	$pdf->Output();
?>

But when I view the page in the browser, I get this error:

Fatal error: Call to undefined method HTML2PDF::AddPage() in /var/www/mods/esr/pdftable.php on line 7

All subdirectories in /html2pdf have the correct r-w-x permissions. Host is Ubuntu Server running Apache 2.2.14 and PHP 5.

Thanks in advance.

    which of the many "html(2|to)pdf" apps is this one?

      the example does not have AddPage()

        I guess I shouldn't have combined the FPDF manual examples with the HTML2PDF examples. I redid it using the HTML2PDF only, through out what I filled my head with regarding FPDF and it works. Thanks all. This is my first tour with creating PDFs through PHP and I'll admit, I'm stumbling.

          just happened to have spent a week looking at the best library for a work project, need to do 30+ pages a second, for what it's worth TCPDF (used by the app you have) was found to be the fastest. There are, as you have found, quite a few options many with very similar names.

            Write a Reply...