gpt4 book ai didi

php - 无法加载 pdf,dompdf 错误 -> PDF.js v0.8.787(构建 : 58407cf) Message: InvalidPDFException

转载 作者:行者123 更新时间:2023-11-29 03:02:26 25 4
gpt4 key购买 nike

以下是我使用 dompdf 显示 pdf 的代码,但错误是 failed to load pdfPDF.js v0.8.787(内部版本:58407cf)消息:InvalidPDFException

表名为 acad_act,数据库名为 pbas_db。数据库连接的详细信息存储在 db_connect.php 中。任何帮助将不胜感激

    <?php
include('db_connect.php');
require 'dompdf/dompdf_config.inc.php';

$sqlinv="SELECT * FROM acad_act";
$res_inv = mysql_query($sqlinv) or die(mysql_error());
while ($sql3=mysql_fetch_array($res_inv)) {
$inv_id = $sql3['User_id'];
$date = $sql3['Year'];
$cname = $sql3['Gen_Info_AQ'];
$subtotal = $sql3['Gen_Info_NOC'];
$disc = $sql3['Gen_Info_Place'];
$subtotal2 = $sql3['Gen_Info_Duration'];
$tax = $sql3['Gen_Info_SA'];
$gtotal = $sql3['Gen_Info_Aqyear'];
}

$dompdf= new DOMPDF();

$html .="<html>
<head>
<style>
body {
font-family: arial;
font-size: 13px;
}
table {
width: 100%;
border-collapse: collapse;
}
th {
font-weight: bold;
font-size: 14px;
border: 1px solid #333333;
}
tr {
width: 100%;
}
td {
border: 1px solid #333333;
text-align: center;
padding: 10px;
font-weight: normal!important;
}
</style>
</head><body>";
$html .="
<table>
<thead>
<tr>
<th class=''>Sr.</th>
<th class=''>Particulars</th>
<th class=''>Size</th>
<th class=''>Quantity / Insertion</th>
<th class=''>Rate</th>
<th class=''>Amount</th>
<th class=''>Amount 2</th>
<th class=''>Amount 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>" . $inv_id . "</td>
<td>" . $date . "</td>
<td>" . $cname . "</td>
<td>" . $subtotal . "</td>
<td>" . $disc . "</td>
<td>" . $subtotal2 . "</td>
<td>" . $tax . "</td>
<td>" . $gtotal . "</td>
</tr>
</tbody>
</table>
</body>
</html>";

$dompdf->load_html($html);
$dompdf->render();

$dompdf->stream("sample.pdf");

exit(0);
?>

最佳答案

异常是由于浏览器安装了pdf.js插件。 pdfjs 没有呈现错误,而是显示了一个不显示错误的异常。只需删除 pdfjs 插件,您就可以看到所需的错误。

关于php - 无法加载 pdf,dompdf 错误 -> PDF.js v0.8.787(构建 : 58407cf) Message: InvalidPDFException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21013210/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com