Option validation and precedence
The root is a flat object of 6.4.299 PDFViewerApplicationOptions (AppOptions) names. Write options directly in the root object, without options/viewer/pdfjs wrappers. JSON cannot contain comments or trailing commas. Save the file as UTF-8 without a BOM.
- Known strings, numbers and booleans need correct types:
"2"is not2;"false"is notfalse. - The object exception is
localeProperties: {"lang":"ru"}; only lang is applied. - Unknown names and incorrect types are skipped with a warning. viewerCssTheme is restricted to 0, 1, 2. Follow the reference for other numeric enums: the loader does not validate every range.
- Options with null defaults, runtime objects, functions and workerPort cannot be configured through JSON. The API parameter rangeChunkSize is absent from viewer AppOptions and is not accepted in a profile.
- Do not edit app_options.js, viewer.mjs or pdf.mjs: the profile is applied before viewer startup.
PDF.js defaults are loaded first, followed by accepted JSON options. An active profile forces disablePreferences=true, so browser Preferences cannot replace it. Even empty {} uses this rule. JSON disablePreferences=false is ignored; use config=none for normal Preferences. A nonempty profile with only rejected options and no disablePreferences key preserves standard preference behavior.
Preferences and a particular PDF view history are separate. viewOnLoad=0 can restore the previous page, zoom and modes. Set viewOnLoad=1 to use initial profile settings. An explicit #page=3&zoom=150 still selects page/zoom and may override the profile. JSON specifies startup behavior; it does not lock buttons or user actions.