11/*!
22 *
3- * jsPDF AutoTable plugin v3.8.0
3+ * jsPDF AutoTable plugin v3.8.1
44 *
55 * Copyright (c) 2023 Simon Bengtsson, https://github.com/simonbengtsson/jsPDF-AutoTable
66 * Licensed under the MIT License.
@@ -1686,7 +1686,9 @@ function printTableWithHorizontalPageBreak(doc, table, startPos, cursor) {
16861686 doc . applyStyles ( doc . userStyles ) ;
16871687 // add page to print next columns in new page
16881688 if ( index > 0 ) {
1689- addPage ( doc , table , startPos , cursor , colsAndIndexes . columns ) ;
1689+ // When adding a page here, make sure not to print the footers
1690+ // because they were already printed before on this same loop
1691+ addPage ( doc , table , startPos , cursor , colsAndIndexes . columns , true ) ;
16901692 }
16911693 else {
16921694 // print head for selected columns
@@ -1705,21 +1707,26 @@ function printTableWithHorizontalPageBreak(doc, table, startPos, cursor) {
17051707 var lastPrintedRowIndex = lastRowIndexOfLastPage_1 ;
17061708 if ( firstColumnsToFitResult ) {
17071709 doc . applyStyles ( doc . userStyles ) ;
1710+ var firstColumnsToFit = firstColumnsToFitResult . columns ;
17081711 if ( lastRowIndexOfLastPage_1 >= 0 ) {
1709- addPage ( doc , table , startPos , cursor , firstColumnsToFitResult . columns ) ;
1712+ // When adding a page here, make sure not to print the footers
1713+ // because they were already printed before on this same loop
1714+ addPage ( doc , table , startPos , cursor , firstColumnsToFit , true ) ;
17101715 }
17111716 else {
1712- printHead ( doc , table , cursor , firstColumnsToFitResult . columns ) ;
1717+ printHead ( doc , table , cursor , firstColumnsToFit ) ;
17131718 }
1714- lastPrintedRowIndex = printBodyWithoutPageBreaks ( doc , table , lastRowIndexOfLastPage_1 + 1 , cursor , firstColumnsToFitResult . columns ) ;
1715- printFoot ( doc , table , cursor , firstColumnsToFitResult . columns ) ;
1719+ lastPrintedRowIndex = printBodyWithoutPageBreaks ( doc , table , lastRowIndexOfLastPage_1 + 1 , cursor , firstColumnsToFit ) ;
1720+ printFoot ( doc , table , cursor , firstColumnsToFit ) ;
17161721 }
17171722 // Check how many rows were printed, so that the next columns would not print more rows than that
17181723 var maxNumberOfRows = lastPrintedRowIndex - lastRowIndexOfLastPage_1 ;
17191724 // Print the next columns, never exceding maxNumberOfRows
17201725 allColumnsCanFitResult . slice ( 1 ) . forEach ( function ( colsAndIndexes ) {
17211726 doc . applyStyles ( doc . userStyles ) ;
1722- addPage ( doc , table , startPos , cursor , colsAndIndexes . columns ) ;
1727+ // When adding a page here, make sure not to print the footers
1728+ // because they were already printed before on this same loop
1729+ addPage ( doc , table , startPos , cursor , colsAndIndexes . columns , true ) ;
17231730 printBodyWithoutPageBreaks ( doc , table , lastRowIndexOfLastPage_1 + 1 , cursor , colsAndIndexes . columns , maxNumberOfRows ) ;
17241731 printFoot ( doc , table , cursor , colsAndIndexes . columns ) ;
17251732 } ) ;
@@ -2006,10 +2013,11 @@ function getRemainingPageSpace(doc, table, isLastRow, cursor) {
20062013 }
20072014 return doc . pageSize ( ) . height - cursor . y - bottomContentHeight ;
20082015}
2009- function addPage ( doc , table , startPos , cursor , columns ) {
2016+ function addPage ( doc , table , startPos , cursor , columns , suppressFooter ) {
20102017 if ( columns === void 0 ) { columns = [ ] ; }
2018+ if ( suppressFooter === void 0 ) { suppressFooter = false ; }
20112019 doc . applyStyles ( doc . userStyles ) ;
2012- if ( table . settings . showFoot === 'everyPage' ) {
2020+ if ( table . settings . showFoot === 'everyPage' && ! suppressFooter ) {
20132021 table . foot . forEach ( function ( row ) { return printRow ( doc , table , row , cursor , columns ) ; } ) ;
20142022 }
20152023 // Add user content just before adding new page ensure it will
0 commit comments