mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-29 07:37:57 +02:00
Merge pull request #7053 from yurydelendik/rm-pdfjs-core
Removes global PDFJS usage from the src/core/.
This commit is contained in:
commit
df7afcf004
28 changed files with 485 additions and 394 deletions
|
@ -17,17 +17,14 @@
|
|||
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define('pdfjs/core/bidi', ['exports', 'pdfjs/shared/global'], factory);
|
||||
define('pdfjs/core/bidi', ['exports'], factory);
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
factory(exports, require('../shared/global.js'));
|
||||
factory(exports);
|
||||
} else {
|
||||
factory((root.pdfjsCoreBidi = {}), root.pdfjsSharedGlobal);
|
||||
factory((root.pdfjsCoreBidi = {}));
|
||||
}
|
||||
}(this, function (exports, sharedGlobal) {
|
||||
}(this, function (exports) {
|
||||
|
||||
var PDFJS = sharedGlobal.PDFJS;
|
||||
|
||||
var bidi = PDFJS.bidi = (function bidiClosure() {
|
||||
// Character types for symbols from 0000 to 00FF.
|
||||
var baseTypes = [
|
||||
'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'S', 'B', 'S', 'WS',
|
||||
|
@ -430,8 +427,5 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
|
|||
return createBidiText(chars.join(''), isLTR);
|
||||
}
|
||||
|
||||
return bidi;
|
||||
})();
|
||||
|
||||
exports.bidi = bidi;
|
||||
}));
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals PDFJS */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -35,7 +34,6 @@ var assert = sharedUtil.assert;
|
|||
var error = sharedUtil.error;
|
||||
var isInt = sharedUtil.isInt;
|
||||
var isString = sharedUtil.isString;
|
||||
var warn = sharedUtil.warn;
|
||||
var isName = corePrimitives.isName;
|
||||
var isCmd = corePrimitives.isCmd;
|
||||
var isStream = corePrimitives.isStream;
|
||||
|
|
|
@ -79,6 +79,7 @@ var Page = (function PageClosure() {
|
|||
this.idCounters = {
|
||||
obj: 0
|
||||
};
|
||||
this.evaluatorOptions = pdfManager.evaluatorOptions;
|
||||
this.resourcesPromise = null;
|
||||
}
|
||||
|
||||
|
@ -224,7 +225,8 @@ var Page = (function PageClosure() {
|
|||
handler, this.pageIndex,
|
||||
'p' + this.pageIndex + '_',
|
||||
this.idCounters,
|
||||
this.fontCache);
|
||||
this.fontCache,
|
||||
this.evaluatorOptions);
|
||||
|
||||
var dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
|
||||
var pageListPromise = dataPromises.then(function(data) {
|
||||
|
@ -289,7 +291,8 @@ var Page = (function PageClosure() {
|
|||
handler, self.pageIndex,
|
||||
'p' + self.pageIndex + '_',
|
||||
self.idCounters,
|
||||
self.fontCache);
|
||||
self.fontCache,
|
||||
self.evaluatorOptions);
|
||||
|
||||
return partialEvaluator.getTextContent(contentStream,
|
||||
task,
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals PDFJS */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -108,8 +107,15 @@ var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
|
|||
var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
|
||||
|
||||
var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
var DefaultPartialEvaluatorOptions = {
|
||||
forceDataSchema: false,
|
||||
maxImageSize: -1,
|
||||
disableFontFace: false,
|
||||
cMapOptions: { url: null, packed: false }
|
||||
};
|
||||
|
||||
function PartialEvaluator(pdfManager, xref, handler, pageIndex,
|
||||
uniquePrefix, idCounters, fontCache) {
|
||||
uniquePrefix, idCounters, fontCache, options) {
|
||||
this.pdfManager = pdfManager;
|
||||
this.xref = xref;
|
||||
this.handler = handler;
|
||||
|
@ -117,6 +123,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
this.uniquePrefix = uniquePrefix;
|
||||
this.idCounters = idCounters;
|
||||
this.fontCache = fontCache;
|
||||
this.options = options || DefaultPartialEvaluatorOptions;
|
||||
}
|
||||
|
||||
// Trying to minimize Date.now() usage and check every 100 time
|
||||
|
@ -275,7 +282,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
warn('Image dimensions are missing, or not numbers.');
|
||||
return;
|
||||
}
|
||||
if (PDFJS.maxImageSize !== -1 && w * h > PDFJS.maxImageSize) {
|
||||
var maxImageSize = this.options.maxImageSize;
|
||||
if (maxImageSize !== -1 && w * h > maxImageSize) {
|
||||
warn('Image exceeded maximum allowed size and was removed.');
|
||||
return;
|
||||
}
|
||||
|
@ -339,11 +347,13 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
// These JPEGs don't need any more processing so we can just send it.
|
||||
operatorList.addOp(OPS.paintJpegXObject, args);
|
||||
this.handler.send('obj',
|
||||
[objId, this.pageIndex, 'JpegStream', image.getIR()]);
|
||||
[objId, this.pageIndex, 'JpegStream',
|
||||
image.getIR(this.options.forceDataSchema)]);
|
||||
return;
|
||||
}
|
||||
|
||||
PDFImage.buildImage(self.handler, self.xref, resources, image, inline).
|
||||
PDFImage.buildImage(self.handler, self.xref, resources, image, inline,
|
||||
this.options.forceDataSchema).
|
||||
then(function(imageObj) {
|
||||
var imgData = imageObj.createImageData(/* forceRGBA = */ false);
|
||||
self.handler.send('obj', [objId, self.pageIndex, 'Image', imgData],
|
||||
|
@ -451,7 +461,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
var glyphs = font.charsToGlyphs(chars);
|
||||
var isAddToPathSet = !!(state.textRenderingMode &
|
||||
TextRenderingMode.ADD_TO_PATH_FLAG);
|
||||
if (font.data && (isAddToPathSet || PDFJS.disableFontFace)) {
|
||||
if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
|
||||
var buildPath = function (fontChar) {
|
||||
if (!font.renderer.hasBuiltPath(fontChar)) {
|
||||
var path = font.renderer.getPathJs(fontChar);
|
||||
|
@ -1174,7 +1184,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
|
||||
function runBidiTransform(textChunk) {
|
||||
var str = textChunk.str.join('');
|
||||
var bidiResult = PDFJS.bidi(str, -1, textChunk.vertical);
|
||||
var bidiResult = bidi(str, -1, textChunk.vertical);
|
||||
return {
|
||||
str: (normalizeWhitespace ? replaceWhitespace(bidiResult.str) :
|
||||
bidiResult.str),
|
||||
|
@ -1757,8 +1767,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
var ucs2CMapName = new Name(registry + '-' + ordering + '-UCS2');
|
||||
// d) Obtain the CMap with the name constructed in step (c) (available
|
||||
// from the ASN Web site; see the Bibliography).
|
||||
return CMapFactory.create(ucs2CMapName,
|
||||
{ url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null).then(
|
||||
return CMapFactory.create(ucs2CMapName, this.options.cMapOptions,
|
||||
null).then(
|
||||
function (ucs2CMap) {
|
||||
var cMap = properties.cMap;
|
||||
toUnicode = [];
|
||||
|
@ -1785,8 +1795,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
|
||||
var cmapObj = toUnicode;
|
||||
if (isName(cmapObj)) {
|
||||
return CMapFactory.create(cmapObj,
|
||||
{ url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null).then(
|
||||
return CMapFactory.create(cmapObj, this.options.cMapOptions, null).then(
|
||||
function (cmap) {
|
||||
if (cmap instanceof IdentityCMap) {
|
||||
return new IdentityToUnicodeMap(0, 0xFFFF);
|
||||
|
@ -1794,8 +1803,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
return new ToUnicodeMap(cmap.getMap());
|
||||
});
|
||||
} else if (isStream(cmapObj)) {
|
||||
return CMapFactory.create(cmapObj,
|
||||
{ url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null).then(
|
||||
return CMapFactory.create(cmapObj, this.options.cMapOptions, null).then(
|
||||
function (cmap) {
|
||||
if (cmap instanceof IdentityCMap) {
|
||||
return new IdentityToUnicodeMap(0, 0xFFFF);
|
||||
|
@ -2086,6 +2094,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
var descriptor = preEvaluatedFont.descriptor;
|
||||
var type = preEvaluatedFont.type;
|
||||
var maxCharIndex = (composite ? 0xFFFF : 0xFF);
|
||||
var cMapOptions = this.options.cMapOptions;
|
||||
var properties;
|
||||
|
||||
if (!descriptor) {
|
||||
|
@ -2213,8 +2222,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
if (isName(cidEncoding)) {
|
||||
properties.cidEncoding = cidEncoding.name;
|
||||
}
|
||||
cMapPromise = CMapFactory.create(cidEncoding,
|
||||
{ url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null).then(
|
||||
cMapPromise = CMapFactory.create(cidEncoding, cMapOptions, null).then(
|
||||
function (cMap) {
|
||||
properties.cMap = cMap;
|
||||
properties.vertical = properties.cMap.vertical;
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals PDFJS */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -20,24 +19,24 @@
|
|||
if (typeof define === 'function' && define.amd) {
|
||||
define('pdfjs/core/fonts', ['exports', 'pdfjs/shared/util',
|
||||
'pdfjs/core/primitives', 'pdfjs/core/stream', 'pdfjs/core/parser',
|
||||
'pdfjs/core/cmap', 'pdfjs/core/glyphlist', 'pdfjs/core/charsets',
|
||||
'pdfjs/core/glyphlist', 'pdfjs/core/charsets',
|
||||
'pdfjs/core/font_renderer', 'pdfjs/core/encodings',
|
||||
'pdfjs/core/standard_fonts', 'pdfjs/core/unicode'], factory);
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
factory(exports, require('../shared/util.js'), require('./primitives.js'),
|
||||
require('./stream.js'), require('./parser.js'), require('./cmap.js'),
|
||||
require('./stream.js'), require('./parser.js'),
|
||||
require('./glyphlist.js'), require('./charsets.js'),
|
||||
require('./font_renderer.js'), require('./encodings.js'),
|
||||
require('./standard_fonts'), require('./unicode.js'));
|
||||
} else {
|
||||
factory((root.pdfjsCoreFonts = {}), root.pdfjsSharedUtil,
|
||||
root.pdfjsCorePrimitives, root.pdfjsCoreStream, root.pdfjsCoreParser,
|
||||
root.pdfjsCoreCMap, root.pdfjsCoreGlyphList, root.pdfjsCoreCharsets,
|
||||
root.pdfjsCoreGlyphList, root.pdfjsCoreCharsets,
|
||||
root.pdfjsCoreFontRenderer, root.pdfjsCoreEncodings,
|
||||
root.pdfjsCoreStandardFonts, root.pdfjsCoreUnicode);
|
||||
}
|
||||
}(this, function (exports, sharedUtil, corePrimitives, coreStream, coreParser,
|
||||
coreCMap, coreGlyphList, coreCharsets, coreFontRenderer,
|
||||
coreGlyphList, coreCharsets, coreFontRenderer,
|
||||
coreEncodings, coreStandardFonts, coreUnicode) {
|
||||
|
||||
var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
|
||||
|
@ -55,11 +54,8 @@ var shadow = sharedUtil.shadow;
|
|||
var stringToBytes = sharedUtil.stringToBytes;
|
||||
var string32 = sharedUtil.string32;
|
||||
var warn = sharedUtil.warn;
|
||||
var Name = corePrimitives.Name;
|
||||
var Stream = coreStream.Stream;
|
||||
var Lexer = coreParser.Lexer;
|
||||
var CMapFactory = coreCMap.CMapFactory;
|
||||
var IdentityCMap = coreCMap.IdentityCMap;
|
||||
var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
|
||||
var getDingbatsGlyphsUnicode = coreGlyphList.getDingbatsGlyphsUnicode;
|
||||
var ISOAdobeCharset = coreCharsets.ISOAdobeCharset;
|
||||
|
|
|
@ -51,7 +51,7 @@ var PDFImage = (function PDFImageClosure() {
|
|||
* Decode the image in the main thread if it supported. Resovles the promise
|
||||
* when the image data is ready.
|
||||
*/
|
||||
function handleImageData(handler, xref, res, image) {
|
||||
function handleImageData(handler, xref, res, image, forceDataSchema) {
|
||||
if (image instanceof JpegStream && image.isNativelyDecodable(xref, res)) {
|
||||
// For natively supported jpegs send them to the main thread for decoding.
|
||||
var dict = image.dict;
|
||||
|
@ -59,7 +59,8 @@ var PDFImage = (function PDFImageClosure() {
|
|||
colorSpace = ColorSpace.parse(colorSpace, xref, res);
|
||||
var numComps = colorSpace.numComps;
|
||||
var decodePromise = handler.sendWithPromise('JpegDecode',
|
||||
[image.getIR(), numComps]);
|
||||
[image.getIR(forceDataSchema),
|
||||
numComps]);
|
||||
return decodePromise.then(function (message) {
|
||||
var data = message.data;
|
||||
return new Stream(data, 0, data.length, image.dict);
|
||||
|
@ -184,8 +185,10 @@ var PDFImage = (function PDFImageClosure() {
|
|||
* with a PDFImage when the image is ready to be used.
|
||||
*/
|
||||
PDFImage.buildImage = function PDFImage_buildImage(handler, xref,
|
||||
res, image, inline) {
|
||||
var imagePromise = handleImageData(handler, xref, res, image);
|
||||
res, image, inline,
|
||||
forceDataSchema) {
|
||||
var imagePromise = handleImageData(handler, xref, res, image,
|
||||
forceDataSchema);
|
||||
var smaskPromise;
|
||||
var maskPromise;
|
||||
|
||||
|
@ -193,13 +196,15 @@ var PDFImage = (function PDFImageClosure() {
|
|||
var mask = image.dict.get('Mask');
|
||||
|
||||
if (smask) {
|
||||
smaskPromise = handleImageData(handler, xref, res, smask);
|
||||
smaskPromise = handleImageData(handler, xref, res, smask,
|
||||
forceDataSchema);
|
||||
maskPromise = Promise.resolve(null);
|
||||
} else {
|
||||
smaskPromise = Promise.resolve(null);
|
||||
if (mask) {
|
||||
if (isStream(mask)) {
|
||||
maskPromise = handleImageData(handler, xref, res, mask);
|
||||
maskPromise = handleImageData(handler, xref, res, mask,
|
||||
forceDataSchema);
|
||||
} else if (isArray(mask)) {
|
||||
maskPromise = Promise.resolve(mask);
|
||||
} else {
|
||||
|
|
|
@ -110,8 +110,9 @@ var BasePdfManager = (function BasePdfManagerClosure() {
|
|||
})();
|
||||
|
||||
var LocalPdfManager = (function LocalPdfManagerClosure() {
|
||||
function LocalPdfManager(docId, data, password) {
|
||||
function LocalPdfManager(docId, data, password, evaluatorOptions) {
|
||||
this._docId = docId;
|
||||
this.evaluatorOptions = evaluatorOptions;
|
||||
var stream = new Stream(data);
|
||||
this.pdfDocument = new PDFDocument(this, stream, password);
|
||||
this._loadedStreamCapability = createPromiseCapability();
|
||||
|
@ -157,9 +158,10 @@ var LocalPdfManager = (function LocalPdfManagerClosure() {
|
|||
})();
|
||||
|
||||
var NetworkPdfManager = (function NetworkPdfManagerClosure() {
|
||||
function NetworkPdfManager(docId, pdfNetworkStream, args) {
|
||||
function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions) {
|
||||
this._docId = docId;
|
||||
this.msgHandler = args.msgHandler;
|
||||
this.evaluatorOptions = evaluatorOptions;
|
||||
|
||||
var params = {
|
||||
msgHandler: args.msgHandler,
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals PDFJS */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -36,6 +35,7 @@ var Util = sharedUtil.Util;
|
|||
var error = sharedUtil.error;
|
||||
var info = sharedUtil.info;
|
||||
var isArray = sharedUtil.isArray;
|
||||
var createObjectURL = sharedUtil.createObjectURL;
|
||||
var shadow = sharedUtil.shadow;
|
||||
var warn = sharedUtil.warn;
|
||||
var Dict = corePrimitives.Dict;
|
||||
|
@ -959,8 +959,8 @@ var JpegStream = (function JpegStreamClosure() {
|
|||
return this.buffer;
|
||||
};
|
||||
|
||||
JpegStream.prototype.getIR = function JpegStream_getIR() {
|
||||
return PDFJS.createObjectURL(this.bytes, 'image/jpeg');
|
||||
JpegStream.prototype.getIR = function JpegStream_getIR(forceDataSchema) {
|
||||
return createObjectURL(this.bytes, 'image/jpeg', forceDataSchema);
|
||||
};
|
||||
/**
|
||||
* Checks if the image can be decoded and displayed by the browser without any
|
||||
|
|
|
@ -19,18 +19,16 @@
|
|||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define('pdfjs/core/worker', ['exports', 'pdfjs/shared/util',
|
||||
'pdfjs/core/primitives', 'pdfjs/core/pdf_manager', 'pdfjs/shared/global'],
|
||||
'pdfjs/core/primitives', 'pdfjs/core/pdf_manager'],
|
||||
factory);
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
factory(exports, require('../shared/util.js'), require('./primitives.js'),
|
||||
require('./pdf_manager.js'), require('../shared/global.js'));
|
||||
require('./pdf_manager.js'));
|
||||
} else {
|
||||
factory((root.pdfjsCoreWorker = {}), root.pdfjsSharedUtil,
|
||||
root.pdfjsCorePrimitives, root.pdfjsCorePdfManager,
|
||||
root.pdfjsSharedGlobal);
|
||||
root.pdfjsCorePrimitives, root.pdfjsCorePdfManager);
|
||||
}
|
||||
}(this, function (exports, sharedUtil, corePrimitives, corePdfManager,
|
||||
sharedGlobal) {
|
||||
}(this, function (exports, sharedUtil, corePrimitives, corePdfManager) {
|
||||
|
||||
var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
|
||||
var InvalidPDFException = sharedUtil.InvalidPDFException;
|
||||
|
@ -48,11 +46,11 @@ var createPromiseCapability = sharedUtil.createPromiseCapability;
|
|||
var error = sharedUtil.error;
|
||||
var info = sharedUtil.info;
|
||||
var warn = sharedUtil.warn;
|
||||
var setVerbosityLevel = sharedUtil.setVerbosityLevel;
|
||||
var Ref = corePrimitives.Ref;
|
||||
var LocalPdfManager = corePdfManager.LocalPdfManager;
|
||||
var NetworkPdfManager = corePdfManager.NetworkPdfManager;
|
||||
var globalScope = sharedGlobal.globalScope;
|
||||
var PDFJS = sharedGlobal.PDFJS;
|
||||
var globalScope = sharedUtil.globalScope;
|
||||
|
||||
var WorkerTask = (function WorkerTaskClosure() {
|
||||
function WorkerTask(name) {
|
||||
|
@ -428,7 +426,7 @@ function setPDFNetworkStreamClass(cls) {
|
|||
PDFNetworkStream = cls;
|
||||
}
|
||||
|
||||
var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
||||
var WorkerMessageHandler = {
|
||||
setup: function wphSetup(handler, port) {
|
||||
var testMessageProcessed = false;
|
||||
handler.on('test', function wphSetupTest(data) {
|
||||
|
@ -464,6 +462,10 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
|||
});
|
||||
});
|
||||
|
||||
handler.on('configure', function wphConfigure(data) {
|
||||
setVerbosityLevel(data.verbosity);
|
||||
});
|
||||
|
||||
handler.on('GetDocRequest', function wphSetupDoc(data) {
|
||||
return WorkerMessageHandler.createDocumentHandler(data, port);
|
||||
});
|
||||
|
@ -533,14 +535,15 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
|||
return loadDocumentCapability.promise;
|
||||
}
|
||||
|
||||
function getPdfManager(data) {
|
||||
function getPdfManager(data, evaluatorOptions) {
|
||||
var pdfManagerCapability = createPromiseCapability();
|
||||
var pdfManager;
|
||||
|
||||
var source = data.source;
|
||||
if (source.data) {
|
||||
try {
|
||||
pdfManager = new LocalPdfManager(docId, source.data, source.password);
|
||||
pdfManager = new LocalPdfManager(docId, source.data, source.password,
|
||||
evaluatorOptions);
|
||||
pdfManagerCapability.resolve(pdfManager);
|
||||
} catch (ex) {
|
||||
pdfManagerCapability.reject(ex);
|
||||
|
@ -589,7 +592,7 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
|||
length: fullRequest.contentLength,
|
||||
disableAutoFetch: disableAutoFetch,
|
||||
rangeChunkSize: source.rangeChunkSize
|
||||
});
|
||||
}, evaluatorOptions);
|
||||
pdfManagerCapability.resolve(pdfManager);
|
||||
cancelXHRs = null;
|
||||
}).catch(function (reason) {
|
||||
|
@ -605,7 +608,8 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
|||
}
|
||||
// the data is array, instantiating directly from it
|
||||
try {
|
||||
pdfManager = new LocalPdfManager(docId, pdfFile, source.password);
|
||||
pdfManager = new LocalPdfManager(docId, pdfFile, source.password,
|
||||
evaluatorOptions);
|
||||
pdfManagerCapability.resolve(pdfManager);
|
||||
} catch (ex) {
|
||||
pdfManagerCapability.reject(ex);
|
||||
|
@ -685,16 +689,18 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
|||
|
||||
ensureNotTerminated();
|
||||
|
||||
PDFJS.maxImageSize = data.maxImageSize === undefined ?
|
||||
-1 : data.maxImageSize;
|
||||
PDFJS.disableFontFace = data.disableFontFace;
|
||||
PDFJS.disableCreateObjectURL = data.disableCreateObjectURL;
|
||||
PDFJS.verbosity = data.verbosity;
|
||||
PDFJS.cMapUrl = data.cMapUrl === undefined ?
|
||||
null : data.cMapUrl;
|
||||
PDFJS.cMapPacked = data.cMapPacked === true;
|
||||
var cMapOptions = {
|
||||
url: data.cMapUrl === undefined ? null : data.cMapUrl,
|
||||
packed: data.cMapPacked === true
|
||||
};
|
||||
var evaluatorOptions = {
|
||||
forceDataSchema: data.disableCreateObjectURL,
|
||||
maxImageSize: data.maxImageSize === undefined ? -1 : data.maxImageSize,
|
||||
disableFontFace: data.disableFontFace,
|
||||
cMapOptions: cMapOptions
|
||||
};
|
||||
|
||||
getPdfManager(data).then(function (newPdfManager) {
|
||||
getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
|
||||
if (terminated) {
|
||||
// We were in a process of setting up the manager, but it got
|
||||
// terminated in the middle.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue