【发布时间】:2017-03-25 13:49:00
【问题描述】:
我已经用 PHP 创建了网站。我使用了一个按钮生成 PDF,它在 ipad 和桌面上完美运行,但在 android 上无法运行。当我在 android 上生成 PDF 并尝试打开它时,pdf 阅读器会出错。我用两个不同的 pdf 阅读器试了一下。两者都给出错误都显示文件格式错误,文件无法打开。为了生成 pdf,我使用了 mPDF 库。
function generatePdf($userData){
$PNG_WEB_DIR = 'phplib/qrcode'.DIRECTORY_SEPARATOR;
$id = $userData['Id'];
$name = $userData['FirstName'].' '.$userData['LastName'];;
$source =$userData['Source'];
$destination =$userData['Destination'];
$date =$userData['Date'] ;
$FlightName = $userData['FlightName'];
$FlightNumber=$userData['FlightNumber'];
$html .='<div style="text-align: center;">
<h3 class="form-title"> <font size=4>'.$name.'</h3>
</div>
<div style="text-align: center;">
<table class="table" style="text-align: left;">
<tr>
<td class="style" >TicketId:</td>
<td class="style">'.$id.'</td>
</tr>
<tr>
<td class="style">Source:</td>
<td class="style">'.$source.'</td>
</tr>
<tr>
<td class="style">Destination:</td>
<td class="style">'.$destination.'</td>
</tr>
<tr>
<td class="style">Flight Name:</td>
<td class="style">'.$FlightName.'</td>
</tr>
<tr>
<td class="style">Flight Number:</td>
<td class="style">'.$FlightNumber.'</td>
</tr>
<tr>
<td class="style">Date:</td>
<td class="style">'.$date.'</td>
</tr>
<tr>
<td class="style">
<img src="'.$PNG_WEB_DIR.$id.'.png" /></td>
</tr>
</table>
</div>';
$mpdf=new mPDF();
$mpdf->debug = true;
$mpdf->allow_output_buffering = true;
$mpdf->WriteHTML($html);
//$mpdf->SetDisplayMode('fullpage');
$mpdf->Output('download.pdf','D');
【问题讨论】:
-
代码??? ???????