diff --git a/web/app.js b/web/app.js index bde59a9d2..c3743396e 100644 --- a/web/app.js +++ b/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;