dqz7636 2013-02-26 08:16
浏览 657
已采纳

如何使用HTML2PDF设置横向方向

How to change the page orientation of pdf file generated via HTML2PDF to landscape...? By default, it is opening as Portrait format. I have changed it in html2pdf.class, but nothing changed.Please help me..

This is the php code:

 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");
  • 写回答

3条回答 默认 最新

  • douyinghuo8874 2013-07-11 18:30
    关注

    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;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记