Search Posts

Category: jspdf

jsPDF muliple pages with div height – unable to determine the height

I am trying to generate a pdf from html divs with dynamic height and width. Below is the code. let pages = this.rootDataContainer.nativeElement.getElementsByClassName(‘pdfpage’); for (let i = 0; i < pages.length; i++) { this.pdfDoc.addHTML(pages[i], 0, 0, options, () => { let pxHeight = pages[i].offsetHeight / scaleFactor; this.pdfDoc.addPage(0, pxHeight); this.counter = this.counter – 1; }); } There are couple of issues I am facing. As addHTML is async, pages are added to pdf in random way. […]