parallax/jsPDF · error · Error
Page mode must be one of UseNone, UseOutlines, UseThumbs, or
Error message
Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "{pmode}" is not recognized. What it means
`setPageMode` (src/jspdf.js:917) sets how a PDF viewer displays the document (panels/thumbnails/fullscreen). It allows undefined/null (default) plus exactly `UseNone`, `UseOutlines`, `UseThumbs`, `FullScreen` — case-sensitive. It throws at src/jspdf.js:927 for any other value. This maps to the PDF spec's PageMode entry.
Source
Thrown at src/jspdf.js:928
});
API.__private__.getZoomMode = function() {
return zoomMode;
};
var pageMode; // default: 'UseOutlines';
var setPageMode = (API.__private__.setPageMode = function(pmode) {
var validPageModes = [
undefined,
null,
"UseNone",
"UseOutlines",
"UseThumbs",
"FullScreen"
];
if (validPageModes.indexOf(pmode) == -1) {
throw new Error(
'Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "' +
pmode +
'" is not recognized.'
);
}
pageMode = pmode;
});
API.__private__.getPageMode = function() {
return pageMode;
};
var layoutMode; // default: 'continuous';
var setLayoutMode = (API.__private__.setLayoutMode = function(layout) {
var validLayoutModes = [
undefined,
null,
"continuous",View on GitHub (pinned to a3930ce03a)
Solutions
- Pass one of the exact PDF PageMode values: `'UseNone'`, `'UseOutlines'`, `'UseThumbs'`, `'FullScreen'` (note the capitalization).
- For the default, pass undefined/null or omit the call.
- Keep a constant map in your app so callers use tokens, not free strings.
Example fix
// before
doc.setPageMode('fullscreen');
// after
doc.setPageMode('FullScreen'); Defensive patterns
Strategy: validation
Validate before calling
var PAGE_MODES = ['UseNone','UseOutlines','UseThumbs','FullScreen'];
function safePageMode(m) {
return PAGE_MODES.indexOf(m) !== -1 ? m : undefined;
}
var pm = safePageMode(userMode);
if (pm) doc.internal.__private__.setPageMode(pm); Type guard
function isValidPageMode(m) {
return m == null || ['UseNone','UseOutlines','UseThumbs','FullScreen'].indexOf(m) !== -1;
} Try / catch
try {
doc.internal.__private__.setPageMode(mode);
} catch (e) {
if (/Page mode must be/.test(e.message)) {
doc.internal.__private__.setPageMode('UseNone'); // safe default
} else throw e;
} Prevention
- Pass the exact capitalized tokens from the PDF spec set.
- Keep a constant map so callers use tokens, not free strings.
- Remember undefined/null means default.
When it happens
Trigger: `doc.setPageMode('fullscreen')` (lowercase); `'useOutlines'`; `'FullPage'`; a value copied from a different library's API like `'single'` (that's a layout mode, not a page mode).
Common situations: Case mismatch from constants defined elsewhere; confusing page mode with layout mode (single/continuous); using viewer-specific terminology not in the PDF spec set.
Related errors
- zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%
- Layout mode must be one of continuous, single, twoleft, twor
- Invalid unit: {unit}
- Invalid format: ${format}
- Invalid arguments passed to PubSub.subscribe (jsPDF-module)
AI-assisted analysis of parallax/jsPDF@a3930ce03a (2026-08-13).
Data as JSON: /api/errors/4393e2cf99cff1d3.
Report an issue: GitHub.