0

I tried to use html2canvas to get image screenshot byte from website. However, the screenshot result ended with poor resolution. Looking for advice to improve screenshot quality. Thanks.

vincent
  • 15
  • 1
  • 3

1 Answers1

0

How about something like this:

var $wrapper = $("#yourDiv");
setSize($wrapper, "2000px", "20pt");

html2canvas($wrapper, {
    onrendered: function (canvas) {
        var a = document.createElement('a');
        a.href = canvas.toDataURL("image/jpg");
        a.download = 'filename.jpg';
        a.click();

        setSize($wrapper, "1000px", "10pt");
    }
});

function setSize(dv, width, fontsize) {
    dv[0].style.width = width;
    dv[0].style.fontSize = fontsize;
}

This resizes the div and font to bigger size and then shrinks back afterwards.

Tashi
  • 477
  • 4
  • 12