How can I get the textarea content as it is; i.e, How can i get text content with auto line breaking? I have to place the text as it is on the canvas.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unfortunately one issue with < canvas > tag is the lack of text-metrics support which ends to not supporting line breaking!
To simulate word-wrapping you need to loop through the singular words in your text (text.split(“ “)), and measuring each word individually until the edge of the bounding-box is hit, at which point a break is inserted, and the process continues.
For more detail information and also implementation guide, please take a look at this article:
I hope this helps 🙂