@@ -608,8 +608,8 @@ class PDFDocumentProxy {
608608 /**
609609 * @param {{num: number, gen: number} } ref - The page reference. Must have
610610 * the `num` and `gen` properties.
611- * @returns {Promise } A promise that is resolved with the page index that is
612- * associated with the reference.
611+ * @returns {Promise } A promise that is resolved with the page index (starting
612+ * from zero) that is associated with the reference.
613613 */
614614 getPageIndex ( ref ) {
615615 return this . _transport . getPageIndex ( ref ) ;
@@ -909,7 +909,7 @@ class PDFDocumentProxy {
909909 */
910910class PDFPageProxy {
911911 constructor ( pageIndex , pageInfo , transport , pdfBug = false ) {
912- this . pageIndex = pageIndex ;
912+ this . _pageIndex = pageIndex ;
913913 this . _pageInfo = pageInfo ;
914914 this . _transport = transport ;
915915 this . _stats = pdfBug ? new StatTimer ( ) : null ;
@@ -927,7 +927,7 @@ class PDFPageProxy {
927927 * @type {number } Page number of the page. First page is 1.
928928 */
929929 get pageNumber ( ) {
930- return this . pageIndex + 1 ;
930+ return this . _pageIndex + 1 ;
931931 }
932932
933933 /**
@@ -999,7 +999,7 @@ class PDFPageProxy {
999999 getAnnotations ( { intent = null } = { } ) {
10001000 if ( ! this . annotationsPromise || this . annotationsIntent !== intent ) {
10011001 this . annotationsPromise = this . _transport . getAnnotations (
1002- this . pageIndex ,
1002+ this . _pageIndex ,
10031003 intent
10041004 ) ;
10051005 this . annotationsIntent = intent ;
@@ -1063,7 +1063,7 @@ class PDFPageProxy {
10631063 this . _stats . time ( "Page Request" ) ;
10641064 }
10651065 this . _pumpOperatorList ( {
1066- pageIndex : this . pageNumber - 1 ,
1066+ pageIndex : this . _pageIndex ,
10671067 intent : renderingIntent ,
10681068 renderInteractiveForms : renderInteractiveForms === true ,
10691069 } ) ;
@@ -1111,7 +1111,7 @@ class PDFPageProxy {
11111111 objs : this . objs ,
11121112 commonObjs : this . commonObjs ,
11131113 operatorList : intentState . operatorList ,
1114- pageNumber : this . pageNumber ,
1114+ pageIndex : this . _pageIndex ,
11151115 canvasFactory : canvasFactoryInstance ,
11161116 webGLContext,
11171117 useRequestAnimationFrame : renderingIntent !== "print" ,
@@ -1180,7 +1180,7 @@ class PDFPageProxy {
11801180 this . _stats . time ( "Page Request" ) ;
11811181 }
11821182 this . _pumpOperatorList ( {
1183- pageIndex : this . pageIndex ,
1183+ pageIndex : this . _pageIndex ,
11841184 intent : renderingIntent ,
11851185 } ) ;
11861186 }
@@ -1200,7 +1200,7 @@ class PDFPageProxy {
12001200 return this . _transport . messageHandler . sendWithStream (
12011201 "GetTextContent" ,
12021202 {
1203- pageIndex : this . pageNumber - 1 ,
1203+ pageIndex : this . _pageIndex ,
12041204 normalizeWhitespace : normalizeWhitespace === true ,
12051205 combineTextItems : disableCombineTextItems !== true ,
12061206 } ,
@@ -1249,7 +1249,7 @@ class PDFPageProxy {
12491249 */
12501250 _destroy ( ) {
12511251 this . destroyed = true ;
1252- this . _transport . pageCache [ this . pageIndex ] = null ;
1252+ this . _transport . pageCache [ this . _pageIndex ] = null ;
12531253
12541254 const waitOn = [ ] ;
12551255 Object . keys ( this . intentStates ) . forEach ( intent => {
@@ -2734,7 +2734,7 @@ const InternalRenderTask = (function InternalRenderTaskClosure() {
27342734 objs,
27352735 commonObjs,
27362736 operatorList,
2737- pageNumber ,
2737+ pageIndex ,
27382738 canvasFactory,
27392739 webGLContext,
27402740 useRequestAnimationFrame = false ,
@@ -2746,7 +2746,7 @@ const InternalRenderTask = (function InternalRenderTaskClosure() {
27462746 this . commonObjs = commonObjs ;
27472747 this . operatorListIdx = null ;
27482748 this . operatorList = operatorList ;
2749- this . pageNumber = pageNumber ;
2749+ this . _pageIndex = pageIndex ;
27502750 this . canvasFactory = canvasFactory ;
27512751 this . webGLContext = webGLContext ;
27522752 this . _pdfBug = pdfBug ;
@@ -2786,7 +2786,7 @@ const InternalRenderTask = (function InternalRenderTaskClosure() {
27862786 globalThis . StepperManager &&
27872787 globalThis . StepperManager . enabled
27882788 ) {
2789- this . stepper = globalThis . StepperManager . create ( this . pageNumber - 1 ) ;
2789+ this . stepper = globalThis . StepperManager . create ( this . _pageIndex ) ;
27902790 this . stepper . init ( this . operatorList ) ;
27912791 this . stepper . nextBreakPoint = this . stepper . getNextBreakPoint ( ) ;
27922792 }
@@ -2831,7 +2831,7 @@ const InternalRenderTask = (function InternalRenderTaskClosure() {
28312831 this . callback (
28322832 error ||
28332833 new RenderingCancelledException (
2834- `Rendering cancelled, page ${ this . pageNumber } ` ,
2834+ `Rendering cancelled, page ${ this . _pageIndex + 1 } ` ,
28352835 "canvas"
28362836 )
28372837 ) ;
0 commit comments