htmlcssopenhtmltopdf

Text-Align right, remove trailing whitespace in openhtmltopdf


I am using the open source project openhtmltopdf but I am facing the following issue:

I have a p-tag inside an div-element. The tag has the property text-align: right. The text is aligned right, but when there is a break, because the width of the div breaks the p-tag, it breaks after a whitespace. So the rows are not in line on the right side, as there is a trailing whitespace. white-space: pre-line does not help. Browsers are rendering it correctly, when I display the source-html.

End of the lines kinda look kind of like this then:

Row 1 without break

Row 2 with a break

. . . Row 2 continues

This also happens with the flying saucer renderer which I am trying to replace with openhtml.


Solution

  • This was fixed in a newer version of openhtmltopdf

    https://github.com/danfickle/openhtmltopdf/issues/440

    https://github.com/danfickle/openhtmltopdf#102-2020-february-25