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 找一个网络防御专家,外包的
  • ¥100 能不能让两张不同的图片md5值一样,(有尝)
  • ¥15 informer代码训练自己的数据集,改参数怎么改
  • ¥15 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
  • ¥20 MATLAB绘制两隐函数曲面的交线
  • ¥15 求TYPCE母转母转接头24PIN线路板图
  • ¥100 国外网络搭建,有偿交流
  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案