1

export-as and exporting pdf, exported pdf document is not proper it is not streching fully red mark inserted for reference,attached image . Below is my config:

  exportAsConfig: ExportAsConfig = {
    type: 'pdf', // the type you want to download
    //elementId: 'balance-sheet-preview', // the id of html/table element
    elementId: 'contentToConvert', // the id of html/table element
    options: { // html-docx-js document options
      margins: {
        top: '20',
        bottom: '5'
      },
      orientation: 'landscape',
      filename: 'engagement.pdf',
      image: { type: 'jpeg', quality: 1 },
    }
  }

call in function:

export(){
this.exportAsService.save(this.exportAsConfig, 'engagementLetter').subscribe(() => {
      // save started
    });
}

Any solution for thisenter image description here

Html print snippet image: enter image description here

Sudhir
  • 1
  • 1
  • 9
  • 24

2 Answers2

2

in google chrom you can set the view to print and specify media type to print then add css related to print type this css will applied only in printing mood use this answer to check how to switch to print mood .

moath naji
  • 663
  • 1
  • 4
  • 20
  • you can do this in backend create multiple templates with specific formats and print the whole view whenever request come from the angular side or you can use something front end in angular like https://www.ngdevelop.tech/angular-8-export-to-pdf-using-pdfmake/ – moath naji Nov 21 '19 at 10:37
1

I have lot of experience with pdf in Angular.

Among all of them best library is https://www.npmjs.com/package/jspdf

Example : https://rawgit.com/MrRio/jsPDF/master/

Docs : https://rawgit.com/MrRio/jsPDF/master/docs/

Suhag Lapani
  • 655
  • 10
  • 18