'"word-break: break-word" does not get reflected in the image created by html2canvas

I am using html2canvas for downloading the html view as an image.

However, if there is a long text without spaces, the html renders it properly on the next line using css (word-break: break-word) but this does not reflect in the image that is generated. The text stays in one line and gets clipped.

tried other CSS properties like:

word-wrap: break-word;
overflow-wrap: break-word;

still did not work

check below image for expected vs actual result

https://i.stack.imgur.com/QfuVT.png



Solution 1:[1]

For the people like me who needed the word-break: break-word; and not word-break: break-all; adding overflow-wrap: break-word; In addition to what Dhananjay Chaudhari said seems to work.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Oliverdam