HTML2PDF,打印pdf时pdf字体非常小

问题描述 投票:0回答:1

var 选项 = { 保证金:1, 文件名:'1099PdfData.pdf', 图像:{类型:'jpeg',质量:0.98},
html2canvas: { 比例: 2 }, jsPDF: { 单位: 'in', 格式: a0, 方向: 'l'} };

我正在使用此参数将 HTML 转换为 PDF,但在打印 AO 页面时,其文本非常小,如何增加文本大小。谁能指导一下吗

angular typescript html2pdf
1个回答
0
投票

这对我有用,这个片段也可以打印多页

captureScreen() {
    const data = this.document.getElementById('content');

    html2canvas(data).then(canvas => {
      const imgWidth = 285; // any width
      const imgHeight = canvas.height * imgWidth / canvas.width;

      const contentDataURL = canvas.toDataURL('image/png')
      let pdf = new jspdf('l', 'mm', 'a4'); // config
      const position = 0;

      pdf.addImage(contentDataURL, 'PNG', 0, position, imgWidth, imgHeight)
      pdf.save('capture.pdf'); // file name
    });
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.