How to set landscape orientation using HTML2PDF
Using L
as the constructor parameter should work just fine. Don't mess with the class internals.
This is my only code and it works fine. Try using the newest release: HTML2PDF.
// convert to PDF
require_once('../../vendor/html2pdf_v4.03/html2pdf.class.php');
try
{
$html2pdf = new HTML2PDF('L', 'A4', 'en');
$html2pdf->setDefaultFont('Arial');
$html2pdf->writeHTML($html, false);
$html2pdf->Output('output.pdf', 'D');
}
catch(HTML2PDF_exception $e) {
echo $e;
exit;
}
Or you can add orientation on tag.
<page orientation="landscape" format="A5" > Landscape </page>
Check out http://demo.html2pdf.fr/examples/pdf/exemple04.pdf for more example.