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 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教