duannao8450 2013-09-27 01:14
浏览 87
已采纳

Yii,Php,mPDF,生成带有不同方向小部件的pdf

I am implementing an application in Yii php, and I am trying to make PDFs using the mPDF extension.

I'm generating a sort of Summary Report where I make a pdf for it. Inside the generated pdf are 3 widgets, basically tables to create that report.

Here's how it looks:

$mPDF1 = Yii::app()->ePdf->mpdf();

$mPDF1 = Yii::app()->ePdf->mpdf('', 'A5');
..
..//set mpdf properties etc..

$mPDF1->WriteHTML($stylesheet, 1);

$mPDF1->WriteHTML($html1,2);
//say $html1 is a widget/table  with a portrait orientation

$mPDF1->WriteHTML($html2,2);
//$html2 is a widget/table with a portrait orientation

$mPDF1->WriteHTML(&html3,2);
//$html3 is a widget/table that needs to have a landscape orientation because it's too long.

//and then output the pdf and so on..

Above code works, but displays the tables all in a portrait orientation, I need to display the table in $html3 in a landscape orientation. Is there a way to do this?mpdF properties I guess or something. And also, is is there a way to separate $html3 and have it on the start of the next page in the same PDF?

  • 写回答

1条回答 默认 最新

  • douwen3083 2013-09-27 06:38
    关注

    Try to AddPage with Landscape orientation:

    $mPDF1->WriteHTML($html2,2);
    //$html2 is a widget/table with a portrait orientation
    
    $mPDF1->AddPage('L');
    $mPDF1->WriteHTML(&html3,2);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?