{"record":{"id":"4393e2cf99cff1d3","repo":"parallax/jsPDF","slug":"page-mode-must-be-one-of-usenone-useoutlines-use","errorCode":null,"errorMessage":"Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. \"{pmode}\" is not recognized.","messagePattern":"Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen\\. \"(.+?)\" is not recognized\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/jspdf.js","lineNumber":928,"sourceCode":"  });\n\n  API.__private__.getZoomMode = function() {\n    return zoomMode;\n  };\n\n  var pageMode; // default: 'UseOutlines';\n  var setPageMode = (API.__private__.setPageMode = function(pmode) {\n    var validPageModes = [\n      undefined,\n      null,\n      \"UseNone\",\n      \"UseOutlines\",\n      \"UseThumbs\",\n      \"FullScreen\"\n    ];\n\n    if (validPageModes.indexOf(pmode) == -1) {\n      throw new Error(\n        'Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. \"' +\n          pmode +\n          '\" is not recognized.'\n      );\n    }\n    pageMode = pmode;\n  });\n\n  API.__private__.getPageMode = function() {\n    return pageMode;\n  };\n\n  var layoutMode; // default: 'continuous';\n  var setLayoutMode = (API.__private__.setLayoutMode = function(layout) {\n    var validLayoutModes = [\n      undefined,\n      null,\n      \"continuous\",","sourceCodeStart":910,"sourceCodeEnd":946,"githubUrl":"https://github.com/parallax/jsPDF/blob/a3930ce03a585a26b2c76d12a0f413ce96f6d1a3/src/jspdf.js#L910-L946","documentation":"`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.","triggerScenarios":"`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).","commonSituations":"Case mismatch from constants defined elsewhere; confusing page mode with layout mode (single/continuous); using viewer-specific terminology not in the PDF spec set.","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."],"exampleFix":"// before\n doc.setPageMode('fullscreen');\n\n// after\n doc.setPageMode('FullScreen');","handlingStrategy":"validation","validationCode":"var PAGE_MODES = ['UseNone','UseOutlines','UseThumbs','FullScreen'];\nfunction safePageMode(m) {\n  return PAGE_MODES.indexOf(m) !== -1 ? m : undefined;\n}\nvar pm = safePageMode(userMode);\nif (pm) doc.internal.__private__.setPageMode(pm);","typeGuard":"function isValidPageMode(m) {\n  return m == null || ['UseNone','UseOutlines','UseThumbs','FullScreen'].indexOf(m) !== -1;\n}","tryCatchPattern":"try {\n  doc.internal.__private__.setPageMode(mode);\n} catch (e) {\n  if (/Page mode must be/.test(e.message)) {\n    doc.internal.__private__.setPageMode('UseNone');  // safe default\n  } else throw e;\n}","preventionTips":["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."],"tags":["viewer","pagemode","config","validation"],"backgroundTag":null,"analyzedSha":"a3930ce03a585a26b2c76d12a0f413ce96f6d1a3","analyzedAt":"2026-08-13T05:33:39.648Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}