我有下面的代码来检索元素数组列表到一个pdf文档。我用的是A4尺寸。由于列数更多,所以我将以省略号格式获取所有数据。我是否可以将文档下载为景观视图,而不是纵向视图,这样我就可以避免省略,并正确地查看所有数据了吗?作为另一种选择,我尝试使用A1大小,它看起来像PDF格式一样好,但是当我将文档中的打印作为A4工作表时,问题就出现了。打印出来后,字体大小非常小。因此,我想要实现所有的数据是正确可见的,没有任何省略在景观视图与A1。(这样,我就不会有任何问题,在查看的pdf和当我采取同样的做法)
convert() {
const doc = new jsPDF('p', 'pt', 'A4');
const col = ['Discharge Date', 'Case Number', 'Patient', 'Hospital', 'Payee', 'Total Doctor Fee', 'To be Collected', 'Payor', 'Remarks', 'Paid', 'Unpaid'];
const rows = [];
/* The following array of object as response from the API req */
const itemNew = this.finalArList;
itemNew.forEach(element => {
const temp = [element.dischargeDate, element.caseNo, element.patientName, element.instName, element.clinicName, element.formattedTotalDrFee, element.formattedUnpaidAmounr, element.payor, element.remark, element.formattedTotalDrFee, element.formattedUnpaidAmounr];
rows.push(temp);
doc.autoTable(col, rows, {margin: {top: 10}, height: 'auto' });
});
doc.save('MyReport.pdf');
}

发布于 2018-05-23 17:00:18
使用
new jsPDF('l', 'mm', 'a4');或
var doc = new jsPDF('landscape');而不是
new jsPDF('p', 'pt', 'A4');然后请注意
https://stackoverflow.com/questions/50484000
复制相似问题