javascript - Export HTML page to pdf in angular - Stack Overflow

export-as and exporting pdf, exported pdf document is not proper it is not streching fully red markin

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 this

Html print snippet image:

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 this

Html print snippet image:

Share Improve this question edited Nov 21, 2019 at 10:20 Sudhir asked Nov 21, 2019 at 9:56 SudhirSudhir 5791 gold badge11 silver badges29 bronze badges 3
  • 1 Could you add a small snippet of HTML that allows us to recreate this issue? – Titulum Commented Nov 21, 2019 at 10:00
  • Added html snippet – Sudhir Commented Nov 21, 2019 at 10:21
  • @Titulum any other libraries to export as pdf – Sudhir Commented Nov 21, 2019 at 10:28
Add a ment  | 

2 Answers 2

Reset to default 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 .

I have lot of experience with pdf in Angular.

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

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

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745529313a4631619.html

相关推荐

  • javascript - Export HTML page to pdf in angular - Stack Overflow

    export-as and exporting pdf, exported pdf document is not proper it is not streching fully red markin

    3小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信