-
Notifications
You must be signed in to change notification settings - Fork 365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeException ocurring on InlineText.setSubstring #599
Comments
hi @LAlves91 , it's most likely a bug, could you provide an example that reproduce the error? Thank you. |
Hi @syjer ! <html>
<head>
<style> body { word-wrap: break-word;}</style>
</head>
<body>
<table>
<td>
<div align= "center"> </div>
</td>
<td width="18">
<div style="text-indent: 45pt;"> </div>
</td>
</table>
</body>
</html> |
So far in my debugging efforts, what I've seen is:
I don't have much experience with openhtmltopdf core code, so my best effort to come up with a solution may be not good at all...but my initial thought would be to also update the ending value in trimLeadingSpace (I don't know if having an ending smaller than the start makes sense in other use cases). |
Thanks for debugging and suggesting fix @LAlves91.
Hi @LAlves91, Thanks for debugging. I have made a fix similar to the one you suggested in PR. However, I was not able to reproduce with your sample HTML (or other variations I tried on 1.0.4 and the current 1.0.5 branch). Perhaps you could post your builder configuration, just so I can make a regression test for safety? Also, do you pre-process the HTML with Jsoup? Thanks again. |
Hello @danfickle ! Thank you for looking into my problem! About the sample, you're correct! I ended up posting the html without pre-processing...here's the actual input we send to openhtmltopdf: <!DOCTYPE html [
<!ENTITY nbsp " ">
]>
<html>
<head>
<style> body { word-wrap: break-word; font-family: 'Courier New', Courier, monospace; } table { width: 100% !important } @page {margin-bottom: 1.5cm; margin-top: 4.5cm; margin-left: 2.6cm; margin-right: 1cm;}</style>
<style> @page { size: A4; }</style>
<style> body { word-wrap: break-word;}</style>
</head>
<body>
<table>
<tbody>
<tr>
<td>
<div align="center">
</div>
</td>
<td width="18">
<div style="text-indent: 45pt;">
</div>
</td>
</tr>
</tbody>
</table>
</body>
</html> |
It is no longer crashing but the text-indent property is being ignored when there is not enough width to fit it in the box. Trimmed down test based on one provided by @LAlves91. Thanks.
text-indent was not working when the following conditions were met: + The element box was smaller than the text-indent. + word-wrap was set to break-word. With test proof.
Greetings!
We're using openhtmltopdf in our project. Recently, we've updated from version 1.0.0 to 1.0.4, in order to solve a bug (reported in issue 420).
However, this upgrade caused another bug in our project. Now some documents break with the following stacktrace:
After a few tests, we've reached two conclusions:
body { word-wrap: break-word; font-family: 'Courier New', Courier, monospace; }
After removing the word-wrap style, it works again.
Is this an expected behaviour?
Cheers!
The text was updated successfully, but these errors were encountered: