@@ -661,7 +661,7 @@ const addPageNumbers = (doc: jsPDF) => {
661661// Helper: Add Table of Contents
662662const addTableOfContents = ( doc : jsPDF , sections : { title : string ; page : number } [ ] ) => {
663663 doc . addPage ( ) ;
664- doc . movePage ( doc . internal . getNumberOfPages ( ) , 2 ) ; // Move TOC to page 2
664+ doc . movePage ( doc . internal . pages . length - 1 , 2 ) ; // Move TOC to page 2
665665
666666 const margin = 20 ;
667667 let y = 30 ;
@@ -742,7 +742,7 @@ export const generateProteinReport = async (
742742 // SECTIONS
743743
744744 const allFilter = ( t : string | null ) => t !== null && t !== 'Close Contact' ;
745- sections . push ( { title : 'All Significant Interactions' , page : doc . internal . getNumberOfPages ( ) + 1 } ) ;
745+ sections . push ( { title : 'All Significant Interactions' , page : doc . internal . pages . length } ) ;
746746 addSection ( doc , "All Significant Interactions" , data , allFilter , isLightMode , false , 20 ) ;
747747
748748 sections . push ( { title : 'Salt Bridges (Ionic)' , page : doc . internal . getNumberOfPages ( ) + 1 } ) ;
@@ -760,7 +760,7 @@ export const generateProteinReport = async (
760760 // INTERFACE ANALYSIS (New)
761761 // Only show if there are multiple chains
762762 if ( metadata . chainCount > 1 ) {
763- sections . push ( { title : 'Interface Analysis' , page : doc . internal . getNumberOfPages ( ) + 1 } ) ;
763+ sections . push ( { title : 'Interface Analysis' , page : doc . internal . pages . length } ) ;
764764 addSection ( doc , "Interface Analysis (Chain Interactions)" , data , ( _t , l1 , l2 ) => {
765765 if ( l1 && l2 && l1 . chain !== l2 . chain ) return true ;
766766 return false ;
0 commit comments