Replies: 7   Views: 3787
Extra space on the beginning of every paragraph on html to doc
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 01-03-2019 - 20:42


After doing a lot of tests, we have checked that some Tidy installations don't respect the wrap option correctly.

Tidy configuration details that setting wrap as 0 disables any line wrapping (, but some versions/setups don't respect it. To solve this issue, that happens only in a few weird cases, the easiest solutions are: removing the wrap option or setting the wrap value to a big number.

The Tidy configuration can be found in the DOMPDF_lib.php file in the _load_html method. This is the default setting:

$tidy = tidy_parse_string($str, array('output-xhtml' => true, 'markup' => false, 'wrap' => 0, 'wrap-asp' => false, 'wrap-jste' => false, 'wrap-php' => false, 'wrap-sections' => false), 'utf8');

where wrap can be removed:

$tidy = tidy_parse_string($str, array('output-xhtml' => true, 'markup' => false, 'wrap-asp' => false, 'wrap-jste' => false, 'wrap-php' => false, 'wrap-sections

or set with a high value:

$tidy = tidy_parse_string($str, array('output-xhtml' => true, 'markup' => false, 'wrap' => 1000000, 'wrap-asp' => false, 'wrap-jste' => false, 'wrap-php' => false, 'wrap-sections

Using one of these solutions the extra space issue is solved.

phpdocx 9 added new options to set Tidy wrap settings.