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.
The proposed approach does not meet our requirement. In our scenario, the table column widths must adjust dynamically based on the actual content. The recommended CSS settings—such as table-layout: fixed, predefined column widths, or properties that enforce equal column widths—result in uniform sizing across all columns.
This prevents content-heavy columns from expanding naturally and does not reflect the required HTML-like auto-sizing behavior.
Additionally, the lack of support for overflow-wrap: anywhere further limits our ability to handle long, unbreakable content within dynamically sized columns.
Our requirement:
- Dynamic, content-based column width adjustment (no fixed or equal widths)
- Natural wrapping of large content without layout overflow
At this time, it appears that the available supported CSS properties do not provide a solution for achieving this behavior through the Aspose HTML-to-PDF conversion.
Can you suggest alternative based on our requirement?
@vikrantm
Summary
overflow-wrap: anywhere is not supported by the Aspose.PDF HTML‑to‑PDF renderer, so very long strings (e.g., URLs, long numbers) can prevent a table column from shrinking and cause the table to exceed the page width.
Why it happens
The renderer implements only a subset of CSS. While the default table-layout: auto allows column widths to grow with content, the engine does not recognise the anywhere value for overflow-wrap. Consequently, unbreakable text stays on a single line and forces the column to expand beyond the page margins.
What to try next
- Insert manual break points – Add soft‑hyphens (
­) or zero‑width spaces (​) at logical positions in long strings (e.g., URLs) so the renderer can break them.
- Use other break‑related CSS properties – Properties such as
word-break: break-all;, overflow-wrap: break-word; or hyphens: auto; are part of standard CSS. Their support in Aspose.PDF is not guaranteed, so you should test them with your specific version.
- Consider building the table with the PDF API – If HTML‑based styling does not give the required result, you can create the table directly using Aspose.PDF’s
Table class, where column widths and line breaks can be controlled programmatically.
- Check the latest release notes – Newer versions of Aspose.PDF may add support for additional CSS features. Review the documentation or release notes for any updates regarding
overflow-wrap or related properties.
These approaches aim to keep table columns within the page width while allowing content‑based sizing, but you will need to verify their effectiveness in your environment.
Note: The suggestions above are based on the available evidence, which confirms that overflow-wrap: anywhere is not supported. Other CSS work‑arounds are proposed as possible alternatives, but their actual support should be validated.
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.