I create a PDF using the whole document.body, turning it into a canvas and transferring it to jsPDF. But the image / canvas is too wide. I want to scale it for a page, but jsPDFdoes not have a pixel size as a dimension.
Possible values are pt, mm, cm. How can I choose the right size? And how do I scale the image if necessary?
Should I use a function addImageto scale or scale with canvas.getContect ("2d") and draw on a new canvas?
html2canvas(
document.body,
{
onrendered: function(canvas)
{
var doc = new jsPDF('p', 'pt');
doc.addImage(canvas, 'PNG', 10, 10, 1024, 1000);
doc.save('sample-file.pdf');
}
});