We are currently evaluating Aspose.PDF for converting HTML documents into PDF format. During this evaluation we found that when number of columns for table are increased the generated PDF spills out the columns outside of defined page width and the overall result appears as truncated table.
This can be fixed with CSS property overflow-wrap: anywhere
However, this property appears to be ignored during the HTML-to-PDF conversion process, and the table content still extends outside the page boundaries.
Request:
Please advise whether overflow-wrap: anywhere is supported in Aspose.PDF during HTML rendering, and if not, suggest an alternative mechanism or recommended approach to ensure that table cell content always wraps and remains within the page width.
@vikrantm
Summary
overflow-wrap: anywhere is not listed among the CSS properties that Aspose.PDF’s HTML‑to‑PDF renderer currently supports, so the renderer ignores it and long words can extend beyond the page width.
Why it happens
The HTML renderer in Aspose.PDF implements only a subset of CSS. The official CSS support matrix (available in the product documentation) does not include the newer anywhere keyword for overflow-wrap. When the property is not recognized, the renderer falls back to its default behaviour, which does not force breaking of long words inside table cells.
What to do next
- Verify the behaviour with your version – Render a simple HTML page that contains a table cell with
overflow-wrap: anywhere. If the text still overflows, the property is not supported in the version you are using.
- Use supported CSS alternatives
/* Break words at any character */
td { word-break: break-all; }
/* Break long words only when needed */
td { overflow-wrap: break-word; /* or word-wrap: break-word */ }
/* Give the renderer a clear width limit */
table { table-layout: fixed; width: 100%; }
td, th { max-width: 0; } /* forces wrapping within the allocated cell width */
These properties are documented as supported and can help keep content inside the page margins.
3. Define explicit column widths (especially for tables with many columns) so the renderer knows the maximum width for each cell:
<table style="table-layout:fixed; width:100%;">
<col style="width:12.5%;"> <!-- repeat for each column -->
...
</table>
- Check the CSS support matrix – Review the Aspose.PDF documentation for the exact list of CSS properties that are handled. This will confirm that
overflow-wrap: anywhere is absent and show which alternatives are safe to use.
- Submit a feature request – If the
anywhere behaviour is essential for your project, you can raise a request on the Aspose community forums or support portal, providing a minimal HTML example that demonstrates the limitation. The product team can then consider adding support in a future release.
Note: The above suggestions are based on the documented CSS capabilities of Aspose.PDF. Specific post‑processing APIs (e.g., forcing word wrap on PDF table cells) were not found in the available evidence, so they are omitted here.
I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.