dompdf icon indicating copy to clipboard operation
dompdf copied to clipboard

Text alignment combined with whitespace styling not correctly interpreted

Open bsweeney opened this issue 5 years ago • 1 comments

When text is styled with both whitespace and text alignment declarations the spacing and layout of the text is not always correctly interpreted.

For example, if the white-space styling is pre or pre-wrap then the spacing should not be adjusted to justify the text.

<html>
<head>
</head>
<body>
<div style="background: #c0c0c0; font-family: Courier; font-weight: normal; text-align: justify; white-space:pre-line;">LOOK AT SOME OF THESE TEST VALUES LOOK AT SOME OF 
  THESE TEST VALUES LOOK AT SOME OF THESE TEST VALUES LOOK AT SOME
   OF THESE TEST VALUES LOOK AT SOME OF THESE TEST VALUES LOOK AT SOME
    OF THESE TEST VALUES LOOK AT SOME OF THESE TEST VALUES LOOK AT
     SOME OF THESE TEST VALUES LOOK AT SOME OF THESE TEST VALUES LOOK AT SOME OF THESE TEST VALUES</div>
</body>
</html>

TODO: investigate further, this is based on browser rendering, not all combinations tested

bsweeney avatar Jul 05 '20 17:07 bsweeney

@bsweeney Is it possible that the bug shown in the second screen is somehow also related to #3681 and #2186? Because the rule white-space: pre-wrap; also ultimately applies. In order to save all the necessary characters that come from the editor to print. Because this also repeats even if you upgrade to the latest version of domPDF.

Expected result:

Image

Current result: Image

Example: list-bug-domPDF.html

Stormiks avatar Oct 30 '25 02:10 Stormiks