mozilla/pdf.js · error · Error
app.fromPDFConverters is read-only
Error message
app.fromPDFConverters is read-only
What it means
app.fromPDFConverters is a stub returning an empty array (PDF.js has no registered PDF import converters). Per the Acrobat JS API the list is viewer-managed, so the setter throws. Assignment is rejected unconditionally.
Source
Thrown at src/scripting_api/app.js:238
set focusRect(val) {
/* TODO or not */
this._focusRect = val;
}
get formsVersion() {
return FORMS_VERSION;
}
set formsVersion(_) {
throw new Error("app.formsVersion is read-only");
}
get fromPDFConverters() {
return [];
}
set fromPDFConverters(_) {
throw new Error("app.fromPDFConverters is read-only");
}
get fs() {
return (this._fs ??= new Proxy(
new FullScreen({ send: this._send }),
this._proxyHandler
));
}
set fs(_) {
throw new Error("app.fs is read-only");
}
get language() {
return this._language;
}
set language(_) {View on GitHub (pinned to 5903d58d58)
Solutions
- Do not assign to app.fromPDFConverters; treat it as a viewer-provided (here empty) list.
- Implement any conversion outside the scripting API if needed.
- Read the property to confirm no converters are available before falling back.
Example fix
// before app.fromPDFConverters = [myConverter]; // after const converters = app.fromPDFConverters; // always [] in pdf.js
Defensive patterns
Strategy: validation
Validate before calling
// fromPDFConverters always returns [] in pdf.js; just read it. const converters = Array.isArray(app.fromPDFConverters) ? app.fromPDFConverters : [];
Type guard
const isEmptyViewerList = (v) => Array.isArray(v) && v.length === 0;
Try / catch
try { /* code that may assign app.fromPDFConverters */ }
catch (e) { if (!/fromPDFConverters is read-only/.test(e.message)) throw e; } Prevention
- Treat all viewer-list properties (fromPDFConverters, plugins, monitors, printers) as read-only.
- Do not push into the returned array expecting persistence.
- Implement converters outside the scripting API.
When it happens
Trigger: PDF JavaScript or caller executes app.fromPDFConverters = [...]; the setter at src/scripting_api/app.js:238 throws regardless of argument.
Common situations: Scripts that try to register custom converter plugins; confusion with an extensible plugin registry.
Related errors
- app.monitors is read-only
- app.numPlugins is read-only
- app.plugins is read-only
- app.activeDocs is read-only
- app.constants is read-only
AI-assisted analysis of mozilla/pdf.js@5903d58d58 (2026-08-13).
Data as JSON: /api/errors/b9803627e2aa60e4.
Report an issue: GitHub.