Convert the files in the /src/display
folder to ES6 modules
Also disables ES2015 transpilation in development mode.
This commit is contained in:
parent
c6e8ca863e
commit
52e3de3c0a
@ -13,30 +13,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
import {
|
||||||
|
addLinkAttributes, CustomStyle, getDefaultSetting, getFilenameFromUrl,
|
||||||
(function (root, factory) {
|
LinkTarget
|
||||||
if (typeof define === 'function' && define.amd) {
|
} from './dom_utils';
|
||||||
define('pdfjs/display/annotation_layer', ['exports', 'pdfjs/shared/util',
|
import {
|
||||||
'pdfjs/display/dom_utils'], factory);
|
AnnotationBorderStyleType, AnnotationType, stringToPDFString, Util, warn
|
||||||
} else if (typeof exports !== 'undefined') {
|
} from '../shared/util';
|
||||||
factory(exports, require('../shared/util.js'), require('./dom_utils.js'));
|
|
||||||
} else {
|
|
||||||
factory((root.pdfjsDisplayAnnotationLayer = {}), root.pdfjsSharedUtil,
|
|
||||||
root.pdfjsDisplayDOMUtils);
|
|
||||||
}
|
|
||||||
}(this, function (exports, sharedUtil, displayDOMUtils) {
|
|
||||||
|
|
||||||
var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType;
|
|
||||||
var AnnotationType = sharedUtil.AnnotationType;
|
|
||||||
var stringToPDFString = sharedUtil.stringToPDFString;
|
|
||||||
var Util = sharedUtil.Util;
|
|
||||||
var addLinkAttributes = displayDOMUtils.addLinkAttributes;
|
|
||||||
var LinkTarget = displayDOMUtils.LinkTarget;
|
|
||||||
var getFilenameFromUrl = displayDOMUtils.getFilenameFromUrl;
|
|
||||||
var warn = sharedUtil.warn;
|
|
||||||
var CustomStyle = displayDOMUtils.CustomStyle;
|
|
||||||
var getDefaultSetting = displayDOMUtils.getDefaultSetting;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} AnnotationElementParameters
|
* @typedef {Object} AnnotationElementParameters
|
||||||
@ -1209,5 +1192,6 @@ var AnnotationLayer = (function AnnotationLayerClosure() {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
exports.AnnotationLayer = AnnotationLayer;
|
export {
|
||||||
}));
|
AnnotationLayer,
|
||||||
|
};
|
||||||
|
@ -14,56 +14,20 @@
|
|||||||
*/
|
*/
|
||||||
/* globals requirejs, __pdfjsdev_webpack__ */
|
/* globals requirejs, __pdfjsdev_webpack__ */
|
||||||
|
|
||||||
'use strict';
|
import {
|
||||||
|
createPromiseCapability, deprecated, error, getVerbosityLevel, globalScope,
|
||||||
(function (root, factory) {
|
info, InvalidPDFException, isArray, isArrayBuffer, isInt, isSameOrigin,
|
||||||
if (typeof define === 'function' && define.amd) {
|
loadJpegStream, MessageHandler, MissingPDFException, PageViewport,
|
||||||
define('pdfjs/display/api', ['exports', 'pdfjs/shared/util',
|
PasswordException, StatTimer, stringToBytes, UnexpectedResponseException,
|
||||||
'pdfjs/display/font_loader', 'pdfjs/display/canvas',
|
UnknownErrorException, Util, warn
|
||||||
'pdfjs/display/metadata', 'pdfjs/display/dom_utils',
|
} from '../shared/util';
|
||||||
'require'], factory);
|
import {
|
||||||
} else if (typeof exports !== 'undefined') {
|
DOMCanvasFactory, DOMCMapReaderFactory, getDefaultSetting,
|
||||||
factory(exports, require('../shared/util.js'), require('./font_loader.js'),
|
RenderingCancelledException
|
||||||
require('./canvas.js'), require('./metadata.js'),
|
} from './dom_utils';
|
||||||
require('./dom_utils.js'));
|
import { FontFaceObject, FontLoader } from './font_loader';
|
||||||
} else {
|
import { CanvasGraphics } from './canvas';
|
||||||
factory((root.pdfjsDisplayAPI = {}), root.pdfjsSharedUtil,
|
import { Metadata } from './metadata';
|
||||||
root.pdfjsDisplayFontLoader, root.pdfjsDisplayCanvas,
|
|
||||||
root.pdfjsDisplayMetadata, root.pdfjsDisplayDOMUtils);
|
|
||||||
}
|
|
||||||
}(this, function (exports, sharedUtil, displayFontLoader, displayCanvas,
|
|
||||||
displayMetadata, displayDOMUtils, amdRequire) {
|
|
||||||
|
|
||||||
var InvalidPDFException = sharedUtil.InvalidPDFException;
|
|
||||||
var MessageHandler = sharedUtil.MessageHandler;
|
|
||||||
var MissingPDFException = sharedUtil.MissingPDFException;
|
|
||||||
var PageViewport = sharedUtil.PageViewport;
|
|
||||||
var PasswordException = sharedUtil.PasswordException;
|
|
||||||
var StatTimer = sharedUtil.StatTimer;
|
|
||||||
var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
|
|
||||||
var UnknownErrorException = sharedUtil.UnknownErrorException;
|
|
||||||
var Util = sharedUtil.Util;
|
|
||||||
var createPromiseCapability = sharedUtil.createPromiseCapability;
|
|
||||||
var error = sharedUtil.error;
|
|
||||||
var deprecated = sharedUtil.deprecated;
|
|
||||||
var getVerbosityLevel = sharedUtil.getVerbosityLevel;
|
|
||||||
var info = sharedUtil.info;
|
|
||||||
var isInt = sharedUtil.isInt;
|
|
||||||
var isArray = sharedUtil.isArray;
|
|
||||||
var isArrayBuffer = sharedUtil.isArrayBuffer;
|
|
||||||
var isSameOrigin = sharedUtil.isSameOrigin;
|
|
||||||
var loadJpegStream = sharedUtil.loadJpegStream;
|
|
||||||
var stringToBytes = sharedUtil.stringToBytes;
|
|
||||||
var globalScope = sharedUtil.globalScope;
|
|
||||||
var warn = sharedUtil.warn;
|
|
||||||
var FontFaceObject = displayFontLoader.FontFaceObject;
|
|
||||||
var FontLoader = displayFontLoader.FontLoader;
|
|
||||||
var CanvasGraphics = displayCanvas.CanvasGraphics;
|
|
||||||
var Metadata = displayMetadata.Metadata;
|
|
||||||
var RenderingCancelledException = displayDOMUtils.RenderingCancelledException;
|
|
||||||
var getDefaultSetting = displayDOMUtils.getDefaultSetting;
|
|
||||||
var DOMCanvasFactory = displayDOMUtils.DOMCanvasFactory;
|
|
||||||
var DOMCMapReaderFactory = displayDOMUtils.DOMCMapReaderFactory;
|
|
||||||
|
|
||||||
var DEFAULT_RANGE_CHUNK_SIZE = 65536; // 2^16 = 65536
|
var DEFAULT_RANGE_CHUNK_SIZE = 65536; // 2^16 = 65536
|
||||||
|
|
||||||
@ -1118,9 +1082,10 @@ var PDFWorker = (function PDFWorkerClosure() {
|
|||||||
// other files and resolves the promise. In production only the
|
// other files and resolves the promise. In production only the
|
||||||
// pdf.worker.js file is needed.
|
// pdf.worker.js file is needed.
|
||||||
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {
|
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {
|
||||||
if (typeof amdRequire === 'function') {
|
if (typeof SystemJS === 'object') {
|
||||||
amdRequire(['pdfjs/core/network', 'pdfjs/core/worker'],
|
Promise.all([SystemJS.import('pdfjs/core/network'),
|
||||||
function (network, worker) {
|
SystemJS.import('pdfjs/core/worker')]).then((modules) => {
|
||||||
|
var worker = modules[1];
|
||||||
WorkerMessageHandler = worker.WorkerMessageHandler;
|
WorkerMessageHandler = worker.WorkerMessageHandler;
|
||||||
fakeWorkerFilesLoadedCapability.resolve(WorkerMessageHandler);
|
fakeWorkerFilesLoadedCapability.resolve(WorkerMessageHandler);
|
||||||
});
|
});
|
||||||
@ -1129,7 +1094,8 @@ var PDFWorker = (function PDFWorkerClosure() {
|
|||||||
WorkerMessageHandler = worker.WorkerMessageHandler;
|
WorkerMessageHandler = worker.WorkerMessageHandler;
|
||||||
fakeWorkerFilesLoadedCapability.resolve(WorkerMessageHandler);
|
fakeWorkerFilesLoadedCapability.resolve(WorkerMessageHandler);
|
||||||
} else {
|
} else {
|
||||||
throw new Error('AMD or CommonJS must be used to load fake worker.');
|
throw new Error(
|
||||||
|
'SystemJS or CommonJS must be used to load fake worker.');
|
||||||
}
|
}
|
||||||
} else if (PDFJSDev.test('SINGLE_FILE')) {
|
} else if (PDFJSDev.test('SINGLE_FILE')) {
|
||||||
var pdfjsCoreWorker = require('../core/worker.js');
|
var pdfjsCoreWorker = require('../core/worker.js');
|
||||||
@ -2241,15 +2207,19 @@ var _UnsupportedManager = (function UnsupportedManagerClosure() {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
var version, build;
|
||||||
if (typeof PDFJSDev !== 'undefined') {
|
if (typeof PDFJSDev !== 'undefined') {
|
||||||
exports.version = PDFJSDev.eval('BUNDLE_VERSION');
|
version = PDFJSDev.eval('BUNDLE_VERSION');
|
||||||
exports.build = PDFJSDev.eval('BUNDLE_BUILD');
|
build = PDFJSDev.eval('BUNDLE_BUILD');
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.getDocument = getDocument;
|
export {
|
||||||
exports.PDFDataRangeTransport = PDFDataRangeTransport;
|
getDocument,
|
||||||
exports.PDFWorker = PDFWorker;
|
PDFDataRangeTransport,
|
||||||
exports.PDFDocumentProxy = PDFDocumentProxy;
|
PDFWorker,
|
||||||
exports.PDFPageProxy = PDFPageProxy;
|
PDFDocumentProxy,
|
||||||
exports._UnsupportedManager = _UnsupportedManager;
|
PDFPageProxy,
|
||||||
}));
|
_UnsupportedManager,
|
||||||
|
version,
|
||||||
|
build,
|
||||||
|
};
|
||||||
|
@ -13,41 +13,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
import {
|
||||||
|
assert, error, FONT_IDENTITY_MATRIX, IDENTITY_MATRIX, ImageKind, info,
|
||||||
(function (root, factory) {
|
isArray, isLittleEndian, isNum, OPS, shadow, TextRenderingMode, Util, warn
|
||||||
if (typeof define === 'function' && define.amd) {
|
} from '../shared/util';
|
||||||
define('pdfjs/display/canvas', ['exports', 'pdfjs/shared/util',
|
import { getShadingPatternFromIR, TilingPattern } from './pattern_helper';
|
||||||
'pdfjs/display/dom_utils', 'pdfjs/display/pattern_helper',
|
import { WebGLUtils } from './webgl';
|
||||||
'pdfjs/display/webgl'], factory);
|
|
||||||
} else if (typeof exports !== 'undefined') {
|
|
||||||
factory(exports, require('../shared/util.js'), require('./dom_utils.js'),
|
|
||||||
require('./pattern_helper.js'), require('./webgl.js'));
|
|
||||||
} else {
|
|
||||||
factory((root.pdfjsDisplayCanvas = {}), root.pdfjsSharedUtil,
|
|
||||||
root.pdfjsDisplayDOMUtils, root.pdfjsDisplayPatternHelper,
|
|
||||||
root.pdfjsDisplayWebGL);
|
|
||||||
}
|
|
||||||
}(this, function (exports, sharedUtil, displayDOMUtils, displayPatternHelper,
|
|
||||||
displayWebGL) {
|
|
||||||
|
|
||||||
var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
|
|
||||||
var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
|
|
||||||
var ImageKind = sharedUtil.ImageKind;
|
|
||||||
var OPS = sharedUtil.OPS;
|
|
||||||
var TextRenderingMode = sharedUtil.TextRenderingMode;
|
|
||||||
var Util = sharedUtil.Util;
|
|
||||||
var assert = sharedUtil.assert;
|
|
||||||
var info = sharedUtil.info;
|
|
||||||
var isNum = sharedUtil.isNum;
|
|
||||||
var isArray = sharedUtil.isArray;
|
|
||||||
var isLittleEndian = sharedUtil.isLittleEndian;
|
|
||||||
var error = sharedUtil.error;
|
|
||||||
var shadow = sharedUtil.shadow;
|
|
||||||
var warn = sharedUtil.warn;
|
|
||||||
var TilingPattern = displayPatternHelper.TilingPattern;
|
|
||||||
var getShadingPatternFromIR = displayPatternHelper.getShadingPatternFromIR;
|
|
||||||
var WebGLUtils = displayWebGL.WebGLUtils;
|
|
||||||
|
|
||||||
// <canvas> contexts store most of the state we need natively.
|
// <canvas> contexts store most of the state we need natively.
|
||||||
// However, PDF needs a bit more state, which we store here.
|
// However, PDF needs a bit more state, which we store here.
|
||||||
@ -2276,5 +2247,6 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||||||
return CanvasGraphics;
|
return CanvasGraphics;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
exports.CanvasGraphics = CanvasGraphics;
|
export {
|
||||||
}));
|
CanvasGraphics,
|
||||||
|
};
|
||||||
|
@ -13,26 +13,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
import {
|
||||||
|
assert, CMapCompressionType, createValidAbsoluteUrl, deprecated, globalScope,
|
||||||
(function (root, factory) {
|
removeNullCharacters, stringToBytes, warn
|
||||||
if (typeof define === 'function' && define.amd) {
|
} from '../shared/util';
|
||||||
define('pdfjs/display/dom_utils', ['exports', 'pdfjs/shared/util'],
|
|
||||||
factory);
|
|
||||||
} else if (typeof exports !== 'undefined') {
|
|
||||||
factory(exports, require('../shared/util.js'));
|
|
||||||
} else {
|
|
||||||
factory((root.pdfjsDisplayDOMUtils = {}), root.pdfjsSharedUtil);
|
|
||||||
}
|
|
||||||
}(this, function (exports, sharedUtil) {
|
|
||||||
|
|
||||||
var assert = sharedUtil.assert;
|
|
||||||
var removeNullCharacters = sharedUtil.removeNullCharacters;
|
|
||||||
var warn = sharedUtil.warn;
|
|
||||||
var deprecated = sharedUtil.deprecated;
|
|
||||||
var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
|
|
||||||
var stringToBytes = sharedUtil.stringToBytes;
|
|
||||||
var CMapCompressionType = sharedUtil.CMapCompressionType;
|
|
||||||
|
|
||||||
var DEFAULT_LINK_REL = 'noopener noreferrer nofollow';
|
var DEFAULT_LINK_REL = 'noopener noreferrer nofollow';
|
||||||
|
|
||||||
@ -250,7 +234,7 @@ function getFilenameFromUrl(url) {
|
|||||||
function getDefaultSetting(id) {
|
function getDefaultSetting(id) {
|
||||||
// The list of the settings and their default is maintained for backward
|
// The list of the settings and their default is maintained for backward
|
||||||
// compatibility and shall not be extended or modified. See also global.js.
|
// compatibility and shall not be extended or modified. See also global.js.
|
||||||
var globalSettings = sharedUtil.globalScope.PDFJS;
|
var globalSettings = globalScope.PDFJS;
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case 'pdfBug':
|
case 'pdfBug':
|
||||||
return globalSettings ? globalSettings.pdfBug : false;
|
return globalSettings ? globalSettings.pdfBug : false;
|
||||||
@ -331,15 +315,16 @@ function isValidUrl(url, allowRelative) {
|
|||||||
return createValidAbsoluteUrl(url, baseUrl) !== null;
|
return createValidAbsoluteUrl(url, baseUrl) !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.CustomStyle = CustomStyle;
|
export {
|
||||||
exports.addLinkAttributes = addLinkAttributes;
|
CustomStyle,
|
||||||
exports.isExternalLinkTargetSet = isExternalLinkTargetSet;
|
RenderingCancelledException,
|
||||||
exports.isValidUrl = isValidUrl;
|
addLinkAttributes,
|
||||||
exports.getFilenameFromUrl = getFilenameFromUrl;
|
isExternalLinkTargetSet,
|
||||||
exports.LinkTarget = LinkTarget;
|
isValidUrl,
|
||||||
exports.RenderingCancelledException = RenderingCancelledException;
|
getFilenameFromUrl,
|
||||||
exports.getDefaultSetting = getDefaultSetting;
|
LinkTarget,
|
||||||
exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL;
|
getDefaultSetting,
|
||||||
exports.DOMCanvasFactory = DOMCanvasFactory;
|
DEFAULT_LINK_REL,
|
||||||
exports.DOMCMapReaderFactory = DOMCMapReaderFactory;
|
DOMCanvasFactory,
|
||||||
}));
|
DOMCMapReaderFactory,
|
||||||
|
};
|
||||||
|
@ -13,24 +13,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
import {
|
||||||
|
assert, bytesToString, isEvalSupported, shadow, string32, warn
|
||||||
(function (root, factory) {
|
} from '../shared/util';
|
||||||
if (typeof define === 'function' && define.amd) {
|
|
||||||
define('pdfjs/display/font_loader', ['exports', 'pdfjs/shared/util'],
|
|
||||||
factory);
|
|
||||||
} else if (typeof exports !== 'undefined') {
|
|
||||||
factory(exports, require('../shared/util.js'));
|
|
||||||
} else {
|
|
||||||
factory((root.pdfjsDisplayFontLoader = {}), root.pdfjsSharedUtil);
|
|
||||||
}
|
|
||||||
}(this, function (exports, sharedUtil) {
|
|
||||||
|
|
||||||
var assert = sharedUtil.assert;
|
|
||||||
var bytesToString = sharedUtil.bytesToString;
|
|
||||||
var string32 = sharedUtil.string32;
|
|
||||||
var shadow = sharedUtil.shadow;
|
|
||||||
var warn = sharedUtil.warn;
|
|
||||||
|
|
||||||
function FontLoader(docId) {
|
function FontLoader(docId) {
|
||||||
this.docId = docId;
|
this.docId = docId;
|
||||||
@ -346,7 +331,7 @@ if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL || CHROME')) {
|
|||||||
|
|
||||||
var IsEvalSupportedCached = {
|
var IsEvalSupportedCached = {
|
||||||
get value() {
|
get value() {
|
||||||
return shadow(this, 'value', sharedUtil.isEvalSupported());
|
return shadow(this, 'value', isEvalSupported());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -451,6 +436,7 @@ var FontFaceObject = (function FontFaceObjectClosure() {
|
|||||||
return FontFaceObject;
|
return FontFaceObject;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
exports.FontFaceObject = FontFaceObject;
|
export {
|
||||||
exports.FontLoader = FontLoader;
|
FontFaceObject,
|
||||||
}));
|
FontLoader,
|
||||||
|
};
|
||||||
|
@ -13,307 +13,296 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
import {
|
||||||
|
_UnsupportedManager, getDocument, PDFDataRangeTransport, PDFWorker
|
||||||
|
} from './api';
|
||||||
|
import {
|
||||||
|
addLinkAttributes, CustomStyle, DEFAULT_LINK_REL, getFilenameFromUrl,
|
||||||
|
isExternalLinkTargetSet, isValidUrl, LinkTarget
|
||||||
|
} from './dom_utils';
|
||||||
|
import {
|
||||||
|
createBlob, createObjectURL, createPromiseCapability, deprecated,
|
||||||
|
getVerbosityLevel, globalScope, InvalidPDFException, isLittleEndian,
|
||||||
|
MissingPDFException, OPS, PageViewport, PasswordException, PasswordResponses,
|
||||||
|
removeNullCharacters, setVerbosityLevel, shadow, UnexpectedResponseException,
|
||||||
|
UnknownErrorException, UNSUPPORTED_FEATURES, Util, VERBOSITY_LEVELS, warn
|
||||||
|
} from '../shared/util';
|
||||||
|
import { AnnotationLayer } from './annotation_layer';
|
||||||
|
import { Metadata } from './metadata';
|
||||||
|
import { renderTextLayer } from './text_layer';
|
||||||
|
import { SVGGraphics } from './svg';
|
||||||
|
|
||||||
(function (root, factory) {
|
var isWorker = (typeof window === 'undefined');
|
||||||
if (typeof define === 'function' && define.amd) {
|
|
||||||
define('pdfjs/display/global', ['exports', 'pdfjs/shared/util',
|
// The global PDFJS object is now deprecated and will not be supported in
|
||||||
'pdfjs/display/dom_utils', 'pdfjs/display/api',
|
// the future. The members below are maintained for backward compatibility
|
||||||
'pdfjs/display/annotation_layer', 'pdfjs/display/text_layer',
|
// and shall not be extended or modified. If the global.js is included as
|
||||||
'pdfjs/display/metadata', 'pdfjs/display/svg'], factory);
|
// a module, we will create a global PDFJS object instance or use existing.
|
||||||
} else if (typeof exports !== 'undefined') {
|
if (!globalScope.PDFJS) {
|
||||||
factory(exports, require('../shared/util.js'), require('./dom_utils.js'),
|
globalScope.PDFJS = {};
|
||||||
require('./api.js'), require('./annotation_layer.js'),
|
}
|
||||||
require('./text_layer.js'), require('./metadata.js'),
|
var PDFJS = globalScope.PDFJS;
|
||||||
require('./svg.js'));
|
|
||||||
} else {
|
if (typeof PDFJSDev !== 'undefined') {
|
||||||
factory((root.pdfjsDisplayGlobal = {}), root.pdfjsSharedUtil,
|
PDFJS.version = PDFJSDev.eval('BUNDLE_VERSION');
|
||||||
root.pdfjsDisplayDOMUtils, root.pdfjsDisplayAPI,
|
PDFJS.build = PDFJSDev.eval('BUNDLE_BUILD');
|
||||||
root.pdfjsDisplayAnnotationLayer, root.pdfjsDisplayTextLayer,
|
}
|
||||||
root.pdfjsDisplayMetadata, root.pdfjsDisplaySVG);
|
|
||||||
|
PDFJS.pdfBug = false;
|
||||||
|
|
||||||
|
if (PDFJS.verbosity !== undefined) {
|
||||||
|
setVerbosityLevel(PDFJS.verbosity);
|
||||||
|
}
|
||||||
|
delete PDFJS.verbosity;
|
||||||
|
Object.defineProperty(PDFJS, 'verbosity', {
|
||||||
|
get: function () {
|
||||||
|
return getVerbosityLevel();
|
||||||
|
},
|
||||||
|
set: function (level) {
|
||||||
|
setVerbosityLevel(level);
|
||||||
|
},
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
PDFJS.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
|
||||||
|
PDFJS.OPS = OPS;
|
||||||
|
PDFJS.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
|
||||||
|
PDFJS.isValidUrl = isValidUrl;
|
||||||
|
PDFJS.shadow = shadow;
|
||||||
|
PDFJS.createBlob = createBlob;
|
||||||
|
PDFJS.createObjectURL = function PDFJS_createObjectURL(data, contentType) {
|
||||||
|
return createObjectURL(data, contentType, PDFJS.disableCreateObjectURL);
|
||||||
|
};
|
||||||
|
Object.defineProperty(PDFJS, 'isLittleEndian', {
|
||||||
|
configurable: true,
|
||||||
|
get: function PDFJS_isLittleEndian() {
|
||||||
|
return shadow(PDFJS, 'isLittleEndian', isLittleEndian());
|
||||||
}
|
}
|
||||||
}(this, function (exports, sharedUtil, displayDOMUtils, displayAPI,
|
});
|
||||||
displayAnnotationLayer, displayTextLayer, displayMetadata,
|
PDFJS.removeNullCharacters = removeNullCharacters;
|
||||||
displaySVG) {
|
PDFJS.PasswordResponses = PasswordResponses;
|
||||||
|
PDFJS.PasswordException = PasswordException;
|
||||||
|
PDFJS.UnknownErrorException = UnknownErrorException;
|
||||||
|
PDFJS.InvalidPDFException = InvalidPDFException;
|
||||||
|
PDFJS.MissingPDFException = MissingPDFException;
|
||||||
|
PDFJS.UnexpectedResponseException = UnexpectedResponseException;
|
||||||
|
PDFJS.Util = Util;
|
||||||
|
PDFJS.PageViewport = PageViewport;
|
||||||
|
PDFJS.createPromiseCapability = createPromiseCapability;
|
||||||
|
|
||||||
var globalScope = sharedUtil.globalScope;
|
/**
|
||||||
var deprecated = sharedUtil.deprecated;
|
* The maximum allowed image size in total pixels e.g. width * height. Images
|
||||||
var warn = sharedUtil.warn;
|
* above this value will not be drawn. Use -1 for no limit.
|
||||||
var LinkTarget = displayDOMUtils.LinkTarget;
|
* @var {number}
|
||||||
var DEFAULT_LINK_REL = displayDOMUtils.DEFAULT_LINK_REL;
|
*/
|
||||||
|
PDFJS.maxImageSize = (PDFJS.maxImageSize === undefined ?
|
||||||
|
-1 : PDFJS.maxImageSize);
|
||||||
|
|
||||||
var isWorker = (typeof window === 'undefined');
|
/**
|
||||||
|
* The url of where the predefined Adobe CMaps are located. Include trailing
|
||||||
|
* slash.
|
||||||
|
* @var {string}
|
||||||
|
*/
|
||||||
|
PDFJS.cMapUrl = (PDFJS.cMapUrl === undefined ? null : PDFJS.cMapUrl);
|
||||||
|
|
||||||
// The global PDFJS object is now deprecated and will not be supported in
|
/**
|
||||||
// the future. The members below are maintained for backward compatibility
|
* Specifies if CMaps are binary packed.
|
||||||
// and shall not be extended or modified. If the global.js is included as
|
* @var {boolean}
|
||||||
// a module, we will create a global PDFJS object instance or use existing.
|
*/
|
||||||
if (!globalScope.PDFJS) {
|
PDFJS.cMapPacked = PDFJS.cMapPacked === undefined ? false : PDFJS.cMapPacked;
|
||||||
globalScope.PDFJS = {};
|
|
||||||
}
|
|
||||||
var PDFJS = globalScope.PDFJS;
|
|
||||||
|
|
||||||
if (typeof PDFJSDev !== 'undefined') {
|
/**
|
||||||
PDFJS.version = PDFJSDev.eval('BUNDLE_VERSION');
|
* By default fonts are converted to OpenType fonts and loaded via font face
|
||||||
PDFJS.build = PDFJSDev.eval('BUNDLE_BUILD');
|
* rules. If disabled, the font will be rendered using a built in font
|
||||||
}
|
* renderer that constructs the glyphs with primitive path commands.
|
||||||
|
* @var {boolean}
|
||||||
|
*/
|
||||||
|
PDFJS.disableFontFace = (PDFJS.disableFontFace === undefined ?
|
||||||
|
false : PDFJS.disableFontFace);
|
||||||
|
|
||||||
PDFJS.pdfBug = false;
|
/**
|
||||||
|
* Path for image resources, mainly for annotation icons. Include trailing
|
||||||
|
* slash.
|
||||||
|
* @var {string}
|
||||||
|
*/
|
||||||
|
PDFJS.imageResourcesPath = (PDFJS.imageResourcesPath === undefined ?
|
||||||
|
'' : PDFJS.imageResourcesPath);
|
||||||
|
|
||||||
if (PDFJS.verbosity !== undefined) {
|
/**
|
||||||
sharedUtil.setVerbosityLevel(PDFJS.verbosity);
|
* Disable the web worker and run all code on the main thread. This will
|
||||||
}
|
* happen automatically if the browser doesn't support workers or sending
|
||||||
delete PDFJS.verbosity;
|
* typed arrays to workers.
|
||||||
Object.defineProperty(PDFJS, 'verbosity', {
|
* @var {boolean}
|
||||||
|
*/
|
||||||
|
PDFJS.disableWorker = (PDFJS.disableWorker === undefined ?
|
||||||
|
false : PDFJS.disableWorker);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path and filename of the worker file. Required when the worker is enabled
|
||||||
|
* in development mode. If unspecified in the production build, the worker
|
||||||
|
* will be loaded based on the location of the pdf.js file. It is recommended
|
||||||
|
* that the workerSrc is set in a custom application to prevent issues caused
|
||||||
|
* by third-party frameworks and libraries.
|
||||||
|
* @var {string}
|
||||||
|
*/
|
||||||
|
PDFJS.workerSrc = (PDFJS.workerSrc === undefined ? null : PDFJS.workerSrc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines global port for worker process. Overrides workerSrc and
|
||||||
|
* disableWorker setting.
|
||||||
|
*/
|
||||||
|
PDFJS.workerPort = (PDFJS.workerPort === undefined ? null : PDFJS.workerPort);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable range request loading of PDF files. When enabled and if the server
|
||||||
|
* supports partial content requests then the PDF will be fetched in chunks.
|
||||||
|
* Enabled (false) by default.
|
||||||
|
* @var {boolean}
|
||||||
|
*/
|
||||||
|
PDFJS.disableRange = (PDFJS.disableRange === undefined ?
|
||||||
|
false : PDFJS.disableRange);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable streaming of PDF file data. By default PDF.js attempts to load PDF
|
||||||
|
* in chunks. This default behavior can be disabled.
|
||||||
|
* @var {boolean}
|
||||||
|
*/
|
||||||
|
PDFJS.disableStream = (PDFJS.disableStream === undefined ?
|
||||||
|
false : PDFJS.disableStream);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable pre-fetching of PDF file data. When range requests are enabled
|
||||||
|
* PDF.js will automatically keep fetching more data even if it isn't needed
|
||||||
|
* to display the current page. This default behavior can be disabled.
|
||||||
|
*
|
||||||
|
* NOTE: It is also necessary to disable streaming, see above,
|
||||||
|
* in order for disabling of pre-fetching to work correctly.
|
||||||
|
* @var {boolean}
|
||||||
|
*/
|
||||||
|
PDFJS.disableAutoFetch = (PDFJS.disableAutoFetch === undefined ?
|
||||||
|
false : PDFJS.disableAutoFetch);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables special hooks for debugging PDF.js.
|
||||||
|
* @var {boolean}
|
||||||
|
*/
|
||||||
|
PDFJS.pdfBug = (PDFJS.pdfBug === undefined ? false : PDFJS.pdfBug);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables transfer usage in postMessage for ArrayBuffers.
|
||||||
|
* @var {boolean}
|
||||||
|
*/
|
||||||
|
PDFJS.postMessageTransfers = (PDFJS.postMessageTransfers === undefined ?
|
||||||
|
true : PDFJS.postMessageTransfers);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables URL.createObjectURL usage.
|
||||||
|
* @var {boolean}
|
||||||
|
*/
|
||||||
|
PDFJS.disableCreateObjectURL = (PDFJS.disableCreateObjectURL === undefined ?
|
||||||
|
false : PDFJS.disableCreateObjectURL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables WebGL usage.
|
||||||
|
* @var {boolean}
|
||||||
|
*/
|
||||||
|
PDFJS.disableWebGL = (PDFJS.disableWebGL === undefined ?
|
||||||
|
true : PDFJS.disableWebGL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the |target| attribute for external links.
|
||||||
|
* The constants from PDFJS.LinkTarget should be used:
|
||||||
|
* - NONE [default]
|
||||||
|
* - SELF
|
||||||
|
* - BLANK
|
||||||
|
* - PARENT
|
||||||
|
* - TOP
|
||||||
|
* @var {number}
|
||||||
|
*/
|
||||||
|
PDFJS.externalLinkTarget = (PDFJS.externalLinkTarget === undefined ?
|
||||||
|
LinkTarget.NONE : PDFJS.externalLinkTarget);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the |rel| attribute for external links. Defaults to stripping
|
||||||
|
* the referrer.
|
||||||
|
* @var {string}
|
||||||
|
*/
|
||||||
|
PDFJS.externalLinkRel = (PDFJS.externalLinkRel === undefined ?
|
||||||
|
DEFAULT_LINK_REL : PDFJS.externalLinkRel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if we can eval strings as JS. Primarily used to improve
|
||||||
|
* performance for font rendering.
|
||||||
|
* @var {boolean}
|
||||||
|
*/
|
||||||
|
PDFJS.isEvalSupported = (PDFJS.isEvalSupported === undefined ?
|
||||||
|
true : PDFJS.isEvalSupported);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opt-in to backwards incompatible API changes. NOTE:
|
||||||
|
* If the `PDFJS_NEXT` build flag is set, it will override this setting.
|
||||||
|
* @var {boolean}
|
||||||
|
*/
|
||||||
|
PDFJS.pdfjsNext = (PDFJS.pdfjsNext === undefined) ? false : PDFJS.pdfjsNext;
|
||||||
|
|
||||||
|
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) {
|
||||||
|
var savedOpenExternalLinksInNewWindow = PDFJS.openExternalLinksInNewWindow;
|
||||||
|
delete PDFJS.openExternalLinksInNewWindow;
|
||||||
|
Object.defineProperty(PDFJS, 'openExternalLinksInNewWindow', {
|
||||||
get: function () {
|
get: function () {
|
||||||
return sharedUtil.getVerbosityLevel();
|
return PDFJS.externalLinkTarget === LinkTarget.BLANK;
|
||||||
},
|
},
|
||||||
set: function (level) {
|
set: function (value) {
|
||||||
sharedUtil.setVerbosityLevel(level);
|
if (value) {
|
||||||
|
deprecated('PDFJS.openExternalLinksInNewWindow, please use ' +
|
||||||
|
'"PDFJS.externalLinkTarget = PDFJS.LinkTarget.BLANK" instead.');
|
||||||
|
}
|
||||||
|
if (PDFJS.externalLinkTarget !== LinkTarget.NONE) {
|
||||||
|
warn('PDFJS.externalLinkTarget is already initialized');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PDFJS.externalLinkTarget = value ? LinkTarget.BLANK : LinkTarget.NONE;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
if (savedOpenExternalLinksInNewWindow) {
|
||||||
PDFJS.VERBOSITY_LEVELS = sharedUtil.VERBOSITY_LEVELS;
|
/**
|
||||||
PDFJS.OPS = sharedUtil.OPS;
|
* (Deprecated) Opens external links in a new window if enabled.
|
||||||
PDFJS.UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
|
* The default behavior opens external links in the PDF.js window.
|
||||||
PDFJS.isValidUrl = displayDOMUtils.isValidUrl;
|
*
|
||||||
PDFJS.shadow = sharedUtil.shadow;
|
* NOTE: This property has been deprecated, please use
|
||||||
PDFJS.createBlob = sharedUtil.createBlob;
|
* `PDFJS.externalLinkTarget = PDFJS.LinkTarget.BLANK` instead.
|
||||||
PDFJS.createObjectURL = function PDFJS_createObjectURL(data, contentType) {
|
* @var {boolean}
|
||||||
return sharedUtil.createObjectURL(data, contentType,
|
*/
|
||||||
PDFJS.disableCreateObjectURL);
|
PDFJS.openExternalLinksInNewWindow = savedOpenExternalLinksInNewWindow;
|
||||||
};
|
|
||||||
Object.defineProperty(PDFJS, 'isLittleEndian', {
|
|
||||||
configurable: true,
|
|
||||||
get: function PDFJS_isLittleEndian() {
|
|
||||||
var value = sharedUtil.isLittleEndian();
|
|
||||||
return sharedUtil.shadow(PDFJS, 'isLittleEndian', value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
PDFJS.removeNullCharacters = sharedUtil.removeNullCharacters;
|
|
||||||
PDFJS.PasswordResponses = sharedUtil.PasswordResponses;
|
|
||||||
PDFJS.PasswordException = sharedUtil.PasswordException;
|
|
||||||
PDFJS.UnknownErrorException = sharedUtil.UnknownErrorException;
|
|
||||||
PDFJS.InvalidPDFException = sharedUtil.InvalidPDFException;
|
|
||||||
PDFJS.MissingPDFException = sharedUtil.MissingPDFException;
|
|
||||||
PDFJS.UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
|
|
||||||
PDFJS.Util = sharedUtil.Util;
|
|
||||||
PDFJS.PageViewport = sharedUtil.PageViewport;
|
|
||||||
PDFJS.createPromiseCapability = sharedUtil.createPromiseCapability;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The maximum allowed image size in total pixels e.g. width * height. Images
|
|
||||||
* above this value will not be drawn. Use -1 for no limit.
|
|
||||||
* @var {number}
|
|
||||||
*/
|
|
||||||
PDFJS.maxImageSize = (PDFJS.maxImageSize === undefined ?
|
|
||||||
-1 : PDFJS.maxImageSize);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The url of where the predefined Adobe CMaps are located. Include trailing
|
|
||||||
* slash.
|
|
||||||
* @var {string}
|
|
||||||
*/
|
|
||||||
PDFJS.cMapUrl = (PDFJS.cMapUrl === undefined ? null : PDFJS.cMapUrl);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies if CMaps are binary packed.
|
|
||||||
* @var {boolean}
|
|
||||||
*/
|
|
||||||
PDFJS.cMapPacked = PDFJS.cMapPacked === undefined ? false : PDFJS.cMapPacked;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* By default fonts are converted to OpenType fonts and loaded via font face
|
|
||||||
* rules. If disabled, the font will be rendered using a built in font
|
|
||||||
* renderer that constructs the glyphs with primitive path commands.
|
|
||||||
* @var {boolean}
|
|
||||||
*/
|
|
||||||
PDFJS.disableFontFace = (PDFJS.disableFontFace === undefined ?
|
|
||||||
false : PDFJS.disableFontFace);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Path for image resources, mainly for annotation icons. Include trailing
|
|
||||||
* slash.
|
|
||||||
* @var {string}
|
|
||||||
*/
|
|
||||||
PDFJS.imageResourcesPath = (PDFJS.imageResourcesPath === undefined ?
|
|
||||||
'' : PDFJS.imageResourcesPath);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable the web worker and run all code on the main thread. This will
|
|
||||||
* happen automatically if the browser doesn't support workers or sending
|
|
||||||
* typed arrays to workers.
|
|
||||||
* @var {boolean}
|
|
||||||
*/
|
|
||||||
PDFJS.disableWorker = (PDFJS.disableWorker === undefined ?
|
|
||||||
false : PDFJS.disableWorker);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Path and filename of the worker file. Required when the worker is enabled
|
|
||||||
* in development mode. If unspecified in the production build, the worker
|
|
||||||
* will be loaded based on the location of the pdf.js file. It is recommended
|
|
||||||
* that the workerSrc is set in a custom application to prevent issues caused
|
|
||||||
* by third-party frameworks and libraries.
|
|
||||||
* @var {string}
|
|
||||||
*/
|
|
||||||
PDFJS.workerSrc = (PDFJS.workerSrc === undefined ? null : PDFJS.workerSrc);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines global port for worker process. Overrides workerSrc and
|
|
||||||
* disableWorker setting.
|
|
||||||
*/
|
|
||||||
PDFJS.workerPort = (PDFJS.workerPort === undefined ? null : PDFJS.workerPort);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable range request loading of PDF files. When enabled and if the server
|
|
||||||
* supports partial content requests then the PDF will be fetched in chunks.
|
|
||||||
* Enabled (false) by default.
|
|
||||||
* @var {boolean}
|
|
||||||
*/
|
|
||||||
PDFJS.disableRange = (PDFJS.disableRange === undefined ?
|
|
||||||
false : PDFJS.disableRange);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable streaming of PDF file data. By default PDF.js attempts to load PDF
|
|
||||||
* in chunks. This default behavior can be disabled.
|
|
||||||
* @var {boolean}
|
|
||||||
*/
|
|
||||||
PDFJS.disableStream = (PDFJS.disableStream === undefined ?
|
|
||||||
false : PDFJS.disableStream);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable pre-fetching of PDF file data. When range requests are enabled
|
|
||||||
* PDF.js will automatically keep fetching more data even if it isn't needed
|
|
||||||
* to display the current page. This default behavior can be disabled.
|
|
||||||
*
|
|
||||||
* NOTE: It is also necessary to disable streaming, see above,
|
|
||||||
* in order for disabling of pre-fetching to work correctly.
|
|
||||||
* @var {boolean}
|
|
||||||
*/
|
|
||||||
PDFJS.disableAutoFetch = (PDFJS.disableAutoFetch === undefined ?
|
|
||||||
false : PDFJS.disableAutoFetch);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables special hooks for debugging PDF.js.
|
|
||||||
* @var {boolean}
|
|
||||||
*/
|
|
||||||
PDFJS.pdfBug = (PDFJS.pdfBug === undefined ? false : PDFJS.pdfBug);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables transfer usage in postMessage for ArrayBuffers.
|
|
||||||
* @var {boolean}
|
|
||||||
*/
|
|
||||||
PDFJS.postMessageTransfers = (PDFJS.postMessageTransfers === undefined ?
|
|
||||||
true : PDFJS.postMessageTransfers);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disables URL.createObjectURL usage.
|
|
||||||
* @var {boolean}
|
|
||||||
*/
|
|
||||||
PDFJS.disableCreateObjectURL = (PDFJS.disableCreateObjectURL === undefined ?
|
|
||||||
false : PDFJS.disableCreateObjectURL);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disables WebGL usage.
|
|
||||||
* @var {boolean}
|
|
||||||
*/
|
|
||||||
PDFJS.disableWebGL = (PDFJS.disableWebGL === undefined ?
|
|
||||||
true : PDFJS.disableWebGL);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the |target| attribute for external links.
|
|
||||||
* The constants from PDFJS.LinkTarget should be used:
|
|
||||||
* - NONE [default]
|
|
||||||
* - SELF
|
|
||||||
* - BLANK
|
|
||||||
* - PARENT
|
|
||||||
* - TOP
|
|
||||||
* @var {number}
|
|
||||||
*/
|
|
||||||
PDFJS.externalLinkTarget = (PDFJS.externalLinkTarget === undefined ?
|
|
||||||
LinkTarget.NONE : PDFJS.externalLinkTarget);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the |rel| attribute for external links. Defaults to stripping
|
|
||||||
* the referrer.
|
|
||||||
* @var {string}
|
|
||||||
*/
|
|
||||||
PDFJS.externalLinkRel = (PDFJS.externalLinkRel === undefined ?
|
|
||||||
DEFAULT_LINK_REL : PDFJS.externalLinkRel);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines if we can eval strings as JS. Primarily used to improve
|
|
||||||
* performance for font rendering.
|
|
||||||
* @var {boolean}
|
|
||||||
*/
|
|
||||||
PDFJS.isEvalSupported = (PDFJS.isEvalSupported === undefined ?
|
|
||||||
true : PDFJS.isEvalSupported);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Opt-in to backwards incompatible API changes. NOTE:
|
|
||||||
* If the `PDFJS_NEXT` build flag is set, it will override this setting.
|
|
||||||
* @var {boolean}
|
|
||||||
*/
|
|
||||||
PDFJS.pdfjsNext = (PDFJS.pdfjsNext === undefined) ? false : PDFJS.pdfjsNext;
|
|
||||||
|
|
||||||
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) {
|
|
||||||
var savedOpenExternalLinksInNewWindow = PDFJS.openExternalLinksInNewWindow;
|
|
||||||
delete PDFJS.openExternalLinksInNewWindow;
|
|
||||||
Object.defineProperty(PDFJS, 'openExternalLinksInNewWindow', {
|
|
||||||
get: function () {
|
|
||||||
return PDFJS.externalLinkTarget === LinkTarget.BLANK;
|
|
||||||
},
|
|
||||||
set: function (value) {
|
|
||||||
if (value) {
|
|
||||||
deprecated('PDFJS.openExternalLinksInNewWindow, please use ' +
|
|
||||||
'"PDFJS.externalLinkTarget = PDFJS.LinkTarget.BLANK" instead.');
|
|
||||||
}
|
|
||||||
if (PDFJS.externalLinkTarget !== LinkTarget.NONE) {
|
|
||||||
warn('PDFJS.externalLinkTarget is already initialized');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
PDFJS.externalLinkTarget = value ? LinkTarget.BLANK : LinkTarget.NONE;
|
|
||||||
},
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true
|
|
||||||
});
|
|
||||||
if (savedOpenExternalLinksInNewWindow) {
|
|
||||||
/**
|
|
||||||
* (Deprecated) Opens external links in a new window if enabled.
|
|
||||||
* The default behavior opens external links in the PDF.js window.
|
|
||||||
*
|
|
||||||
* NOTE: This property has been deprecated, please use
|
|
||||||
* `PDFJS.externalLinkTarget = PDFJS.LinkTarget.BLANK` instead.
|
|
||||||
* @var {boolean}
|
|
||||||
*/
|
|
||||||
PDFJS.openExternalLinksInNewWindow = savedOpenExternalLinksInNewWindow;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PDFJS.getDocument = displayAPI.getDocument;
|
PDFJS.getDocument = getDocument;
|
||||||
PDFJS.PDFDataRangeTransport = displayAPI.PDFDataRangeTransport;
|
PDFJS.PDFDataRangeTransport = PDFDataRangeTransport;
|
||||||
PDFJS.PDFWorker = displayAPI.PDFWorker;
|
PDFJS.PDFWorker = PDFWorker;
|
||||||
|
|
||||||
PDFJS.hasCanvasTypedArrays = true; // compatibility.js ensures this invariant
|
PDFJS.hasCanvasTypedArrays = true; // compatibility.js ensures this invariant
|
||||||
PDFJS.CustomStyle = displayDOMUtils.CustomStyle;
|
PDFJS.CustomStyle = CustomStyle;
|
||||||
PDFJS.LinkTarget = LinkTarget;
|
PDFJS.LinkTarget = LinkTarget;
|
||||||
PDFJS.addLinkAttributes = displayDOMUtils.addLinkAttributes;
|
PDFJS.addLinkAttributes = addLinkAttributes;
|
||||||
PDFJS.getFilenameFromUrl = displayDOMUtils.getFilenameFromUrl;
|
PDFJS.getFilenameFromUrl = getFilenameFromUrl;
|
||||||
PDFJS.isExternalLinkTargetSet = displayDOMUtils.isExternalLinkTargetSet;
|
PDFJS.isExternalLinkTargetSet = isExternalLinkTargetSet;
|
||||||
|
|
||||||
PDFJS.AnnotationLayer = displayAnnotationLayer.AnnotationLayer;
|
PDFJS.AnnotationLayer = AnnotationLayer;
|
||||||
|
|
||||||
PDFJS.renderTextLayer = displayTextLayer.renderTextLayer;
|
PDFJS.renderTextLayer = renderTextLayer;
|
||||||
|
|
||||||
PDFJS.Metadata = displayMetadata.Metadata;
|
PDFJS.Metadata = Metadata;
|
||||||
|
|
||||||
PDFJS.SVGGraphics = displaySVG.SVGGraphics;
|
PDFJS.SVGGraphics = SVGGraphics;
|
||||||
|
|
||||||
PDFJS.UnsupportedManager = displayAPI._UnsupportedManager;
|
PDFJS.UnsupportedManager = _UnsupportedManager;
|
||||||
|
|
||||||
exports.globalScope = globalScope;
|
export {
|
||||||
exports.isWorker = isWorker;
|
globalScope,
|
||||||
exports.PDFJS = globalScope.PDFJS;
|
isWorker,
|
||||||
}));
|
PDFJS,
|
||||||
|
};
|
||||||
|
@ -13,95 +13,84 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
import { error } from '../shared/util';
|
||||||
|
|
||||||
(function (root, factory) {
|
function fixMetadata(meta) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
return meta.replace(/>\\376\\377([^<]+)/g, function(all, codes) {
|
||||||
define('pdfjs/display/metadata', ['exports', 'pdfjs/shared/util'], factory);
|
var bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g,
|
||||||
} else if (typeof exports !== 'undefined') {
|
function(code, d1, d2, d3) {
|
||||||
factory(exports, require('../shared/util.js'));
|
return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
|
||||||
} else {
|
|
||||||
factory((root.pdfjsDisplayMetadata = {}), root.pdfjsSharedUtil);
|
|
||||||
}
|
|
||||||
}(this, function (exports, sharedUtil) {
|
|
||||||
|
|
||||||
var error = sharedUtil.error;
|
|
||||||
|
|
||||||
function fixMetadata(meta) {
|
|
||||||
return meta.replace(/>\\376\\377([^<]+)/g, function(all, codes) {
|
|
||||||
var bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g,
|
|
||||||
function(code, d1, d2, d3) {
|
|
||||||
return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
|
|
||||||
});
|
|
||||||
var chars = '';
|
|
||||||
for (var i = 0; i < bytes.length; i += 2) {
|
|
||||||
var code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
|
|
||||||
chars += (code >= 32 && code < 127 && code !== 60 && code !== 62 &&
|
|
||||||
code !== 38) ? String.fromCharCode(code) :
|
|
||||||
'&#x' + (0x10000 + code).toString(16).substring(1) + ';';
|
|
||||||
}
|
|
||||||
return '>' + chars;
|
|
||||||
});
|
});
|
||||||
|
var chars = '';
|
||||||
|
for (var i = 0; i < bytes.length; i += 2) {
|
||||||
|
var code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
|
||||||
|
chars += (code >= 32 && code < 127 && code !== 60 && code !== 62 &&
|
||||||
|
code !== 38) ? String.fromCharCode(code) :
|
||||||
|
'&#x' + (0x10000 + code).toString(16).substring(1) + ';';
|
||||||
|
}
|
||||||
|
return '>' + chars;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function Metadata(meta) {
|
||||||
|
if (typeof meta === 'string') {
|
||||||
|
// Ghostscript produces invalid metadata
|
||||||
|
meta = fixMetadata(meta);
|
||||||
|
|
||||||
|
var parser = new DOMParser();
|
||||||
|
meta = parser.parseFromString(meta, 'application/xml');
|
||||||
|
} else if (!(meta instanceof Document)) {
|
||||||
|
error('Metadata: Invalid metadata object');
|
||||||
}
|
}
|
||||||
|
|
||||||
function Metadata(meta) {
|
this.metaDocument = meta;
|
||||||
if (typeof meta === 'string') {
|
this.metadata = Object.create(null);
|
||||||
// Ghostscript produces invalid metadata
|
this.parse();
|
||||||
meta = fixMetadata(meta);
|
}
|
||||||
|
|
||||||
var parser = new DOMParser();
|
Metadata.prototype = {
|
||||||
meta = parser.parseFromString(meta, 'application/xml');
|
parse: function Metadata_parse() {
|
||||||
} else if (!(meta instanceof Document)) {
|
var doc = this.metaDocument;
|
||||||
error('Metadata: Invalid metadata object');
|
var rdf = doc.documentElement;
|
||||||
|
|
||||||
|
if (rdf.nodeName.toLowerCase() !== 'rdf:rdf') { // Wrapped in <xmpmeta>
|
||||||
|
rdf = rdf.firstChild;
|
||||||
|
while (rdf && rdf.nodeName.toLowerCase() !== 'rdf:rdf') {
|
||||||
|
rdf = rdf.nextSibling;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.metaDocument = meta;
|
var nodeName = (rdf) ? rdf.nodeName.toLowerCase() : null;
|
||||||
this.metadata = Object.create(null);
|
if (!rdf || nodeName !== 'rdf:rdf' || !rdf.hasChildNodes()) {
|
||||||
this.parse();
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var children = rdf.childNodes, desc, entry, name, i, ii, length, iLength;
|
||||||
|
for (i = 0, length = children.length; i < length; i++) {
|
||||||
|
desc = children[i];
|
||||||
|
if (desc.nodeName.toLowerCase() !== 'rdf:description') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ii = 0, iLength = desc.childNodes.length; ii < iLength; ii++) {
|
||||||
|
if (desc.childNodes[ii].nodeName.toLowerCase() !== '#text') {
|
||||||
|
entry = desc.childNodes[ii];
|
||||||
|
name = entry.nodeName.toLowerCase();
|
||||||
|
this.metadata[name] = entry.textContent.trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
get: function Metadata_get(name) {
|
||||||
|
return this.metadata[name] || null;
|
||||||
|
},
|
||||||
|
|
||||||
|
has: function Metadata_has(name) {
|
||||||
|
return typeof this.metadata[name] !== 'undefined';
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Metadata.prototype = {
|
export {
|
||||||
parse: function Metadata_parse() {
|
Metadata,
|
||||||
var doc = this.metaDocument;
|
};
|
||||||
var rdf = doc.documentElement;
|
|
||||||
|
|
||||||
if (rdf.nodeName.toLowerCase() !== 'rdf:rdf') { // Wrapped in <xmpmeta>
|
|
||||||
rdf = rdf.firstChild;
|
|
||||||
while (rdf && rdf.nodeName.toLowerCase() !== 'rdf:rdf') {
|
|
||||||
rdf = rdf.nextSibling;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var nodeName = (rdf) ? rdf.nodeName.toLowerCase() : null;
|
|
||||||
if (!rdf || nodeName !== 'rdf:rdf' || !rdf.hasChildNodes()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var children = rdf.childNodes, desc, entry, name, i, ii, length, iLength;
|
|
||||||
for (i = 0, length = children.length; i < length; i++) {
|
|
||||||
desc = children[i];
|
|
||||||
if (desc.nodeName.toLowerCase() !== 'rdf:description') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ii = 0, iLength = desc.childNodes.length; ii < iLength; ii++) {
|
|
||||||
if (desc.childNodes[ii].nodeName.toLowerCase() !== '#text') {
|
|
||||||
entry = desc.childNodes[ii];
|
|
||||||
name = entry.nodeName.toLowerCase();
|
|
||||||
this.metadata[name] = entry.textContent.trim();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
get: function Metadata_get(name) {
|
|
||||||
return this.metadata[name] || null;
|
|
||||||
},
|
|
||||||
|
|
||||||
has: function Metadata_has(name) {
|
|
||||||
return typeof this.metadata[name] !== 'undefined';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.Metadata = Metadata;
|
|
||||||
}));
|
|
||||||
|
@ -13,25 +13,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
import { error, info, isArray, Util } from '../shared/util';
|
||||||
|
import { WebGLUtils } from './webgl';
|
||||||
(function (root, factory) {
|
|
||||||
if (typeof define === 'function' && define.amd) {
|
|
||||||
define('pdfjs/display/pattern_helper', ['exports', 'pdfjs/shared/util',
|
|
||||||
'pdfjs/display/webgl'], factory);
|
|
||||||
} else if (typeof exports !== 'undefined') {
|
|
||||||
factory(exports, require('../shared/util.js'), require('./webgl.js'));
|
|
||||||
} else {
|
|
||||||
factory((root.pdfjsDisplayPatternHelper = {}), root.pdfjsSharedUtil,
|
|
||||||
root.pdfjsDisplayWebGL);
|
|
||||||
}
|
|
||||||
}(this, function (exports, sharedUtil, displayWebGL) {
|
|
||||||
|
|
||||||
var Util = sharedUtil.Util;
|
|
||||||
var info = sharedUtil.info;
|
|
||||||
var isArray = sharedUtil.isArray;
|
|
||||||
var error = sharedUtil.error;
|
|
||||||
var WebGLUtils = displayWebGL.WebGLUtils;
|
|
||||||
|
|
||||||
var ShadingIRs = {};
|
var ShadingIRs = {};
|
||||||
|
|
||||||
@ -448,6 +431,7 @@ var TilingPattern = (function TilingPatternClosure() {
|
|||||||
return TilingPattern;
|
return TilingPattern;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
exports.getShadingPatternFromIR = getShadingPatternFromIR;
|
export {
|
||||||
exports.TilingPattern = TilingPattern;
|
getShadingPatternFromIR,
|
||||||
}));
|
TilingPattern,
|
||||||
|
};
|
||||||
|
@ -13,28 +13,17 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
import {
|
||||||
|
createObjectURL, FONT_IDENTITY_MATRIX, IDENTITY_MATRIX, ImageKind, isArray,
|
||||||
|
isNum, OPS, Util, warn
|
||||||
|
} from '../shared/util';
|
||||||
|
|
||||||
|
var SVGGraphics = function() {
|
||||||
|
throw new Error('Not implemented: SVGGraphics');
|
||||||
|
};
|
||||||
|
|
||||||
(function (root, factory) {
|
|
||||||
if (typeof define === 'function' && define.amd) {
|
|
||||||
define('pdfjs/display/svg', ['exports', 'pdfjs/shared/util'], factory);
|
|
||||||
} else if (typeof exports !== 'undefined') {
|
|
||||||
factory(exports, require('../shared/util.js'));
|
|
||||||
} else {
|
|
||||||
factory((root.pdfjsDisplaySVG = {}), root.pdfjsSharedUtil);
|
|
||||||
}
|
|
||||||
}(this, function (exports, sharedUtil) {
|
|
||||||
if (typeof PDFJSDev === 'undefined' ||
|
if (typeof PDFJSDev === 'undefined' ||
|
||||||
PDFJSDev.test('GENERIC || SINGLE_FILE')) {
|
PDFJSDev.test('GENERIC || SINGLE_FILE')) {
|
||||||
var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
|
|
||||||
var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
|
|
||||||
var ImageKind = sharedUtil.ImageKind;
|
|
||||||
var OPS = sharedUtil.OPS;
|
|
||||||
var Util = sharedUtil.Util;
|
|
||||||
var isNum = sharedUtil.isNum;
|
|
||||||
var isArray = sharedUtil.isArray;
|
|
||||||
var warn = sharedUtil.warn;
|
|
||||||
var createObjectURL = sharedUtil.createObjectURL;
|
|
||||||
|
|
||||||
var SVG_DEFAULTS = {
|
var SVG_DEFAULTS = {
|
||||||
fontStyle: 'normal',
|
fontStyle: 'normal',
|
||||||
@ -293,7 +282,7 @@ var SVGExtraState = (function SVGExtraStateClosure() {
|
|||||||
return SVGExtraState;
|
return SVGExtraState;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
var SVGGraphics = (function SVGGraphicsClosure() {
|
SVGGraphics = (function SVGGraphicsClosure() {
|
||||||
function opListToTree(opList) {
|
function opListToTree(opList) {
|
||||||
var opTree = [];
|
var opTree = [];
|
||||||
var tmp = [];
|
var tmp = [];
|
||||||
@ -1203,6 +1192,8 @@ var SVGGraphics = (function SVGGraphicsClosure() {
|
|||||||
return SVGGraphics;
|
return SVGGraphics;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
exports.SVGGraphics = SVGGraphics;
|
|
||||||
}
|
}
|
||||||
}));
|
|
||||||
|
export {
|
||||||
|
SVGGraphics,
|
||||||
|
};
|
||||||
|
@ -13,24 +13,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
import { createPromiseCapability, Util } from '../shared/util';
|
||||||
|
import { CustomStyle, getDefaultSetting } from './dom_utils';
|
||||||
(function (root, factory) {
|
|
||||||
if (typeof define === 'function' && define.amd) {
|
|
||||||
define('pdfjs/display/text_layer', ['exports', 'pdfjs/shared/util',
|
|
||||||
'pdfjs/display/dom_utils'], factory);
|
|
||||||
} else if (typeof exports !== 'undefined') {
|
|
||||||
factory(exports, require('../shared/util.js'), require('./dom_utils.js'));
|
|
||||||
} else {
|
|
||||||
factory((root.pdfjsDisplayTextLayer = {}), root.pdfjsSharedUtil,
|
|
||||||
root.pdfjsDisplayDOMUtils);
|
|
||||||
}
|
|
||||||
}(this, function (exports, sharedUtil, displayDOMUtils) {
|
|
||||||
|
|
||||||
var Util = sharedUtil.Util;
|
|
||||||
var createPromiseCapability = sharedUtil.createPromiseCapability;
|
|
||||||
var CustomStyle = displayDOMUtils.CustomStyle;
|
|
||||||
var getDefaultSetting = displayDOMUtils.getDefaultSetting;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Text layer render parameters.
|
* Text layer render parameters.
|
||||||
@ -639,5 +623,6 @@ var renderTextLayer = (function renderTextLayerClosure() {
|
|||||||
return renderTextLayer;
|
return renderTextLayer;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
exports.renderTextLayer = renderTextLayer;
|
export {
|
||||||
}));
|
renderTextLayer,
|
||||||
|
};
|
||||||
|
@ -14,22 +14,8 @@
|
|||||||
*/
|
*/
|
||||||
/* eslint-disable no-multi-str */
|
/* eslint-disable no-multi-str */
|
||||||
|
|
||||||
'use strict';
|
import { getDefaultSetting } from './dom_utils';
|
||||||
|
import { shadow } from '../shared/util';
|
||||||
(function (root, factory) {
|
|
||||||
if (typeof define === 'function' && define.amd) {
|
|
||||||
define('pdfjs/display/webgl', ['exports', 'pdfjs/shared/util',
|
|
||||||
'pdfjs/display/dom_utils'], factory);
|
|
||||||
} else if (typeof exports !== 'undefined') {
|
|
||||||
factory(exports, require('../shared/util.js'), require('./dom_utils.js'));
|
|
||||||
} else {
|
|
||||||
factory((root.pdfjsDisplayWebGL = {}), root.pdfjsSharedUtil,
|
|
||||||
root.pdfjsDisplayDOMUtils);
|
|
||||||
}
|
|
||||||
}(this, function (exports, sharedUtil, displayDOMUtils) {
|
|
||||||
|
|
||||||
var shadow = sharedUtil.shadow;
|
|
||||||
var getDefaultSetting = displayDOMUtils.getDefaultSetting;
|
|
||||||
|
|
||||||
var WebGLUtils = (function WebGLUtilsClosure() {
|
var WebGLUtils = (function WebGLUtilsClosure() {
|
||||||
function loadShader(gl, code, shaderType) {
|
function loadShader(gl, code, shaderType) {
|
||||||
@ -450,5 +436,6 @@ var WebGLUtils = (function WebGLUtilsClosure() {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
exports.WebGLUtils = WebGLUtils;
|
export {
|
||||||
}));
|
WebGLUtils,
|
||||||
|
};
|
||||||
|
@ -47,7 +47,10 @@
|
|||||||
meta: {
|
meta: {
|
||||||
'*': {
|
'*': {
|
||||||
scriptLoad: false,
|
scriptLoad: false,
|
||||||
esModule: true
|
esModule: true,
|
||||||
|
babelOptions: {
|
||||||
|
es2015: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
map: {
|
map: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user