如何使用HTML2PDF设置横向方向

问题描述:

如何将通过HTML2PDF生成的pdf文件的页面方向更改为横向...? 默认情况下,它以纵向格式打开。我在html2pdf.class改变了它,但没有changed.Please帮助我..如何使用HTML2PDF设置横向方向

这是PHP代码:

require('../../includes/html2pdf/html2fpdf.php'); 
    $pdf=new HTML2FPDF('L','mm','A3'); 
    $pdf->AddPage(); 
    $pdf->setFont("arial",'',8); 
    $pdf->WriteHTML($data); 
    $pdf->Output("outstanding.pdf","I"); 
+0

你解决了这个问题吗? – shorif2000 2013-06-04 16:27:30

使用L作为构造函数的参数应该只是罚款。不要混淆类内部。

这是我唯一的代码,它工作正常。尝试使用最新版本: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; 
} 

或者您可以在标签上添加方向。

<page orientation="landscape" format="A5" > Landscape </page> 

查看更多示例http://demo.html2pdf.fr/examples/pdf/exemple04.pdf