mozilla/pdf.js · error · Error
Not implemented: getOperatorList
Error message
Not implemented: getOperatorList
What it means
A generic Error from PDFPageProxy.getOperatorList: the method is only available in the GENERIC build. The guard throws when PDFJSDev is defined and the build is not GENERIC (e.g. MOZCENTRAL or CHROME). getOperatorList exposes the raw display-List for debugging/tooling and is intentionally omitted from shipped browser builds.
Source
Thrown at src/display/api.js:1692
.catch(complete);
return renderTask;
}
/**
* @param {GetOperatorListParameters} params - Page getOperatorList
* parameters.
* @returns {Promise<PDFOperatorList>} A promise resolved with an
* {@link PDFOperatorList} object that represents the page's operator list.
*/
getOperatorList({
intent = "display",
annotationMode = AnnotationMode.ENABLE,
printAnnotationStorage = null,
isEditing = false,
} = {}) {
if (typeof PDFJSDev !== "undefined" && !PDFJSDev.test("GENERIC")) {
throw new Error("Not implemented: getOperatorList");
}
function operatorListChanged() {
if (intentState.operatorList.lastChunk) {
intentState.opListReadCapability.resolve(intentState.operatorList);
intentState.renderTasks.delete(opListTask);
}
}
const intentArgs = this._transport.getRenderingIntent(
intent,
annotationMode,
printAnnotationStorage,
isEditing,
/* isOpList = */ true
);
const intentState = this._intentStates.getOrInsertComputed(
intentArgs.cacheKey,View on GitHub (pinned to 5903d58d58)
Solutions
- Use the GENERIC build (npm pdfjs-dist) where getOperatorList is available.
- Feature-detect before calling: if (typeof page.getOperatorList === 'function').
- Rebuild with the generic target (npx gulp generic).
Example fix
// before
const opList = await page.getOperatorList(); // throws in MOZCENTRAL
// after
if (typeof page.getOperatorList === 'function') {
const opList = await page.getOperatorList();
} else {
// build does not support operator-list export; use GENERIC build
} Defensive patterns
Strategy: type-guard
Validate before calling
if (typeof page.getOperatorList !== 'function') {
throw new Error('getOperatorList unavailable: use the GENERIC build');
} Type guard
function supportsOperatorList(page) {
return typeof page.getOperatorList === 'function';
} Prevention
- Use the GENERIC (pdfjs-dist) build when you need getOperatorList.
- Feature-detect before calling build-gated APIs.
- Keep worker and API builds from the same target and version.
When it happens
Trigger: Calling page.getOperatorList() in a MOZCENTRAL or CHROME build; running third-party code that assumes the GENERIC API surface against a non-generic bundle; tooling built against pdfjs-dist but loaded in Firefox's built-in viewer.
Common situations: Using the Firefox-bundled pdf.js for an extension that needs operator-list access; mismatched build vs. API expectations; tests run against the wrong target.
Related errors
- Not implemented: NetworkStream
- getDocument - expected either `data`, `range`, or `url` para
- Must use the same `intent`-argument when calling the `PDFPag
- Cannot use more than one PDFWorker per port.
AI-assisted analysis of mozilla/pdf.js@5903d58d58 (2026-08-13).
Data as JSON: /api/errors/c6004fc25a39ce01.
Report an issue: GitHub.