记录打印PDF门牌按照固定比例

html2canvas(document.getElementById("previewTable2"), {
          scale: 3, useCORS: true, logging: false
        }).then(function(canvas) {
          var pageData = canvas.toDataURL('image/jpeg', 1.0);
          // eslint-disable-next-line no-undef
          // var pdf = new jsPDF('', 'pt', [contentWidth, contentHeight]);
          var pdf = new jsPDF('', 'pt', [765.35, 1218.89]);
          // var pdf = new jsPDF('', 'pt');
          pdf.addImage(pageData, 'JPEG', 0, 0, 765.35, 1218.89);
          pdf.save(value.room_num + '房间实验室安全信息牌' + '.pdf');
          resolve()
        });
      })

关键代码

var pdf = new jsPDF('', 'pt', [765.35, 1218.89]);

 

posted @ 2023-10-09 15:33  非自然数  阅读(4)  评论(0编辑  收藏  举报