I wanted to save full page as pdf using html2canvas and JsPDF. none of the methods I ever tried seems to work.
html2canvas(document.body, {
allowTaint: true,
onrendered: function(canvas) {
var image = canvas.toDataURL('image/png');
var pdf = new jsPDF();
pdf.addImage(image, 'JPEG', 0, 0);
pdf.save('invoice.pdf');
}
});
Currently this prints only the viewport
How to print full page/ container. or any other better alternatives?
答案 0 :(得分:0)
使用打印介质查询
@media print {
body, html {
width: 100%;
margin-top: 0%;
display: block;
height: 100%;
}
}