繁体   English   中英

如何在jspdf和angular 6的多个页面中添加Header和页脚?

[英]How to add Header and footer to multiple pages in jspdf and angular 6?

代码具有动态高度和宽度的动态页面。 因此,在设置 header 和页脚页码时存在问题。

`if (this.Results.length > 0) {
      await this.Results.forEach((element) => {
        const fai = document.getElementById(element.pageNumber); // fai
        html2canvas(fai).then(canvas => { 
          const imgWidth = 210;
          const pageHeight = 295;
          const imgHeight4 = canvas.height * imgWidth / canvas.width;
          let heightLeft4 = imgHeight4;
          const contentDataURL = canvas.toDataURL('image/png', 1.0);
          const position8 = 0;
          pdf.addPage();
          this.sharedService.showHideLoader(true);
          pdf.addImage(contentDataURL, 'PNG', 0, position8, imgWidth, imgHeight4);
          heightLeft4 -= pageHeight;
        while (heightLeft4 >= 0) {
            let position9 = heightLeft4 - imgHeight4;
            pdf.addPage();
            pdf.addImage(contentDataURL, 'PNG', 0, position9, imgWidth, imgHeight4);
            heightLeft4 -= pageHeight;
          }
        });
      });
    }`

我希望 output pdf 必须有 header 和页脚

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM