Search code examples
phphtml2pdf

html2pdf include html from page


Trying to generate PDFs with html2pdf. I'm able to create the PDFs from creating markup within the function itself, but what I REALLY want to do is include the markup from a separate file using a URL.

The code I have generates a PDF, but the PDF is blank which, I assume, means not HTML is being pulled from the specified url.

require_once('html2pdf/html2pdf.class.php');
$mlsnum = $_GET['mlsnum'];
$url = 'http://www.nexthometown.com/components/com_singleprop/views/singleprop/tmpl/scripts/oh_usda.php?mlsnum='.$mlsnum;
$html2pdf = new HTML2PDF('P', 'A4', 'en');
$html2pdf->getHtmlFromPage($url);
$html2pdf->Output($mlsnum.'.pdf','D');

Is anyone familiar with html2pdf? I've gone through the docs and the examples, but I can't find any reference to this method. I've found the definition here, but it doesn't tell much.


Solution

  • http://html2pdf.fr/en/default This library has been made to assist in the creation of PDF files, not to directly convert an HTML page. You can not use the <html>, <head>, <body> tags.