Dompdf error “No block-level parent found. Not good.”

偶尔善良 提交于 2019-12-05 11:09:37

dompdf folder>dompdf_config.custom.inc.php file>try uncomment the line

define("DOMPDF_ENABLE_HTML5PARSER", true);

Also replace unsupported html5 tags & attributes with supported one,clear html errors for better result

Debdip

Just uncomment define("DOMPDF_ENABLE_HTML5PARSER", true); this line from dompdf_config.custom.inc.php this file.

You can find this file for codeigniter in vendor/dompdf/dompdf this directory.

go to configuration file dompdf_config.custom.inc.php and uncomment define("DOMPDF_ENABLE_HTML5PARSER", true); and check, basically it requires html5 parser enabled in your configuration file.

Just define

$dompdf->set_option('enable_html5_parser', TRUE);

I think it will fix the issue.

Or can edit the dompdf/dompdf_config.inc.php file go to line no 322 change

def("DOMPDF_ENABLE_HTML5PARSER", false);

to

def("DOMPDF_ENABLE_HTML5PARSER", true);

I don't know why the answer regarding ("DOMPDF_ENABLE_HTML5PARSER", true) was voted down either. Because I spent over 30 hours trying to figure out why this was happening in my website, until I came across this solution. So I enabled the "DOMPDF_ENABLE_HTML5PARSER" by setting it to "TRUE" as noted above. And immediately the error regarding "No block-level parent found" was resolved and my scripts worked. Maybe the 2nd answer was voted down because it duplicated a previous answer (but cut a guy a break, why don't you? Maybe he didn't see it..). Or maybe the "downvoter" has an attitude problem.

Late to this thread, but based on the post at https://github.com/dompdf/dompdf/issues/902, I was able to fix this issue by removing spaces between <html><head>, </head><body>, and </body></html>

So, instead of having properly formated html code like this:

<html>
<head>
...
</head>
<body>
...
</body>
</html>

I deleted all the new lines or spaces between the tags, now it looks like this :

<html><head>
</head><body>
</body></html>

And everything is honky dory again

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!