Reputation: 133
Basic question...is there a way to set a default setting for spread view in PDF.js viewer?
I want to be able to change the spread setting based on my layout, for example to 'no spreads' option but I can't find procedure for this in the official documentation or on the internet.
Upvotes: 3
Views: 2425
Reputation: 133
Ok, I managed to find the solution and it wasn't so hard after all.
For anyone struggling with this problem, you need to open viewer.js and change "spreadModeOnLoad" (-1 is for the last browsers (or PDF file's) default state, 0 is for no spreads and 1 is for obligatory spreads).
The part of the code is located here:
function getDefaultPreferences() {
if (!defaultPreferences) {
defaultPreferences = Promise.resolve({
"cursorToolOnLoad": 0,
"defaultZoomValue": "",
"disablePageLabels": false,
"enablePermissions": false,
"enablePrintAutoRotate": false,
"enableWebGL": false,
"externalLinkTarget": 0,
"historyUpdateUrl": false,
"ignoreDestinationZoom": false,
"pdfBugEnabled": false,
"renderer": "canvas",
"renderInteractiveForms": true,
"sidebarViewOnLoad": -1,
"scrollModeOnLoad": -1,
"spreadModeOnLoad": 1,
"textLayerMode": 1,
"useOnlyCssZoom": false,
"viewOnLoad": 0,
"disableAutoFetch": false,
"disableFontFace": false,
"disableRange": false,
"disableStream": false
});
}
return defaultPreferences;
}
Upvotes: 4