[英]Export HTML page to pdf in angular
导出为和导出 pdf,导出的 pdf 文档不正确,它没有拉伸完全插入的红色标记以供参考,附图。 下面是我的配置:
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 },
}
}
致电 function:
export(){
this.exportAsService.save(this.exportAsConfig, 'engagementLetter').subscribe(() => {
// save started
});
}
在 google chrom 中,您可以设置要打印的视图并指定要打印的媒体类型,然后添加与打印类型相关的 css 此 css 将仅适用于打印心情使用此答案来检查如何切换到打印心情。
我对 Angular 中的 pdf 有很多经验。
其中最好的库是https://www.npmjs.com/package/jspdf
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.