|
|
@ -20,8 +20,8 @@ if (typeof PDFJS === 'undefined') { |
|
|
|
(typeof window !== 'undefined' ? window : this).PDFJS = {}; |
|
|
|
(typeof window !== 'undefined' ? window : this).PDFJS = {}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
PDFJS.version = '1.3.48'; |
|
|
|
PDFJS.version = '1.3.50'; |
|
|
|
PDFJS.build = '5f56a20'; |
|
|
|
PDFJS.build = '376788f'; |
|
|
|
|
|
|
|
|
|
|
|
(function pdfjsWrapper() { |
|
|
|
(function pdfjsWrapper() { |
|
|
|
// Use strict in our context only - users might not want it
|
|
|
|
// Use strict in our context only - users might not want it
|
|
|
@ -248,7 +248,6 @@ function error(msg) { |
|
|
|
console.log('Error: ' + msg); |
|
|
|
console.log('Error: ' + msg); |
|
|
|
console.log(backtrace()); |
|
|
|
console.log(backtrace()); |
|
|
|
} |
|
|
|
} |
|
|
|
UnsupportedManager.notify(UNSUPPORTED_FEATURES.unknown); |
|
|
|
|
|
|
|
throw new Error(msg); |
|
|
|
throw new Error(msg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -275,22 +274,6 @@ var UNSUPPORTED_FEATURES = PDFJS.UNSUPPORTED_FEATURES = { |
|
|
|
font: 'font' |
|
|
|
font: 'font' |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var UnsupportedManager = PDFJS.UnsupportedManager = |
|
|
|
|
|
|
|
(function UnsupportedManagerClosure() { |
|
|
|
|
|
|
|
var listeners = []; |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
listen: function (cb) { |
|
|
|
|
|
|
|
listeners.push(cb); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
notify: function (featureId) { |
|
|
|
|
|
|
|
warn('Unsupported feature "' + featureId + '"'); |
|
|
|
|
|
|
|
for (var i = 0, ii = listeners.length; i < ii; i++) { |
|
|
|
|
|
|
|
listeners[i](featureId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
})(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Combines two URLs. The baseUrl shall be absolute URL. If the url is an
|
|
|
|
// Combines two URLs. The baseUrl shall be absolute URL. If the url is an
|
|
|
|
// absolute URL, it will be returned as is.
|
|
|
|
// absolute URL, it will be returned as is.
|
|
|
|
function combineUrl(baseUrl, url) { |
|
|
|
function combineUrl(baseUrl, url) { |
|
|
@ -2093,6 +2076,12 @@ var PDFDocumentLoadingTask = (function PDFDocumentLoadingTaskClosure() { |
|
|
|
* an {Object} with the properties: {number} loaded and {number} total. |
|
|
|
* an {Object} with the properties: {number} loaded and {number} total. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
this.onProgress = null; |
|
|
|
this.onProgress = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Callback to when unsupported feature is used. The callback receives |
|
|
|
|
|
|
|
* an {PDFJS.UNSUPPORTED_FEATURES} argument. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
this.onUnsupportedFeature = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
PDFDocumentLoadingTask.prototype = |
|
|
|
PDFDocumentLoadingTask.prototype = |
|
|
@ -3158,6 +3147,19 @@ var WorkerTransport = (function WorkerTransportClosure() { |
|
|
|
} |
|
|
|
} |
|
|
|
}, this); |
|
|
|
}, this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
messageHandler.on('UnsupportedFeature', |
|
|
|
|
|
|
|
function transportUnsupportedFeature(data) { |
|
|
|
|
|
|
|
if (this.destroyed) { |
|
|
|
|
|
|
|
return; // Ignore any pending requests if the worker was terminated.
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var featureId = data.featureId; |
|
|
|
|
|
|
|
var loadingTask = this.loadingTask; |
|
|
|
|
|
|
|
if (loadingTask.onUnsupportedFeature) { |
|
|
|
|
|
|
|
loadingTask.onUnsupportedFeature(featureId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
PDFJS.UnsupportedManager.notify(featureId); |
|
|
|
|
|
|
|
}, this); |
|
|
|
|
|
|
|
|
|
|
|
messageHandler.on('JpegDecode', function(data) { |
|
|
|
messageHandler.on('JpegDecode', function(data) { |
|
|
|
if (this.destroyed) { |
|
|
|
if (this.destroyed) { |
|
|
|
return Promise.reject('Worker was terminated'); |
|
|
|
return Promise.reject('Worker was terminated'); |
|
|
@ -3575,6 +3577,26 @@ var InternalRenderTask = (function InternalRenderTaskClosure() { |
|
|
|
return InternalRenderTask; |
|
|
|
return InternalRenderTask; |
|
|
|
})(); |
|
|
|
})(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* (Deprecated) Global observer of unsupported feature usages. Use |
|
|
|
|
|
|
|
* onUnsupportedFeature callback of the {PDFDocumentLoadingTask} instance. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
PDFJS.UnsupportedManager = (function UnsupportedManagerClosure() { |
|
|
|
|
|
|
|
var listeners = []; |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
listen: function (cb) { |
|
|
|
|
|
|
|
deprecated('Global UnsupportedManager.listen is used: ' + |
|
|
|
|
|
|
|
' use PDFDocumentLoadingTask.onUnsupportedFeature instead'); |
|
|
|
|
|
|
|
listeners.push(cb); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
notify: function (featureId) { |
|
|
|
|
|
|
|
for (var i = 0, ii = listeners.length; i < ii; i++) { |
|
|
|
|
|
|
|
listeners[i](featureId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
})(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Metadata = PDFJS.Metadata = (function MetadataClosure() { |
|
|
|
var Metadata = PDFJS.Metadata = (function MetadataClosure() { |
|
|
|
function fixMetadata(meta) { |
|
|
|
function fixMetadata(meta) { |
|
|
@ -5730,7 +5752,6 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
paintXObject: function CanvasGraphics_paintXObject() { |
|
|
|
paintXObject: function CanvasGraphics_paintXObject() { |
|
|
|
UnsupportedManager.notify(UNSUPPORTED_FEATURES.unknown); |
|
|
|
|
|
|
|
warn('Unsupported \'paintXObject\' command.'); |
|
|
|
warn('Unsupported \'paintXObject\' command.'); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -17182,7 +17203,7 @@ var Pattern = (function PatternClosure() { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Pattern.parseShading = function Pattern_parseShading(shading, matrix, xref, |
|
|
|
Pattern.parseShading = function Pattern_parseShading(shading, matrix, xref, |
|
|
|
res) { |
|
|
|
res, handler) { |
|
|
|
|
|
|
|
|
|
|
|
var dict = isStream(shading) ? shading.dict : shading; |
|
|
|
var dict = isStream(shading) ? shading.dict : shading; |
|
|
|
var type = dict.get('ShadingType'); |
|
|
|
var type = dict.get('ShadingType'); |
|
|
@ -17205,7 +17226,8 @@ var Pattern = (function PatternClosure() { |
|
|
|
if (ex instanceof MissingDataException) { |
|
|
|
if (ex instanceof MissingDataException) { |
|
|
|
throw ex; |
|
|
|
throw ex; |
|
|
|
} |
|
|
|
} |
|
|
|
UnsupportedManager.notify(UNSUPPORTED_FEATURES.shadingPattern); |
|
|
|
handler.send('UnsupportedFeature', |
|
|
|
|
|
|
|
{featureId: UNSUPPORTED_FEATURES.shadingPattern}); |
|
|
|
warn(ex); |
|
|
|
warn(ex); |
|
|
|
return new Shadings.Dummy(); |
|
|
|
return new Shadings.Dummy(); |
|
|
|
} |
|
|
|
} |
|
|
@ -18243,6 +18265,9 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { |
|
|
|
then(function () { |
|
|
|
then(function () { |
|
|
|
return translated; |
|
|
|
return translated; |
|
|
|
}, function (reason) { |
|
|
|
}, function (reason) { |
|
|
|
|
|
|
|
// Error in the font data -- sending unsupported feature notification.
|
|
|
|
|
|
|
|
self.handler.send('UnsupportedFeature', |
|
|
|
|
|
|
|
{featureId: UNSUPPORTED_FEATURES.font}); |
|
|
|
return new TranslatedFont('g_font_error', |
|
|
|
return new TranslatedFont('g_font_error', |
|
|
|
new ErrorFont('Type3 font load error: ' + reason), translated.font); |
|
|
|
new ErrorFont('Type3 font load error: ' + reason), translated.font); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -18467,6 +18492,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { |
|
|
|
translatedPromise = Promise.reject(e); |
|
|
|
translatedPromise = Promise.reject(e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var self = this; |
|
|
|
translatedPromise.then(function (translatedFont) { |
|
|
|
translatedPromise.then(function (translatedFont) { |
|
|
|
if (translatedFont.fontType !== undefined) { |
|
|
|
if (translatedFont.fontType !== undefined) { |
|
|
|
var xrefFontStats = xref.stats.fontTypes; |
|
|
|
var xrefFontStats = xref.stats.fontTypes; |
|
|
@ -18477,7 +18503,9 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { |
|
|
|
translatedFont, font)); |
|
|
|
translatedFont, font)); |
|
|
|
}, function (reason) { |
|
|
|
}, function (reason) { |
|
|
|
// TODO fontCapability.reject?
|
|
|
|
// TODO fontCapability.reject?
|
|
|
|
UnsupportedManager.notify(UNSUPPORTED_FEATURES.font); |
|
|
|
// Error in the font data -- sending unsupported feature notification.
|
|
|
|
|
|
|
|
self.handler.send('UnsupportedFeature', |
|
|
|
|
|
|
|
{featureId: UNSUPPORTED_FEATURES.font}); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
// error, but it's still nice to have font type reported
|
|
|
|
// error, but it's still nice to have font type reported
|
|
|
@ -18530,7 +18558,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { |
|
|
|
} else if (typeNum === SHADING_PATTERN) { |
|
|
|
} else if (typeNum === SHADING_PATTERN) { |
|
|
|
var shading = dict.get('Shading'); |
|
|
|
var shading = dict.get('Shading'); |
|
|
|
var matrix = dict.get('Matrix'); |
|
|
|
var matrix = dict.get('Matrix'); |
|
|
|
pattern = Pattern.parseShading(shading, matrix, xref, resources); |
|
|
|
pattern = Pattern.parseShading(shading, matrix, xref, resources, |
|
|
|
|
|
|
|
this.handler); |
|
|
|
operatorList.addOp(fn, pattern.getIR()); |
|
|
|
operatorList.addOp(fn, pattern.getIR()); |
|
|
|
return Promise.resolve(); |
|
|
|
return Promise.resolve(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -18767,7 +18796,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var shadingFill = Pattern.parseShading(shading, null, xref, |
|
|
|
var shadingFill = Pattern.parseShading(shading, null, xref, |
|
|
|
resources); |
|
|
|
resources, self.handler); |
|
|
|
var patternIR = shadingFill.getIR(); |
|
|
|
var patternIR = shadingFill.getIR(); |
|
|
|
args = [patternIR]; |
|
|
|
args = [patternIR]; |
|
|
|
fn = OPS.shadingFill; |
|
|
|
fn = OPS.shadingFill; |
|
|
@ -41981,6 +42010,11 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = { |
|
|
|
return; // ignoring errors from the terminated thread
|
|
|
|
return; // ignoring errors from the terminated thread
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// For compatibility with older behavior, generating unknown
|
|
|
|
|
|
|
|
// unsupported feature notification on errors.
|
|
|
|
|
|
|
|
handler.send('UnsupportedFeature', |
|
|
|
|
|
|
|
{featureId: UNSUPPORTED_FEATURES.unknown}); |
|
|
|
|
|
|
|
|
|
|
|
var minimumStackMessage = |
|
|
|
var minimumStackMessage = |
|
|
|
'worker.js: while trying to getPage() and getOperatorList()'; |
|
|
|
'worker.js: while trying to getPage() and getOperatorList()'; |
|
|
|
|
|
|
|
|
|
|
@ -42115,15 +42149,6 @@ if (typeof window === 'undefined') { |
|
|
|
globalScope.console = workerConsole; |
|
|
|
globalScope.console = workerConsole; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Listen for unsupported features so we can pass them on to the main thread.
|
|
|
|
|
|
|
|
PDFJS.UnsupportedManager.listen(function (msg) { |
|
|
|
|
|
|
|
globalScope.postMessage({ |
|
|
|
|
|
|
|
targetName: 'main', |
|
|
|
|
|
|
|
action: '_unsupported_feature', |
|
|
|
|
|
|
|
data: msg |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var handler = new MessageHandler('worker', 'main', this); |
|
|
|
var handler = new MessageHandler('worker', 'main', this); |
|
|
|
WorkerMessageHandler.setup(handler, this); |
|
|
|
WorkerMessageHandler.setup(handler, this); |
|
|
|
} |
|
|
|
} |
|
|
|