I use Html2Canvas and then jsPdf to export the image.
This is the function:
function exportPdf() {
content = $("#print");
var useWidth = content.prop('scrollWidth');
var useHeight = content.prop('scrollHeight');
debugger;
html2canvas((content), { width: useWidth, height: useHeight}).then(function (canvas) {
debugger;
var img = canvas.toDataURL("image/png");
var doc = new jsPDF({
unit:'px',
format:'a4'
});
debugger;
doc.addImage(img, 'JPEG', 0, 0);
doc.save('test.pdf');
});
}
I think is taking in consideration the viewport, is like doing a printscreen, of course whatever is below the scroll it doesn't take it into consideration.
Any ideas?