{"record":{"id":"05f0ff7c1f45c5e6","repo":"mozilla/pdf.js","slug":"invalid-style-style-in-pagelabel-dictionary","errorCode":null,"errorMessage":"Invalid style \"${style}\" in PageLabel dictionary.","messagePattern":"Invalid style \"(.+?)\" in PageLabel dictionary\\.","errorType":"exception","errorClass":"FormatError","httpStatus":null,"severity":"warning","filePath":"src/core/catalog.js","lineNumber":933,"sourceCode":"        case \"r\":\n          currentLabel = toRomanNumerals(currentIndex, style === \"r\");\n          break;\n        case \"A\":\n        case \"a\":\n          const LIMIT = 26; // Use only the characters A-Z, or a-z.\n          const A_UPPER_CASE = 0x41,\n            A_LOWER_CASE = 0x61;\n\n          const baseCharCode = style === \"a\" ? A_LOWER_CASE : A_UPPER_CASE;\n          const letterIndex = currentIndex - 1;\n          const character = String.fromCharCode(\n            baseCharCode + (letterIndex % LIMIT)\n          );\n          currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);\n          break;\n        default:\n          if (style) {\n            throw new FormatError(\n              `Invalid style \"${style}\" in PageLabel dictionary.`\n            );\n          }\n          currentLabel = \"\";\n      }\n\n      pageLabels[i] = prefix + currentLabel;\n      currentIndex++;\n    }\n    return pageLabels;\n  }\n\n  get pageLayout() {\n    const obj = this.#catDict.get(\"PageLayout\");\n    // Purposely use a non-standard default value, rather than 'SinglePage', to\n    // allow differentiating between `undefined` and /SinglePage since that does\n    // affect the Scroll mode (continuous/non-continuous) used in Adobe Reader.\n    let pageLayout = \"\";","sourceCodeStart":915,"sourceCodeEnd":951,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/core/catalog.js#L915-L951","documentation":"Thrown in Catalog.#readPageLabels() (catalog.js:933) when the resolved style name is not one of the recognised values (D, R, r, A, a). After validating /S is a Name, the switch on style falls through to default; if style is non-null there, it is an unsupported/unknown style. Caught and downgraded to a warning by the pageLabels getter.","triggerScenarios":"labelDict /S is a Name but its .name is something other than D/R/r/A/a (e.g., /I, /i, or a typo). The switch default branch fires and, because style is truthy, throws. Reached via pdfDocument.pageLabels.","commonSituations":"A producer using a non-standard or future style name PDF.js does not support; a corrupt label dict; an edited PDF. Non-fatal.","solutions":["Accept the null-labels degradation if labels are cosmetic.","Repair the PDF to use a standard /S (/D, /R, /r, /A, /a).","When producing PDFs, use only the five standard label styles.","Check for an updated PDF.js build that may support additional styles."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"const labels = pdf.pageLabels; // null when style is unsupported\nif (!labels) { /* fall back to default numbering */ }","preventionTips":["Treat null pageLabels as 'unsupported/invalid labels'.","Use only standard styles (/D,/R,/r,/A,/a) when producing PDFs.","Repair non-standard label dicts with qpdf/mutool.","Update PDF.js in case newer styles are supported."],"tags":["pdf-structure","catalog","page-labels","corrupt-pdf","validation","unsupported-feature"],"backgroundTag":null,"analyzedSha":"5903d58d58e4dd9ce6ffa3834aea8480f06b4ada","analyzedAt":"2026-08-13T02:28:27.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}