Answer the question
In order to leave comments, you need to log in
Html2canvas why doesn't text in textarea wrap to a new line?
It is necessary to make it possible to save the block as a picture, a kind of generator of a completed document for printing is planned.
I started looking for simple options - I came across "Html2canvas". Fits perfectly, but there was a problem.
Now on the test (locally) page there are only textarea and a button, no styles except for the background are registered.
In the screenshot above, the textarea, then the button and the canvas itself with the result.
Page code:
<div id="box"><textarea></textarea></div>
<button id="btnSave">btnSave</button>
<div id="img-out"></div>
$("#btnSave").click(function() {
html2canvas(
$("#box")[0],
{
allowTaint: true,
backgroundColor: null
}
).then(function(canvas) {
$("#img-out").append(canvas);
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question