1

I am trying to convert html content to pdf report using jspdf.

Here is the typescript code.This works fine for small html content.

download() {
    const doc = new jsPDF('p', 'pt', 'a4');

    const seh = {
      '#editor' : function (element, renderer) {
        return true;
      }
    };

    const content = this.cont.nativeElement;
    const cont = content.innerHTML.toString();

    doc.fromHTML(cont, 15, 15, {
      'width': 180,
      'pagesplit': true,
      'elementHandlers' : seh
    });

    doc.save('terms&conditions.pdf');
}

But for the large html content it fail.I added the pagesplit true property for options but it also does not work.

I tried Convert HTML to PDF in Angular 6 this url. But it also does not work for large html contents.

Is any one can describe how to fix this issue. it will be great helpful. Thanks in advance.

Shalika
  • 1,457
  • 2
  • 19
  • 38
  • 1
    The correct way to build your html content`s pdf is to create your dynamic html at code level and then convert it into pdf. Please see this https://pdfkit.org/ – Fahad Hassan Jan 30 '20 at 08:04

0 Answers0