Chat /

DomPDF addon and Error 500

During last weekend automatic system software/security update – among other patches/updates there was also libxml update. Starting from beginning of this week – couple of customers have reported that DomPDF addon they are using, is generating “500 – Server Error”. However, this is not a server error but a bug (feature) in DomPDF code/functionality. There has been already opened a bugfix request earlier concirning this issue on page:
2017-06-16 – Whitespace inside HTML tag breaks rendering #1494

What to do and how to fix this?

1. WordPress probable fix:
Website owner should add filter/function to WP if domPDF is used:

add_filter( 'wpo_wcpdf_dompdf_options', 'wpo_wcpdf_dompdf_options_custom', 10, 1 );
function wpo_wcpdf_dompdf_options_custom($options) {
	$options['isHtml5ParserEnabled'] = true;
	return $options;

2. Standalone DomPDF addon:
With newer DomPDF version, one should enable HTML5Parser in options:

$options['enable_html5_parser'] = true;

With older DomPDF version:

$options->set('enable_html5_parser', true);

3. Laravel domPDF:
There are many differend bug-fix requests with different solutions concirning Laravel domPDF depending of version used – those can be found on Laravel DomPDF Ǵithub issues page:
(On some cases there has helped to disable “table” on “body” CSS on other cases to enable HTML5Parser and to empty caches)

Comments are currently closed.

This website utilizes cookies and similar technologies for functionality and other purposes. Your use of this website constitutes your acceptance of cookies.
Ok, got it.