如何在React中生成对象的json数组以pdf格式
使用jsPDF生成
如何以表格格式绘制 React Js / Java脚本
export class AppComponent {
convert(){
var item = [{
"Name" : "XYZ",
"Age" : "22",
"Gender" : "Male"
},
{
"Name" : "XYZ",
"Age" : "22",
"Gender" : "Male"
}];
var doc = new jsPDF();
var col = ["Name", "Age","Gender"];
var rows = [];
doc.autoTable(col, item);
doc.save('Test.pdf');
}
}
输出:
Name Age Gender
XYZ 22 Male
ABC 20 Female