我想使用我现有的动态表制作一个 PDF 文件。我已经尝试过,结果将是 50% 成功。我使用jsPDF,结果就像。我也想更改列宽和标题文本...
组件.HTML
id="htmlData" #htmlData
我在我的容器 div 中使用它
组件.TS
import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
import * as jsPDF from 'jspdf'
@ViewChild('htmlData') htmlData: ElementRef;
public openPDF():void {
let DATA = this.htmlData.nativeElement;
let doc = new jsPDF('l','pt', 'a4');
doc.fromHTML(DATA.innerHTML,15,15,{
'width':400,
// autoSize:true,
});
doc.output('dataurlnewwindow');
}