问题描述
我有以下代码来检索到pdf文档的元素的数组列表.我正在使用A4尺寸.由于列数更多,所以我以省略号格式获取所有数据.无论如何,我可以将文档下载为横向视图而不是纵向视图,以便避开省略号并正确查看所有数据吗?作为一种替代选择,我尝试使用A1大小,它看起来像PDF一样好,但是当我从文档中取出打印件作为A4纸时出现了问题.取出打印后,字体大小非常小.因此,我希望在使用A1的横向视图中实现所有数据的正确可见而没有省略号. (这样,我在查看pdf时以及在取出相同的pdf时都不会有任何问题)
I have the below code to retrieve the array list of elements to a pdf doc.I am using A4 size. Since the number of columns are more , I am getting all the data in an ellipsis format.Is there anyway I can download the doc as a landscape view instead of portrait view, so that I can avoid the ellipsis and I can see all the datas properly ?As an alternate option I tried to use A1 size, it looks fine as a PDF , but the problem comes when i take a print out of the document as a A4 sheet. The font size is very small after taking the print out. So I want to achieve all the datas to be visible properly without any ellipsis in landscape view with A1. ( This way I will not have any issues in viewing the pdf and also when I take pritnout of the same )
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');
}
推荐答案
使用
new jsPDF('l', 'mm', 'a4');
或
var doc = new jsPDF('landscape');
代替
new jsPDF('p', 'pt', 'A4');
然后按chk
这篇关于jsPDF和jsPDF自动表格-高度问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!