{"record":{"id":"38758abc351900f1","repo":"mozilla/pdf.js","slug":"base-font-is-not-specified","errorCode":null,"errorMessage":"Base font is not specified","messagePattern":"Base font is not specified","errorType":"exception","errorClass":"FormatError","httpStatus":null,"severity":"error","filePath":"src/core/evaluator.js","lineNumber":4482,"sourceCode":"    if (!descriptor) {\n      if (isType3Font) {\n        // FontDescriptor is only required for Type3 fonts when the document\n        // is a tagged pdf.\n        descriptor = Dict.empty;\n      } else if (composite) {\n        // Some PDFs omit the FontDescriptor on the descendant CIDFont when\n        // referencing one of the standard Acrobat CJK fonts via a predefined\n        // CMap (e.g. /Encoding /90ms-RKSJ-H with /BaseFont /HeiseiMin-W3).\n        // Fall through so the CMap is loaded by the composite-font path\n        // below; otherwise multi-byte codes would be decoded byte-by-byte.\n        descriptor = Dict.empty;\n      } else {\n        // Before PDF 1.5 if the font was one of the base 14 fonts, having a\n        // FontDescriptor was not required.\n        // This case is here for compatibility.\n        let baseFontName = dict.get(\"BaseFont\");\n        if (!(baseFontName instanceof Name)) {\n          throw new FormatError(\"Base font is not specified\");\n        }\n\n        // Using base font name as a font name.\n        baseFontName = normalizeFontName(baseFontName.name);\n        const metrics = this.getBaseFontMetrics(baseFontName);\n\n        // Simulating descriptor flags attribute\n        const fontNameWoStyle = baseFontName.split(\"-\", 1)[0];\n        const flags =\n          (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) |\n          (metrics.monospace ? FontFlags.FixedPitch : 0) |\n          (getSymbolsFonts()[fontNameWoStyle]\n            ? FontFlags.Symbolic\n            : FontFlags.Nonsymbolic);\n\n        const properties = {\n          type,\n          name: baseFontName,","sourceCodeStart":4464,"sourceCodeEnd":4500,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/core/evaluator.js#L4464-L4500","documentation":"Thrown by translateFont() when a non-composite, non-Type3 font has no /FontDescriptor AND its /BaseFont entry is not a Name. This is a legacy-compatibility path (pre-PDF-1.5 base-14 fonts like Helvetica did not require a FontDescriptor), where PDF.js falls back to synthesizing a descriptor from the BaseFont name; if even that name is missing or not a Name, the font is unrecoverable. The guard precedes normalizeFontName() which would otherwise crash on a non-string.","triggerScenarios":"A simple (non-Type0, non-Type3) font dictionary with no /FontDescriptor and a /BaseFont that is missing, null, a string, or any non-Name object. Fires during translateFont() in the font-load path.","commonSituations":"Older or minimalist PDF producers that omit FontDescriptor and also fail to declare BaseFont as a Name. Also seen in heavily stripped/subset PDFs where optimization removed the BaseFont. Rare; typically indicates a seriously malformed font dictionary.","solutions":["Re-export the PDF from the source application or through Ghostscript to populate /BaseFont and /FontDescriptor.","If authoring, always include /BaseFont as a Name on every font dictionary.","Isolate the failing page with stopAtErrors: true and continue rendering others.","If the document opens in Acrobat, file a PDF.js bug — additional fallback heuristics may be possible."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await page.render({ canvasContext, viewport });\n} catch (e) {\n  if (e.name === 'FormatError' && /Base font is not specified/.test(e.message)) {\n    // legacy font has neither descriptor nor BaseFont — use fallback\n  } else throw e;\n}","preventionTips":["Always include /BaseFont as a Name on every font dictionary, even legacy base-14 fonts.","Add a /FontDescriptor to avoid relying on the legacy fallback path entirely.","Re-export old PDFs through a modern exporter to populate missing metadata."],"tags":["pdf","font","base-font","font-descriptor","format-error"],"backgroundTag":null,"analyzedSha":"5903d58d58e4dd9ce6ffa3834aea8480f06b4ada","analyzedAt":"2026-08-13T02:28:27.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}