Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.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 dompdf:空白pdf输出_Php_Html_Dom_Dompdf - Fatal编程技术网

Php dompdf:空白pdf输出

Php dompdf:空白pdf输出,php,html,dom,dompdf,Php,Html,Dom,Dompdf,我一直在为我的应用程序使用dompdf,但在切换服务器后,我得到了空白输出。在我打开debug之后,我得到了以下错误 DOMDocument::loadHTML(): Opening and ending tag mismatch: div and table in Entity, line: 131 DOMDocument::loadHTML(): Opening and ending tag mismatch: div and table in Entity, line: 132 DOMD

我一直在为我的应用程序使用dompdf,但在切换服务器后,我得到了空白输出。在我打开debug之后,我得到了以下错误

DOMDocument::loadHTML(): Opening and ending tag mismatch: div and table in Entity, 
line: 131 DOMDocument::loadHTML(): Opening and ending tag mismatch: div and table in Entity, line: 132 DOMDocument::
loadHTML(): Opening and ending tag mismatch: div and table in Entity, line: 133
Unable to stream pdf: headers already sent
它所指的代码如下

<tr style="border:2px solid lightgray;border-right:none;border-left:none;border-top:none;">
                        <th style="width:33.333333333333333%;text-align:left;">Activity</th>
                        <th style="width:16.666666666666666%;text-align:left;">Hours</th>
                        <th style="width:25%;text-align:left;">Rate</th>
                        <th style="width:25%;text-align:right;">Line Total</th>
                    </tr>

活动
小时
比率
行总数

任何帮助都将不胜感激。非常感谢你的帮助

div和table
。您在某个地方丢失了一个
…谢谢您,Marc,我可以添加丢失的标记,但输出仍然存在,并且没有更多的警告。这将有助于查看更完整的示例。您可以尝试通过运行HTML来查看是否还需要修复其他内容。如果您使用的是v0.6.x,您可以调用
$dompdf->output_html()
查看工作文档的外观。如果您启用HTML5解析器,它将尝试修复任何HTML语法错误。此外,如果您从一台服务器移动到另一台服务器,并且使用完全相同的代码,则可能是服务器配置问题。dompdf\u font\u family\u配置文件中的字体引用可能不正确?也许PHP扩展丢失了?请尝试一个更简单的文档,看看dompdf是否至少能正常工作。谢谢Brain,非常感谢您的帮助。我使用的是v0.6x,下面是我使用的渲染代码`$pdfContent=$pdfContent->render('pdf','ajax');//echo$pdfContent;//die();需要一次(../Lib/dompdf master/dompdf_config.inc.php”);$dompdf=新的dompdf();$dompdf->load_html($pdfContent);$dompdf->render();$pdf=$dompdf->stream(“Invoice.pdf”,数组('Attachment'=>0));