mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 23:28:06 +02:00
Move the cMapUrl
and cMapPacked
options from the global PDFJS
object and into getDocument
instead
This commit is contained in:
parent
b674409397
commit
3c2fbdffe6
13 changed files with 72 additions and 63 deletions
15
web/app.js
15
web/app.js
|
@ -50,15 +50,6 @@ import { ViewHistory } from './view_history';
|
|||
const DEFAULT_SCALE_DELTA = 1.1;
|
||||
const DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
|
||||
|
||||
function configure(PDFJS) {
|
||||
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {
|
||||
PDFJS.cMapUrl = '../external/bcmaps/';
|
||||
} else {
|
||||
PDFJS.cMapUrl = '../web/cmaps/';
|
||||
}
|
||||
PDFJS.cMapPacked = true;
|
||||
}
|
||||
|
||||
const DefaultExternalServices = {
|
||||
updateFindControlState(data) {},
|
||||
initPassiveLoading(callbacks) {},
|
||||
|
@ -142,8 +133,6 @@ let PDFViewerApplication = {
|
|||
// Called once when the document is loaded.
|
||||
initialize(appConfig) {
|
||||
this.preferences = this.externalServices.createPreferences();
|
||||
|
||||
configure(PDFJS);
|
||||
this.appConfig = appConfig;
|
||||
|
||||
return this._readPreferences().then(() => {
|
||||
|
@ -298,8 +287,8 @@ let PDFViewerApplication = {
|
|||
}
|
||||
if ((typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) &&
|
||||
hashParams['disablebcmaps'] === 'true') {
|
||||
PDFJS.cMapUrl = '../external/cmaps/';
|
||||
PDFJS.cMapPacked = false;
|
||||
AppOptions.set('cMapUrl', '../external/cmaps/');
|
||||
AppOptions.set('cMapPacked', false);
|
||||
}
|
||||
if ('textlayer' in hashParams) {
|
||||
switch (hashParams['textlayer']) {
|
||||
|
|
|
@ -128,6 +128,17 @@ const defaultOptions = {
|
|||
kind: OptionKind.VIEWER,
|
||||
},
|
||||
|
||||
cMapPacked: {
|
||||
/** @type {boolean} */
|
||||
value: true,
|
||||
kind: OptionKind.API,
|
||||
},
|
||||
cMapUrl: {
|
||||
/** @type {string} */
|
||||
value: (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION') ?
|
||||
'../external/bcmaps/' : '../web/cmaps/'),
|
||||
kind: OptionKind.API,
|
||||
},
|
||||
maxImageSize: {
|
||||
/** @type {number} */
|
||||
value: -1,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue