0

Whenever I type something in input box it'll will reflect and can drag and drop that text. Now it is HTML format.

I have to convert the HTML content to image file and download it.

Here is the

<a href="http://codepen.io/vengreat/pen/pgROpr">CodePen</a>

Please check it out.

Snazzy Sanoj
  • 804
  • 1
  • 11
  • 28
Venkadesh S
  • 71
  • 1
  • 12

1 Answers1

0

You can create a button that will create image of the "then-generated" image, and use the following code to capture the text as image using HTML5 Canvas.

function Capture() { 
        html2canvas(document.body, {
        onrendered: function(canvas) {
        document.body.appendChild(canvas);
      },
       width: 500,
       height: 500
    });
};

Since it's not possible to invoke SaveAs directly from HTML, you can Right-click and click Save As button to download the image.

P.S. Don't forget to add the html2canvas reference in your webpage.

Working CodePen.

Hope this helps. :)

Snazzy Sanoj
  • 804
  • 1
  • 11
  • 28