fix print error

This commit is contained in:
邱博亞 2022-05-19 15:25:12 +08:00
parent b7680a7b61
commit eaeab4f1fa
1 changed files with 1 additions and 1 deletions

View File

@ -33,7 +33,7 @@
html2canvas($('div.print_text')[0]).then(canvas => { html2canvas($('div.print_text')[0]).then(canvas => {
var pdf = new jsPDF('px', 'mm', 'a4'); var pdf = new jsPDF('px', 'mm', 'a4');
var width = pdf.internal.pageSize.getWidth()-3; var width = pdf.internal.pageSize.getWidth()-3;
var height = pdf.internal.pageSize.getHeight(); var height = $('div.print_text').innerHeight()/$('div.print_text').innerWidth()*width;
pdf.addImage(canvas.toDataURL('image/png'), 'PNG', 0, 0,width ,height ); pdf.addImage(canvas.toDataURL('image/png'), 'PNG', 0, 0,width ,height );
pdf.save(filename); pdf.save(filename);
}); });