WriteHTML在mpdf,空白屏幕显示中不起作用

问题描述 投票:0回答:1

我试图弄清楚这个问题,但不能。查询是正确的,我得到的结果。如果我回应$html我得到结果,但没有为WriteHTML();

这是我的代码

<?php
error_reporting(E_ALL); 
ini_set('display_errors', 1);
include("connect.php");
$id = $_GET['id'];
include("mpdf/mpdf.php");
$mpdf=new mPDF('utf-8', 'A4'); 
$mpdf->debug = true;
$mpdf->useOnlyCoreFonts = true;    // false is default
$mpdf->SetProtection(array());
$mpdf->SetTitle("My Company");
$mpdf->SetAuthor("MeAuthor");
$mpdf->SetWatermarkText("Demo");
$mpdf->showWatermarkText = false;
$mpdf->watermark_font = 'DejaVuSansCondensed';
$mpdf->watermarkTextAlpha = 0.1;
$mpdf->SetDisplayMode('fullpage');
$s1 = "SELECT * FROM mytable WHERE cid=".$id."";
$sql = mysqli_query($con, $s1) or die (mysqli_error($con));
$row = mysqli_fetch_array($sql);

$html = '

<html>
<head>

<body>
<!--mpdf
<htmlpageheader name="myheader">
<table width="100%"><tr>
<td width="80%" style="text-align: center; font-size: 16pt;">Company Name<br>
<span style="font-size: 11pt;text-align: center;">Address 123, Lorel Ipsum, sdfsdf sdsdgsdg,</span><br>
<span style="font-size: 11pt;text-align:center;">sdfdsfdsf, sfsdf - 100066
</td>
</tr>
</table>
</htmlpageheader>




<sethtmlpageheader name="myheader" value="on" show-this-page="1" />
<sethtmlpagefooter name="myfooter" value="off" />
mpdf-->

<table width="100%">
<tr><td colspan="2" align="right" width="40%"> Vocher No : '.$id.' </td></tr>
<tr>
<td width="70%">Debit A/C. : '.$row['account_no'].' </td>
<td width="30%" style="text-align: right">Date: '.date("d-m-Y").'</td></tr>

</table>

<div style="border: 1px solid black">
<table border="0" style="white-space:nowrap; border-spacing:0;" height="100%" cellspacing="5"><thead>
<tr>
<th width="30%" style="border-right:1px solid #000;">Name</th>
<th width="20%" style="border-right:1px solid #000;">E-Mail</th>
<th width="20%" style="border-right:1px solid #000;">Mobile</th>
<th width="30%" style="border-right:1px solid #000;">Particulars</th>
<th width="15%" style="border-right:1px solid #000;">RS.</th>
<th width="5%" style="border-right:1px solid #000;">P.</th>

</tr>
</thead>
<tr> 
<td style="border-right:1px solid #000;" width="30%" height="100px;" >'.$row['name'].'</td>
<td style="border-right:1px solid #000;" width="20%">'.$row['email'].'</td>
<td style="border-right:1px solid #000;" width="20%">'.$row['mobile'].'</td>
<td style="border-right:1px solid #000;" width="30%">'.$row['purpose'].'</td>
<td style="border-right:1px solid #000;" width="15%">'.$row['amount'].'</td>
<td style="border-right:1px solid #000;" width="5%">00</td>
</tr>
<tr><td colspan="4" style="font-weight:bold;">Total Rs.</td> '.$row['amount'].'<td></tr>
</table></div>
<br>
 <table border="0"><tr><td style="width=50%;">Mode of Payment : '.$row['mode'].' </td><td width="50%">Date : '.date('Y-m-d').'</td></tr>
 <tr><td colspan="2">Rupees : </td></tr>

</table>
<br><br><br>
<table width="100%" border="0">
<tr><td width="20%"> Hon. Secretary </td>
<td width="20%">Hon. Treasurer</td>
<td width="20%">Hon. Trustee</td>
<td width="20%">Receiver s Signature</td></tr>
</table>

</body>
</html>
';
//echo $html;
echo $mpdf->WriteHTML($html);
//$mpdf->Output('Receipt.pdf','D');

$mpdf->Output(); 

?>
php pdf mpdf
1个回答
0
投票
  1. 方法WriteHTML()返回void!所以你不会得到任何回音。
  2. 请注意,在Output()之前,您没有向浏览器(甚至是http-header)发送任何内容。
© www.soinside.com 2019 - 2024. All rights reserved.