Merge pull request #14191 from Snuffleupagus/viewer-empty-pageLabels
Ignore pageLabels, in the viewer, when they're all empty
This commit is contained in:
		
						commit
						6f3700b393
					
				
							
								
								
									
										25
									
								
								web/app.js
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								web/app.js
									
									
									
									
									
								
							| @ -1632,18 +1632,21 @@ const PDFViewerApplication = { | |||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|     const numLabels = labels.length; |     const numLabels = labels.length; | ||||||
|     if (numLabels !== this.pagesCount) { |     // Ignore page labels that correspond to standard page numbering,
 | ||||||
|       console.error( |     // or page labels that are all empty.
 | ||||||
|         "The number of Page Labels does not match the number of pages in the document." |     let standardLabels = 0, | ||||||
|       ); |       emptyLabels = 0; | ||||||
|       return; |     for (let i = 0; i < numLabels; i++) { | ||||||
|  |       const label = labels[i]; | ||||||
|  |       if (label === (i + 1).toString()) { | ||||||
|  |         standardLabels++; | ||||||
|  |       } else if (label === "") { | ||||||
|  |         emptyLabels++; | ||||||
|  |       } else { | ||||||
|  |         break; | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|     let i = 0; |     if (standardLabels >= numLabels || emptyLabels >= numLabels) { | ||||||
|     // Ignore page labels that correspond to standard page numbering.
 |  | ||||||
|     while (i < numLabels && labels[i] === (i + 1).toString()) { |  | ||||||
|       i++; |  | ||||||
|     } |  | ||||||
|     if (i === numLabels) { |  | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|     const { pdfViewer, pdfThumbnailViewer, toolbar } = this; |     const { pdfViewer, pdfThumbnailViewer, toolbar } = this; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user