php中的mpdf方向问题

时间:2016-11-22 06:24:07

标签: php mpdf

我正在使用 mpdf 将HTML转换为pdf文件。我尝试使用以下代码来更改页面方向(A5的风景)。但它都不起作用。我也访问了很多关于stackoverflow的解决方案,但它对我不起作用。请问有人建议我这些代码有什么问题。

提前致谢

1:

include('MPDF57/mpdf.php');
$mpdf=new mPDF($mode='',array(148,210),$default_font_size=0,$default_font='',$mgl=0,$mgr=0,$mgt=0,$mgb=0,$mgh=0,$mgf=0, $orientation='L');
$mpdf->AddPage();
$mpdf->SetFont('Arial','',12);

$text="
<table width='100%' border='1'><tr><td>sno</td><td>name</td></tr><tbody><tr><td style='width:10px;'>1</td><td>test</td></tr></tbody></table>";

$mpdf->WriteHTML($text);
$mpdf->Output();

2:

include('MPDF57/mpdf.php');
$mpdf=new mPDF();

$mpdf->AddPage();
$mpdf->SetFont('Arial','',12);
//include inline css for changing orintation to landscape
$text="
<table style='sheet-size:5.8in 8.3in;size:landscape ' width='100%' border='1'><tr><td>sno</td><td>name</td></tr><tbody><tr><td style='width:10px;'>1</td><td>test</td></tr></tbody></table>";
$mpdf->WriteHTML($text);
$mpdf->Output();

3:

include('MPDF57/mpdf.php');
$mpdf=new mPDF();

$mpdf->AddPage('c','A5-L');
$mpdf->SetFont('Arial','',12);
//include inline css for changing orintation to landscape
$text="
<table  width='100%' border='1'><tr><td>sno</td><td>name</td></tr><tbody><tr><td style='width:10px;'>1</td><td>test</td></tr></tbody></table>";
$mpdf->WriteHTML($text);
$mpdf->Output();

0 个答案:

没有答案