Browse Source

PDF.js version 2.0.385 - See mozilla/pdf.js@99060e2485cacb8513e7bc50d88b70101069b1c9

master v2.0.385
pdfjsbot 7 years ago
parent
commit
9b102a7afb
  1. 2
      bower.json
  2. 560
      build/pdf.js
  3. 2
      build/pdf.js.map
  4. 2
      build/pdf.min.js
  5. 28
      build/pdf.worker.js
  6. 2
      build/pdf.worker.js.map
  7. 2
      build/pdf.worker.min.js
  8. 2
      lib/core/worker.js
  9. 78
      lib/display/api.js
  10. 6
      lib/display/dom_utils.js
  11. 22
      lib/display/global.js
  12. 30
      lib/display/worker_options.js
  13. 9
      lib/pdf.js
  14. 4
      lib/pdf.worker.js
  15. 22
      lib/shared/util.js
  16. 20
      lib/test/unit/api_spec.js
  17. 8
      lib/test/unit/jasmine-boot.js
  18. 3
      lib/web/app.js
  19. 2
      package.json
  20. 2
      webpack.js

2
bower.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "2.0.378", "version": "2.0.385",
"main": [ "main": [
"build/pdf.js", "build/pdf.js",
"build/pdf.worker.js" "build/pdf.worker.js"

560
build/pdf.js

File diff suppressed because it is too large Load Diff

2
build/pdf.js.map

File diff suppressed because one or more lines are too long

2
build/pdf.min.js vendored

File diff suppressed because one or more lines are too long

28
build/pdf.worker.js vendored

@ -105,7 +105,7 @@ return /******/ (function(modules) { // webpackBootstrap
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VERBOSITY_LEVELS = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined; exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
@ -229,10 +229,10 @@ var FontType = {
TYPE0: 9, TYPE0: 9,
MMTYPE1: 10 MMTYPE1: 10
}; };
var VERBOSITY_LEVELS = { var VerbosityLevel = {
errors: 0, ERRORS: 0,
warnings: 1, WARNINGS: 1,
infos: 5 INFOS: 5
}; };
var CMapCompressionType = { var CMapCompressionType = {
NONE: 0, NONE: 0,
@ -332,20 +332,22 @@ var OPS = {
paintSolidColorImageMask: 90, paintSolidColorImageMask: 90,
constructPath: 91 constructPath: 91
}; };
var verbosity = VERBOSITY_LEVELS.warnings; var verbosity = VerbosityLevel.WARNINGS;
function setVerbosityLevel(level) { function setVerbosityLevel(level) {
verbosity = level; if (Number.isInteger(level)) {
verbosity = level;
}
} }
function getVerbosityLevel() { function getVerbosityLevel() {
return verbosity; return verbosity;
} }
function info(msg) { function info(msg) {
if (verbosity >= VERBOSITY_LEVELS.infos) { if (verbosity >= VerbosityLevel.INFOS) {
console.log('Info: ' + msg); console.log('Info: ' + msg);
} }
} }
function warn(msg) { function warn(msg) {
if (verbosity >= VERBOSITY_LEVELS.warnings) { if (verbosity >= VerbosityLevel.WARNINGS) {
console.log('Warning: ' + msg); console.log('Warning: ' + msg);
} }
} }
@ -1341,7 +1343,7 @@ MessageHandler.prototype = {
exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
exports.IDENTITY_MATRIX = IDENTITY_MATRIX; exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
exports.OPS = OPS; exports.OPS = OPS;
exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS; exports.VerbosityLevel = VerbosityLevel;
exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES; exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
exports.AnnotationBorderStyleType = AnnotationBorderStyleType; exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
exports.AnnotationFieldFlag = AnnotationFieldFlag; exports.AnnotationFieldFlag = AnnotationFieldFlag;
@ -22313,8 +22315,8 @@ exports.PostScriptCompiler = PostScriptCompiler;
"use strict"; "use strict";
var pdfjsVersion = '2.0.378'; var pdfjsVersion = '2.0.385';
var pdfjsBuild = 'a89071bd'; var pdfjsBuild = '99060e24';
var pdfjsCoreWorker = __w_pdfjs_require__(74); var pdfjsCoreWorker = __w_pdfjs_require__(74);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler; exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
@ -22527,7 +22529,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null; var cancelXHRs = null;
var WorkerTasks = []; var WorkerTasks = [];
var apiVersion = docParams.apiVersion; var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.378'; var workerVersion = '2.0.385';
if (apiVersion !== null && apiVersion !== workerVersion) { if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".')); throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
} }

2
build/pdf.worker.js.map vendored

File diff suppressed because one or more lines are too long

2
build/pdf.worker.min.js vendored

File diff suppressed because one or more lines are too long

2
lib/core/worker.js

@ -223,7 +223,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null; var cancelXHRs = null;
var WorkerTasks = []; var WorkerTasks = [];
var apiVersion = docParams.apiVersion; var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.378'; var workerVersion = '2.0.385';
if (apiVersion !== null && apiVersion !== workerVersion) { if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".')); throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
} }

78
lib/display/api.js

@ -42,6 +42,8 @@ var _global_scope = require('../shared/global_scope');
var _global_scope2 = _interopRequireDefault(_global_scope); var _global_scope2 = _interopRequireDefault(_global_scope);
var _worker_options = require('./worker_options');
var _metadata = require('./metadata'); var _metadata = require('./metadata');
var _transport_stream = require('./transport_stream'); var _transport_stream = require('./transport_stream');
@ -54,8 +56,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var DEFAULT_RANGE_CHUNK_SIZE = 65536; var DEFAULT_RANGE_CHUNK_SIZE = 65536;
var isWorkerDisabled = false; var isWorkerDisabled = false;
var workerSrc; var workerSrc = void 0;
var isPostMessageTransfersDisabled = false;
var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null;
var fakeWorkerFilesLoader = null; var fakeWorkerFilesLoader = null;
var useRequireEnsure = false; var useRequireEnsure = false;
@ -145,9 +146,19 @@ function getDocument(src) {
if (params.nativeImageDecoderSupport === undefined || !nativeImageDecoderValues.includes(params.nativeImageDecoderSupport)) { if (params.nativeImageDecoderSupport === undefined || !nativeImageDecoderValues.includes(params.nativeImageDecoderSupport)) {
params.nativeImageDecoderSupport = _util.NativeImageDecoding.DECODE; params.nativeImageDecoderSupport = _util.NativeImageDecoding.DECODE;
} }
(0, _util.setVerbosityLevel)(params.verbosity);
if (!worker) { if (!worker) {
var workerPort = (0, _dom_utils.getDefaultSetting)('workerPort'); var workerParams = {
worker = workerPort ? PDFWorker.fromPort(workerPort) : new PDFWorker(); postMessageTransfers: params.postMessageTransfers,
verbosity: params.verbosity
};
var workerPort = _worker_options.GlobalWorkerOptions.workerPort;
if (workerPort) {
workerParams.port = workerPort;
worker = PDFWorker.fromPort(workerParams);
} else {
worker = new PDFWorker(workerParams);
}
task._worker = worker; task._worker = worker;
} }
var docId = task.docId; var docId = task.docId;
@ -178,7 +189,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
if (worker.destroyed) { if (worker.destroyed) {
return Promise.reject(new Error('Worker was destroyed')); return Promise.reject(new Error('Worker was destroyed'));
} }
var apiVersion = '2.0.378'; var apiVersion = '2.0.385';
source.disableRange = (0, _dom_utils.getDefaultSetting)('disableRange'); source.disableRange = (0, _dom_utils.getDefaultSetting)('disableRange');
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch'); source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream'); source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
@ -200,7 +211,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
maxImageSize: (0, _dom_utils.getDefaultSetting)('maxImageSize'), maxImageSize: (0, _dom_utils.getDefaultSetting)('maxImageSize'),
disableFontFace: (0, _dom_utils.getDefaultSetting)('disableFontFace'), disableFontFace: (0, _dom_utils.getDefaultSetting)('disableFontFace'),
disableCreateObjectURL: (0, _dom_utils.getDefaultSetting)('disableCreateObjectURL'), disableCreateObjectURL: (0, _dom_utils.getDefaultSetting)('disableCreateObjectURL'),
postMessageTransfers: (0, _dom_utils.getDefaultSetting)('postMessageTransfers') && !isPostMessageTransfersDisabled, postMessageTransfers: worker.postMessageTransfers,
docBaseUrl: source.docBaseUrl, docBaseUrl: source.docBaseUrl,
nativeImageDecoderSupport: source.nativeImageDecoderSupport, nativeImageDecoderSupport: source.nativeImageDecoderSupport,
ignoreErrors: source.ignoreErrors, ignoreErrors: source.ignoreErrors,
@ -714,8 +725,8 @@ var LoopbackPort = function () {
var PDFWorker = function PDFWorkerClosure() { var PDFWorker = function PDFWorkerClosure() {
var nextFakeWorkerId = 0; var nextFakeWorkerId = 0;
function getWorkerSrc() { function getWorkerSrc() {
if ((0, _dom_utils.getDefaultSetting)('workerSrc')) { if (_worker_options.GlobalWorkerOptions.workerSrc) {
return (0, _dom_utils.getDefaultSetting)('workerSrc'); return _worker_options.GlobalWorkerOptions.workerSrc;
} }
if (typeof workerSrc !== 'undefined') { if (typeof workerSrc !== 'undefined') {
return workerSrc; return workerSrc;
@ -723,7 +734,7 @@ var PDFWorker = function PDFWorkerClosure() {
if (pdfjsFilePath) { if (pdfjsFilePath) {
return pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i, '.worker$1$2'); return pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i, '.worker$1$2');
} }
throw new Error('No PDFJS.workerSrc specified'); throw new Error('No "GlobalWorkerOptions.workerSrc" specified.');
} }
function getMainThreadWorkerMessageHandler() { function getMainThreadWorkerMessageHandler() {
if (typeof window === 'undefined') { if (typeof window === 'undefined') {
@ -755,13 +766,24 @@ var PDFWorker = function PDFWorkerClosure() {
return URL.createObjectURL(new Blob([wrapper])); return URL.createObjectURL(new Blob([wrapper]));
} }
var pdfWorkerPorts = new WeakMap(); var pdfWorkerPorts = new WeakMap();
function PDFWorker(name, port) { function PDFWorker() {
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref2$name = _ref2.name,
name = _ref2$name === undefined ? null : _ref2$name,
_ref2$port = _ref2.port,
port = _ref2$port === undefined ? null : _ref2$port,
_ref2$postMessageTran = _ref2.postMessageTransfers,
postMessageTransfers = _ref2$postMessageTran === undefined ? true : _ref2$postMessageTran,
_ref2$verbosity = _ref2.verbosity,
verbosity = _ref2$verbosity === undefined ? null : _ref2$verbosity;
if (port && pdfWorkerPorts.has(port)) { if (port && pdfWorkerPorts.has(port)) {
throw new Error('Cannot use more than one PDFWorker per port'); throw new Error('Cannot use more than one PDFWorker per port');
} }
this.name = name; this.name = name;
this.destroyed = false; this.destroyed = false;
this.postMessageTransfers = true; this.postMessageTransfers = postMessageTransfers !== false;
this.verbosity = (0, _util.isNum)(verbosity) ? verbosity : (0, _util.getVerbosityLevel)();
this._readyCapability = (0, _util.createPromiseCapability)(); this._readyCapability = (0, _util.createPromiseCapability)();
this._port = null; this._port = null;
this._webWorker = null; this._webWorker = null;
@ -829,10 +851,9 @@ var PDFWorker = function PDFWorkerClosure() {
_this6._webWorker = worker; _this6._webWorker = worker;
if (!data.supportTransfers) { if (!data.supportTransfers) {
_this6.postMessageTransfers = false; _this6.postMessageTransfers = false;
isPostMessageTransfersDisabled = true;
} }
_this6._readyCapability.resolve(); _this6._readyCapability.resolve();
messageHandler.send('configure', { verbosity: (0, _util.getVerbosityLevel)() }); messageHandler.send('configure', { verbosity: _this6.verbosity });
} else { } else {
_this6._setupFakeWorker(); _this6._setupFakeWorker();
messageHandler.destroy(); messageHandler.destroy();
@ -852,8 +873,7 @@ var PDFWorker = function PDFWorkerClosure() {
} }
}); });
var sendTest = function sendTest() { var sendTest = function sendTest() {
var postMessageTransfers = (0, _dom_utils.getDefaultSetting)('postMessageTransfers') && !isPostMessageTransfersDisabled; var testObj = new Uint8Array([_this6.postMessageTransfers ? 255 : 0]);
var testObj = new Uint8Array([postMessageTransfers ? 255 : 0]);
try { try {
messageHandler.send('test', testObj, [testObj.buffer]); messageHandler.send('test', testObj, [testObj.buffer]);
} catch (ex) { } catch (ex) {
@ -907,11 +927,11 @@ var PDFWorker = function PDFWorkerClosure() {
} }
} }
}; };
PDFWorker.fromPort = function (port) { PDFWorker.fromPort = function (params) {
if (pdfWorkerPorts.has(port)) { if (pdfWorkerPorts.has(params.port)) {
return pdfWorkerPorts.get(port); return pdfWorkerPorts.get(params.port);
} }
return new PDFWorker(null, port); return new PDFWorker(params);
}; };
PDFWorker.getWorkerSrc = function () { PDFWorker.getWorkerSrc = function () {
return getWorkerSrc(); return getWorkerSrc();
@ -989,9 +1009,9 @@ var WorkerTransport = function WorkerTransportClosure() {
}; };
}; };
sink.onPull = function () { sink.onPull = function () {
_this9._fullReader.read().then(function (_ref2) { _this9._fullReader.read().then(function (_ref3) {
var value = _ref2.value, var value = _ref3.value,
done = _ref2.done; done = _ref3.done;
if (done) { if (done) {
sink.close(); sink.close();
@ -1042,9 +1062,9 @@ var WorkerTransport = function WorkerTransportClosure() {
(0, _util.assert)(this._networkStream); (0, _util.assert)(this._networkStream);
var _rangeReader = this._networkStream.getRangeReader(data.begin, data.end); var _rangeReader = this._networkStream.getRangeReader(data.begin, data.end);
sink.onPull = function () { sink.onPull = function () {
_rangeReader.read().then(function (_ref3) { _rangeReader.read().then(function (_ref4) {
var value = _ref3.value, var value = _ref4.value,
done = _ref3.done; done = _ref4.done;
if (done) { if (done) {
sink.close(); sink.close();
@ -1060,8 +1080,8 @@ var WorkerTransport = function WorkerTransportClosure() {
_rangeReader.cancel(reason); _rangeReader.cancel(reason);
}; };
}, this); }, this);
messageHandler.on('GetDoc', function transportDoc(_ref4) { messageHandler.on('GetDoc', function transportDoc(_ref5) {
var pdfInfo = _ref4.pdfInfo; var pdfInfo = _ref5.pdfInfo;
this.numPages = pdfInfo.numPages; this.numPages = pdfInfo.numPages;
var loadingTask = this.loadingTask; var loadingTask = this.loadingTask;
@ -1577,8 +1597,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}(); }();
var version, build; var version, build;
{ {
exports.version = version = '2.0.378'; exports.version = version = '2.0.385';
exports.build = build = 'a89071bd'; exports.build = build = '99060e24';
} }
exports.getDocument = getDocument; exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort; exports.LoopbackPort = LoopbackPort;

6
lib/display/dom_utils.js

@ -366,12 +366,6 @@ function getDefaultSetting(id) {
return globalSettings ? globalSettings.cMapUrl : null; return globalSettings ? globalSettings.cMapUrl : null;
case 'cMapPacked': case 'cMapPacked':
return globalSettings ? globalSettings.cMapPacked : false; return globalSettings ? globalSettings.cMapPacked : false;
case 'postMessageTransfers':
return globalSettings ? globalSettings.postMessageTransfers : true;
case 'workerPort':
return globalSettings ? globalSettings.workerPort : null;
case 'workerSrc':
return globalSettings ? globalSettings.workerSrc : null;
case 'maxImageSize': case 'maxImageSize':
return globalSettings ? globalSettings.maxImageSize : -1; return globalSettings ? globalSettings.maxImageSize : -1;
case 'isEvalSupported': case 'isEvalSupported':

22
lib/display/global.js

@ -38,6 +38,8 @@ var _global_scope = require('../shared/global_scope');
var _global_scope2 = _interopRequireDefault(_global_scope); var _global_scope2 = _interopRequireDefault(_global_scope);
var _worker_options = require('./worker_options');
var _metadata = require('./metadata'); var _metadata = require('./metadata');
var _text_layer = require('./text_layer'); var _text_layer = require('./text_layer');
@ -51,22 +53,6 @@ if (!_global_scope2.default.PDFJS) {
} }
var PDFJS = _global_scope2.default.PDFJS; var PDFJS = _global_scope2.default.PDFJS;
PDFJS.pdfBug = false; PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
(0, _util.setVerbosityLevel)(PDFJS.verbosity);
}
delete PDFJS.verbosity;
Object.defineProperty(PDFJS, 'verbosity', {
get: function get() {
return (0, _util.getVerbosityLevel)();
},
set: function set(level) {
(0, _util.setVerbosityLevel)(level);
},
enumerable: true,
configurable: true
});
PDFJS.VERBOSITY_LEVELS = _util.VERBOSITY_LEVELS;
PDFJS.OPS = _util.OPS; PDFJS.OPS = _util.OPS;
PDFJS.UNSUPPORTED_FEATURES = _util.UNSUPPORTED_FEATURES; PDFJS.UNSUPPORTED_FEATURES = _util.UNSUPPORTED_FEATURES;
PDFJS.shadow = _util.shadow; PDFJS.shadow = _util.shadow;
@ -94,13 +80,10 @@ PDFJS.maxImageSize = PDFJS.maxImageSize === undefined ? -1 : PDFJS.maxImageSize;
PDFJS.cMapUrl = PDFJS.cMapUrl === undefined ? null : PDFJS.cMapUrl; PDFJS.cMapUrl = PDFJS.cMapUrl === undefined ? null : PDFJS.cMapUrl;
PDFJS.cMapPacked = PDFJS.cMapPacked === undefined ? false : PDFJS.cMapPacked; PDFJS.cMapPacked = PDFJS.cMapPacked === undefined ? false : PDFJS.cMapPacked;
PDFJS.disableFontFace = PDFJS.disableFontFace === undefined ? false : PDFJS.disableFontFace; PDFJS.disableFontFace = PDFJS.disableFontFace === undefined ? false : PDFJS.disableFontFace;
PDFJS.workerSrc = PDFJS.workerSrc === undefined ? null : PDFJS.workerSrc;
PDFJS.workerPort = PDFJS.workerPort === undefined ? null : PDFJS.workerPort;
PDFJS.disableRange = PDFJS.disableRange === undefined ? false : PDFJS.disableRange; PDFJS.disableRange = PDFJS.disableRange === undefined ? false : PDFJS.disableRange;
PDFJS.disableStream = PDFJS.disableStream === undefined ? false : PDFJS.disableStream; PDFJS.disableStream = PDFJS.disableStream === undefined ? false : PDFJS.disableStream;
PDFJS.disableAutoFetch = PDFJS.disableAutoFetch === undefined ? false : PDFJS.disableAutoFetch; PDFJS.disableAutoFetch = PDFJS.disableAutoFetch === undefined ? false : PDFJS.disableAutoFetch;
PDFJS.pdfBug = PDFJS.pdfBug === undefined ? false : PDFJS.pdfBug; PDFJS.pdfBug = PDFJS.pdfBug === undefined ? false : PDFJS.pdfBug;
PDFJS.postMessageTransfers = PDFJS.postMessageTransfers === undefined ? true : PDFJS.postMessageTransfers;
PDFJS.disableCreateObjectURL = PDFJS.disableCreateObjectURL === undefined ? false : PDFJS.disableCreateObjectURL; PDFJS.disableCreateObjectURL = PDFJS.disableCreateObjectURL === undefined ? false : PDFJS.disableCreateObjectURL;
PDFJS.externalLinkTarget = PDFJS.externalLinkTarget === undefined ? _dom_utils.LinkTarget.NONE : PDFJS.externalLinkTarget; PDFJS.externalLinkTarget = PDFJS.externalLinkTarget === undefined ? _dom_utils.LinkTarget.NONE : PDFJS.externalLinkTarget;
PDFJS.externalLinkRel = PDFJS.externalLinkRel === undefined ? _dom_utils.DEFAULT_LINK_REL : PDFJS.externalLinkRel; PDFJS.externalLinkRel = PDFJS.externalLinkRel === undefined ? _dom_utils.DEFAULT_LINK_REL : PDFJS.externalLinkRel;
@ -109,6 +92,7 @@ PDFJS.getDocument = _api.getDocument;
PDFJS.LoopbackPort = _api.LoopbackPort; PDFJS.LoopbackPort = _api.LoopbackPort;
PDFJS.PDFDataRangeTransport = _api.PDFDataRangeTransport; PDFJS.PDFDataRangeTransport = _api.PDFDataRangeTransport;
PDFJS.PDFWorker = _api.PDFWorker; PDFJS.PDFWorker = _api.PDFWorker;
PDFJS.GlobalWorkerOptions = _worker_options.GlobalWorkerOptions;
PDFJS.getFilenameFromUrl = _dom_utils.getFilenameFromUrl; PDFJS.getFilenameFromUrl = _dom_utils.getFilenameFromUrl;
PDFJS.AnnotationLayer = _annotation_layer.AnnotationLayer; PDFJS.AnnotationLayer = _annotation_layer.AnnotationLayer;
PDFJS.renderTextLayer = _text_layer.renderTextLayer; PDFJS.renderTextLayer = _text_layer.renderTextLayer;

30
lib/display/worker_options.js

@ -0,0 +1,30 @@
/**
* @licstart The following is the entire license notice for the
* Javascript code in this page
*
* Copyright 2017 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* Javascript code in this page
*/
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var GlobalWorkerOptions = Object.create(null);
GlobalWorkerOptions.workerPort = GlobalWorkerOptions.workerPort === undefined ? null : GlobalWorkerOptions.workerPort;
GlobalWorkerOptions.workerSrc = GlobalWorkerOptions.workerSrc === undefined ? '' : GlobalWorkerOptions.workerSrc;
exports.GlobalWorkerOptions = GlobalWorkerOptions;

9
lib/pdf.js

@ -21,8 +21,8 @@
*/ */
'use strict'; 'use strict';
var pdfjsVersion = '2.0.378'; var pdfjsVersion = '2.0.385';
var pdfjsBuild = 'a89071bd'; var pdfjsBuild = '99060e24';
var pdfjsSharedUtil = require('./shared/util.js'); var pdfjsSharedUtil = require('./shared/util.js');
var pdfjsDisplayGlobal = require('./display/global.js'); var pdfjsDisplayGlobal = require('./display/global.js');
var pdfjsDisplayAPI = require('./display/api.js'); var pdfjsDisplayAPI = require('./display/api.js');
@ -30,6 +30,7 @@ var pdfjsDisplayTextLayer = require('./display/text_layer.js');
var pdfjsDisplayAnnotationLayer = require('./display/annotation_layer.js'); var pdfjsDisplayAnnotationLayer = require('./display/annotation_layer.js');
var pdfjsDisplayDOMUtils = require('./display/dom_utils.js'); var pdfjsDisplayDOMUtils = require('./display/dom_utils.js');
var pdfjsDisplaySVG = require('./display/svg.js'); var pdfjsDisplaySVG = require('./display/svg.js');
var pdfjsDisplayWorkerOptions = require('./display/worker_options.js');
{ {
var isNodeJS = require('./shared/is_node.js'); var isNodeJS = require('./shared/is_node.js');
if (isNodeJS()) { if (isNodeJS()) {
@ -66,6 +67,7 @@ exports.SVGGraphics = pdfjsDisplaySVG.SVGGraphics;
exports.NativeImageDecoding = pdfjsSharedUtil.NativeImageDecoding; exports.NativeImageDecoding = pdfjsSharedUtil.NativeImageDecoding;
exports.UnexpectedResponseException = pdfjsSharedUtil.UnexpectedResponseException; exports.UnexpectedResponseException = pdfjsSharedUtil.UnexpectedResponseException;
exports.OPS = pdfjsSharedUtil.OPS; exports.OPS = pdfjsSharedUtil.OPS;
exports.VerbosityLevel = pdfjsSharedUtil.VerbosityLevel;
exports.UNSUPPORTED_FEATURES = pdfjsSharedUtil.UNSUPPORTED_FEATURES; exports.UNSUPPORTED_FEATURES = pdfjsSharedUtil.UNSUPPORTED_FEATURES;
exports.createValidAbsoluteUrl = pdfjsSharedUtil.createValidAbsoluteUrl; exports.createValidAbsoluteUrl = pdfjsSharedUtil.createValidAbsoluteUrl;
exports.createObjectURL = pdfjsSharedUtil.createObjectURL; exports.createObjectURL = pdfjsSharedUtil.createObjectURL;
@ -75,4 +77,5 @@ exports.createBlob = pdfjsSharedUtil.createBlob;
exports.RenderingCancelledException = pdfjsDisplayDOMUtils.RenderingCancelledException; exports.RenderingCancelledException = pdfjsDisplayDOMUtils.RenderingCancelledException;
exports.getFilenameFromUrl = pdfjsDisplayDOMUtils.getFilenameFromUrl; exports.getFilenameFromUrl = pdfjsDisplayDOMUtils.getFilenameFromUrl;
exports.LinkTarget = pdfjsDisplayDOMUtils.LinkTarget; exports.LinkTarget = pdfjsDisplayDOMUtils.LinkTarget;
exports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes; exports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes;
exports.GlobalWorkerOptions = pdfjsDisplayWorkerOptions.GlobalWorkerOptions;

4
lib/pdf.worker.js vendored

@ -21,7 +21,7 @@
*/ */
'use strict'; 'use strict';
var pdfjsVersion = '2.0.378'; var pdfjsVersion = '2.0.385';
var pdfjsBuild = 'a89071bd'; var pdfjsBuild = '99060e24';
var pdfjsCoreWorker = require('./core/worker.js'); var pdfjsCoreWorker = require('./core/worker.js');
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler; exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

22
lib/shared/util.js

@ -24,7 +24,7 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VERBOSITY_LEVELS = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined; exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
@ -148,10 +148,10 @@ var FontType = {
TYPE0: 9, TYPE0: 9,
MMTYPE1: 10 MMTYPE1: 10
}; };
var VERBOSITY_LEVELS = { var VerbosityLevel = {
errors: 0, ERRORS: 0,
warnings: 1, WARNINGS: 1,
infos: 5 INFOS: 5
}; };
var CMapCompressionType = { var CMapCompressionType = {
NONE: 0, NONE: 0,
@ -251,20 +251,22 @@ var OPS = {
paintSolidColorImageMask: 90, paintSolidColorImageMask: 90,
constructPath: 91 constructPath: 91
}; };
var verbosity = VERBOSITY_LEVELS.warnings; var verbosity = VerbosityLevel.WARNINGS;
function setVerbosityLevel(level) { function setVerbosityLevel(level) {
verbosity = level; if (Number.isInteger(level)) {
verbosity = level;
}
} }
function getVerbosityLevel() { function getVerbosityLevel() {
return verbosity; return verbosity;
} }
function info(msg) { function info(msg) {
if (verbosity >= VERBOSITY_LEVELS.infos) { if (verbosity >= VerbosityLevel.INFOS) {
console.log('Info: ' + msg); console.log('Info: ' + msg);
} }
} }
function warn(msg) { function warn(msg) {
if (verbosity >= VERBOSITY_LEVELS.warnings) { if (verbosity >= VerbosityLevel.WARNINGS) {
console.log('Warning: ' + msg); console.log('Warning: ' + msg);
} }
} }
@ -1260,7 +1262,7 @@ MessageHandler.prototype = {
exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
exports.IDENTITY_MATRIX = IDENTITY_MATRIX; exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
exports.OPS = OPS; exports.OPS = OPS;
exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS; exports.VerbosityLevel = VerbosityLevel;
exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES; exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
exports.AnnotationBorderStyleType = AnnotationBorderStyleType; exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
exports.AnnotationFieldFlag = AnnotationFieldFlag; exports.AnnotationFieldFlag = AnnotationFieldFlag;

20
lib/test/unit/api_spec.js

@ -31,12 +31,12 @@ var _dom_utils = require('../../display/dom_utils');
var _api = require('../../display/api'); var _api = require('../../display/api');
var _worker_options = require('../../display/worker_options');
var _is_node = require('../../shared/is_node'); var _is_node = require('../../shared/is_node');
var _is_node2 = _interopRequireDefault(_is_node); var _is_node2 = _interopRequireDefault(_is_node);
var _global = require('../../display/global');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
describe('api', function () { describe('api', function () {
@ -265,7 +265,7 @@ describe('api', function () {
pending('Worker is not supported in Node.js.'); pending('Worker is not supported in Node.js.');
} }
it('worker created or destroyed', function (done) { it('worker created or destroyed', function (done) {
var worker = new _global.PDFJS.PDFWorker('test1'); var worker = new _api.PDFWorker({ name: 'test1' });
worker.promise.then(function () { worker.promise.then(function () {
expect(worker.name).toEqual('test1'); expect(worker.name).toEqual('test1');
expect(!!worker.port).toEqual(true); expect(!!worker.port).toEqual(true);
@ -300,7 +300,7 @@ describe('api', function () {
}); });
}); });
it('worker created and can be used in getDocument', function (done) { it('worker created and can be used in getDocument', function (done) {
var worker = new _global.PDFJS.PDFWorker('test1'); var worker = new _api.PDFWorker({ name: 'test1' });
var loadingTask = (0, _api.getDocument)((0, _test_utils.buildGetDocumentParams)(basicApiFileName, { worker: worker })); var loadingTask = (0, _api.getDocument)((0, _test_utils.buildGetDocumentParams)(basicApiFileName, { worker: worker }));
loadingTask.promise.then(function () { loadingTask.promise.then(function () {
var docWorker = loadingTask._worker; var docWorker = loadingTask._worker;
@ -320,9 +320,9 @@ describe('api', function () {
}); });
}); });
it('creates more than one worker', function (done) { it('creates more than one worker', function (done) {
var worker1 = new _global.PDFJS.PDFWorker('test1'); var worker1 = new _api.PDFWorker({ name: 'test1' });
var worker2 = new _global.PDFJS.PDFWorker('test2'); var worker2 = new _api.PDFWorker({ name: 'test2' });
var worker3 = new _global.PDFJS.PDFWorker('test3'); var worker3 = new _api.PDFWorker({ name: 'test3' });
var ready = Promise.all([worker1.promise, worker2.promise, worker3.promise]); var ready = Promise.all([worker1.promise, worker2.promise, worker3.promise]);
ready.then(function () { ready.then(function () {
expect(worker1.port !== worker2.port && worker1.port !== worker3.port && worker2.port !== worker3.port).toEqual(true); expect(worker1.port !== worker2.port && worker1.port !== worker3.port && worker2.port !== worker3.port).toEqual(true);
@ -337,7 +337,7 @@ describe('api', function () {
it('gets current workerSrc', function () { it('gets current workerSrc', function () {
var workerSrc = _api.PDFWorker.getWorkerSrc(); var workerSrc = _api.PDFWorker.getWorkerSrc();
expect(typeof workerSrc === 'undefined' ? 'undefined' : _typeof(workerSrc)).toEqual('string'); expect(typeof workerSrc === 'undefined' ? 'undefined' : _typeof(workerSrc)).toEqual('string');
expect(workerSrc).toEqual(_global.PDFJS.workerSrc); expect(workerSrc).toEqual(_worker_options.GlobalWorkerOptions.workerSrc);
}); });
}); });
describe('PDFDocument', function () { describe('PDFDocument', function () {
@ -1106,7 +1106,7 @@ describe('api', function () {
var fetches = 0; var fetches = 0;
var getDocumentPromise = getDocumentData().then(function (data) { var getDocumentPromise = getDocumentData().then(function (data) {
var initialData = data.subarray(0, initialDataLength); var initialData = data.subarray(0, initialDataLength);
transport = new _global.PDFJS.PDFDataRangeTransport(data.length, initialData); transport = new _api.PDFDataRangeTransport(data.length, initialData);
transport.requestDataRange = function (begin, end) { transport.requestDataRange = function (begin, end) {
fetches++; fetches++;
waitSome(function () { waitSome(function () {
@ -1138,7 +1138,7 @@ describe('api', function () {
var fetches = 0; var fetches = 0;
var getDocumentPromise = getDocumentData().then(function (data) { var getDocumentPromise = getDocumentData().then(function (data) {
var initialData = data.subarray(0, initialDataLength); var initialData = data.subarray(0, initialDataLength);
transport = new _global.PDFJS.PDFDataRangeTransport(data.length, initialData); transport = new _api.PDFDataRangeTransport(data.length, initialData);
transport.requestDataRange = function (begin, end) { transport.requestDataRange = function (begin, end) {
fetches++; fetches++;
if (fetches === 1) { if (fetches === 1) {

8
lib/test/unit/jasmine-boot.js

@ -22,11 +22,11 @@
'use strict'; 'use strict';
function initializePDFJS(callback) { function initializePDFJS(callback) {
Promise.all(['pdfjs/display/global', 'pdfjs/display/api', 'pdfjs/display/network', 'pdfjs/display/fetch_stream', 'pdfjs/shared/is_node', 'pdfjs-test/unit/annotation_spec', 'pdfjs-test/unit/api_spec', 'pdfjs-test/unit/bidi_spec', 'pdfjs-test/unit/cff_parser_spec', 'pdfjs-test/unit/cmap_spec', 'pdfjs-test/unit/colorspace_spec', 'pdfjs-test/unit/crypto_spec', 'pdfjs-test/unit/custom_spec', 'pdfjs-test/unit/display_svg_spec', 'pdfjs-test/unit/document_spec', 'pdfjs-test/unit/dom_utils_spec', 'pdfjs-test/unit/encodings_spec', 'pdfjs-test/unit/evaluator_spec', 'pdfjs-test/unit/fonts_spec', 'pdfjs-test/unit/function_spec', 'pdfjs-test/unit/metadata_spec', 'pdfjs-test/unit/murmurhash3_spec', 'pdfjs-test/unit/network_spec', 'pdfjs-test/unit/network_utils_spec', 'pdfjs-test/unit/parser_spec', 'pdfjs-test/unit/pdf_history_spec', 'pdfjs-test/unit/primitives_spec', 'pdfjs-test/unit/stream_spec', 'pdfjs-test/unit/type1_parser_spec', 'pdfjs-test/unit/ui_utils_spec', 'pdfjs-test/unit/unicode_spec', 'pdfjs-test/unit/util_spec', 'pdfjs-test/unit/util_stream_spec'].map(function (moduleName) { Promise.all(['pdfjs/display/api', 'pdfjs/display/worker_options', 'pdfjs/display/network', 'pdfjs/display/fetch_stream', 'pdfjs/shared/is_node', 'pdfjs-test/unit/annotation_spec', 'pdfjs-test/unit/api_spec', 'pdfjs-test/unit/bidi_spec', 'pdfjs-test/unit/cff_parser_spec', 'pdfjs-test/unit/cmap_spec', 'pdfjs-test/unit/colorspace_spec', 'pdfjs-test/unit/crypto_spec', 'pdfjs-test/unit/custom_spec', 'pdfjs-test/unit/display_svg_spec', 'pdfjs-test/unit/document_spec', 'pdfjs-test/unit/dom_utils_spec', 'pdfjs-test/unit/encodings_spec', 'pdfjs-test/unit/evaluator_spec', 'pdfjs-test/unit/fonts_spec', 'pdfjs-test/unit/function_spec', 'pdfjs-test/unit/metadata_spec', 'pdfjs-test/unit/murmurhash3_spec', 'pdfjs-test/unit/network_spec', 'pdfjs-test/unit/network_utils_spec', 'pdfjs-test/unit/parser_spec', 'pdfjs-test/unit/pdf_history_spec', 'pdfjs-test/unit/primitives_spec', 'pdfjs-test/unit/stream_spec', 'pdfjs-test/unit/type1_parser_spec', 'pdfjs-test/unit/ui_utils_spec', 'pdfjs-test/unit/unicode_spec', 'pdfjs-test/unit/util_spec', 'pdfjs-test/unit/util_stream_spec'].map(function (moduleName) {
return SystemJS.import(moduleName); return SystemJS.import(moduleName);
})).then(function (modules) { })).then(function (modules) {
var displayGlobal = modules[0]; var displayApi = modules[0];
var displayApi = modules[1]; var GlobalWorkerOptions = modules[1].GlobalWorkerOptions;
var PDFNetworkStream = modules[2].PDFNetworkStream; var PDFNetworkStream = modules[2].PDFNetworkStream;
var PDFFetchStream = modules[3].PDFFetchStream; var PDFFetchStream = modules[3].PDFFetchStream;
var isNodeJS = modules[4]; var isNodeJS = modules[4];
@ -42,7 +42,7 @@ function initializePDFJS(callback) {
return new PDFNetworkStream(params); return new PDFNetworkStream(params);
}); });
} }
displayGlobal.PDFJS.workerSrc = '../../build/generic/build/pdf.worker.js'; GlobalWorkerOptions.workerSrc = '../../build/generic/build/pdf.worker.js';
callback(); callback();
}); });
} }

3
lib/web/app.js

@ -78,7 +78,7 @@ var DEFAULT_SCALE_DELTA = 1.1;
var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
function configure(PDFJS) { function configure(PDFJS) {
PDFJS.imageResourcesPath = './images/'; PDFJS.imageResourcesPath = './images/';
PDFJS.workerSrc = '../build/pdf.worker.js'; _pdf.GlobalWorkerOptions.workerSrc = '../build/pdf.worker.js';
PDFJS.cMapUrl = '../web/cmaps/'; PDFJS.cMapUrl = '../web/cmaps/';
PDFJS.cMapPacked = true; PDFJS.cMapPacked = true;
} }
@ -554,6 +554,7 @@ var PDFViewerApplication = {
this.setTitleUsingUrl(file.originalUrl); this.setTitleUsingUrl(file.originalUrl);
parameters.url = file.url; parameters.url = file.url;
} }
parameters.verbosity = _pdf.PDFJS.verbosity;
if (args) { if (args) {
for (var prop in args) { for (var prop in args) {
if (prop === 'length') { if (prop === 'length') {

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "2.0.378", "version": "2.0.385",
"main": "build/pdf.js", "main": "build/pdf.js",
"description": "Generic build of Mozilla's PDF.js library.", "description": "Generic build of Mozilla's PDF.js library.",
"keywords": [ "keywords": [

2
webpack.js

@ -18,7 +18,7 @@ var pdfjs = require('./build/pdf.js');
var PdfjsWorker = require('worker-loader!./build/pdf.worker.js'); var PdfjsWorker = require('worker-loader!./build/pdf.worker.js');
if (typeof window !== 'undefined' && 'Worker' in window) { if (typeof window !== 'undefined' && 'Worker' in window) {
pdfjs.PDFJS.workerPort = new PdfjsWorker(); pdfjs.GlobalWorkerOptions.workerPort = new PdfjsWorker();
} }
module.exports = pdfjs; module.exports = pdfjs;

Loading…
Cancel
Save