Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php WriteHTML在mpdf中不工作,显示空白屏幕_Php_Pdf_Mpdf - Fatal编程技术网

Php WriteHTML在mpdf中不工作,显示空白屏幕

Php WriteHTML在mpdf中不工作,显示空白屏幕,php,pdf,mpdf,Php,Pdf,Mpdf,我正试图找出其中的问题,但无法解决。查询是正确的,我得到的结果。如果我回显$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->d

我正试图找出其中的问题,但无法解决。查询是正确的,我得到的结果。如果我回显
$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(); 

?>

  • 方法WriteHTML()返回void!所以你不会得到任何回音
  • 请注意,在输出()之前,您没有向浏览器发送任何内容(甚至http头)
  • 方法WriteHTML()返回void!所以你不会得到任何回音
  • 请注意,在输出()之前,您没有向浏览器发送任何内容(甚至http头)

  • 有人能在你的错误日志中提出任何建议吗?没有错误。没有什么。这就是我不能弄清楚的,你们使用的mPDF和PHP版本是什么?使用6.0,我能够从您的代码片段生成PDF(当我用静态数据替换SQL结果时),因此我猜错误将在mPDF之外的某个地方。@meenal,您发现问题了吗?有人能建议您的错误日志中的任何内容吗?没有错误。没有什么。这就是我不能弄清楚的,你们使用的mPDF和PHP版本是什么?使用6.0,我能够从您的代码片段生成PDF(当我用静态数据替换SQL结果时),因此我猜错误将出现在mPDF之外的某个地方。@meenal,您发现问题了吗?