We have an invoice template that mostly goes fine but now I found a case where somehow an additional header is displayed but there are no detail lines left.
I would have expected the header to appear once, after each page break but here it appears twice on 1 page.
I just found out it has something to do with my post pagination script but I don’t know why. If I disable it then it will not happen. Unfortunately the top header of the invoice can be dynamic and so I want to calculate the height and then resize the top margin according to that.
It seems that in your template the .paginage() function is not behaving as intended. I created a quick workaround by counting the number of header tables before this function and compare the length after. See the script below. Suggest to reachout to our techsupport department and file a bug report.
Erik
let noInvoiceTables = query("#INVOICELINES").length;
let headerSize = ((query("#invoiceHeader").height() + query("#invoiceHeader2").height()) / 94) + 0.3;
merge.section.margins.top = headerSize.toString() + "in";
merge.section.paginate();
if ( query("#INVOICELINES").length > noInvoiceTables ) {
query("#INVOICELINES:last-of-type").hide();
}
Hi I have encountered this issue as well with version v2023.
And Eriks script helped. This is my workaround.
query("[your dynamic table]").each(function(o,i){
var tbodyVal = query("tbody",i).html().trim();
if(tbodyVal=="") i.hide();
})
However if you have content after the table. Hiding the empty table will cause a shift in the position of the content. Also the more the document creates a new page, each page break creates that extra table (multiplies).