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;
|
||||
}
|
||||
const numLabels = labels.length;
|
||||
if (numLabels !== this.pagesCount) {
|
||||
console.error(
|
||||
"The number of Page Labels does not match the number of pages in the document."
|
||||
);
|
||||
return;
|
||||
// Ignore page labels that correspond to standard page numbering,
|
||||
// or page labels that are all empty.
|
||||
let standardLabels = 0,
|
||||
emptyLabels = 0;
|
||||
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;
|
||||
// Ignore page labels that correspond to standard page numbering.
|
||||
while (i < numLabels && labels[i] === (i + 1).toString()) {
|
||||
i++;
|
||||
}
|
||||
if (i === numLabels) {
|
||||
if (standardLabels >= numLabels || emptyLabels >= numLabels) {
|
||||
return;
|
||||
}
|
||||
const { pdfViewer, pdfThumbnailViewer, toolbar } = this;
|
||||
|
Loading…
Reference in New Issue
Block a user