2016-02-03 39 views
0

我正在使用jspdf生成我的pdf報表。我有多個顯示原理的表格,但是當我生成pdf時,表格的行在不同的頁面之間分裂,初始頁面的上一行以及稍後的頁面。如何防止在jspdf中拆分多表頁面jspdf

如果在一個頁面中沒有足夠的空間,我想在一個頁面中顯示整個表格將整個表格移動到下一頁面。 enter image description here

+0

這是怎麼接受的答案http://meta.stackexchange.com/a/5235 –

回答

1

你必須之前增加新的內容

doc = new jsPdf(); 
... 
pageHeight= doc.internal.pageSize.height; 

// Before adding new content 
y = 500 // Height position of new content 
if (y >= pageHeight) 
{ 
    doc.addPage(); 
    y = 0 // Restart height position 
} 
doc.text(x, y, "value"); 

源經常檢查實際的頁面大小:MrRio/jsPDF/issues/101