Free Support Forum - aspose.com

HTML to PDF: Long strings overrun table boundries

Hello,

I’m dealing with creating PDFs from HTML and have found that long text strings do not get broken into multiple lines so that they will fit inside a table cell. Instead, they overrun the sides of tables. See the screenshot as an example:
Screen Shot 2020-10-13 at 3.24.36 PM.png (27.3 KB)

I’ve uploaded the code that produces this result. Please let me know if there is a work around for this.

Thanks,

Ken Richards
textoverrun.zip (110.1 KB)

@klrpdx

It seems like the text is out of border in the source HTML (Outofborderhtml.png (25.6 KB)) as well and PDF is being generated as per the styles and formatting in the source HTML file. Would you please try with another HTML file in which text is within the table boundaries and in case issue still persists, please let us know.

I’ve updated the html to add word-wrap:break-word; to the<td> style. As you can see, the HTML now renders the text completely in the table cell, while the Aspose PDF lets it run off the side of the page.

textoverrun.zip (110.1 KB)

@klrpdx

We were able to reproduce the issue in our environment as well using Aspose.PDF for Java 20.9. Therefore, a ticket as PDFJAVA-39855 has been logged in our issue management system for the sake of correction. We will further look into its details and keep you posted with the status of its resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.