Open Dev63 opened 4 years ago
I have run in to this same issue as well. As a temporary workaround I now create a brand new table each time I want to force a page break and just put an empty element in the content array (between tables) with the pageBreak specified. However, this has added a lot of unwanted complexity, having a better way to handle this would be great!
@zburkhardt-zz, that's a very interesting idea. Are you somehow doing all page break calculations outside of pdfMake and passing pdfMake the perfect structure so it will output as desired, or are you somehow able to modify the content as you describe from within a pdfMake pageBreak callback? In either case, how are you doing this?
If you try to request a page break while in a table, the
pageBreakBefore
function keeps asking you for every subsequent cell in the current row, even after you've indicated a page break for the first cell. OK.You can avoid this by setting
dontBreakRows
, but then the pageBreakBefore function receives incorrect information indicating that an extra row will be included on the current page #1955But regardless of how you handle that situation, if you break the table across a page, the document's right margin is modified in varied ways for any subsequent tables in the document. In one example it reset the right margin to 0, so I could compensate by never using that, and instead setting right margins within contained elements, but in this example, the margin is changed to a negative number: https://jsfiddle.net/h30enu5o/