Browse Source

PDF.js version 1.9.634 - See mozilla/pdf.js@509d3728f1b18620c6718697303968f39c10ad59

master v1.9.634
pdfjsbot 7 years ago
parent
commit
db6328ca27
  1. 2
      bower.json
  2. 408
      build/pdf.combined.js
  3. 2
      build/pdf.combined.js.map
  4. 14
      build/pdf.js
  5. 2
      build/pdf.js.map
  6. 2
      build/pdf.min.js
  7. 398
      build/pdf.worker.js
  8. 2
      build/pdf.worker.js.map
  9. 2
      build/pdf.worker.min.js
  10. 392
      lib/core/evaluator.js
  11. 2
      lib/core/worker.js
  12. 6
      lib/display/api.js
  13. 4
      lib/display/global.js
  14. 4
      lib/pdf.js
  15. 4
      lib/pdf.worker.js
  16. 10
      lib/test/unit/evaluator_spec.js
  17. 2
      package.json

2
bower.json

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

408
build/pdf.combined.js

@ -11341,7 +11341,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { @@ -11341,7 +11341,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
if (worker.destroyed) {
return Promise.reject(new Error('Worker was destroyed'));
}
var apiVersion = '1.9.632';
var apiVersion = '1.9.634';
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
source.chunkedViewerLoading = !!pdfDataRangeTransport;
@ -12645,8 +12645,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -12645,8 +12645,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.9.632';
exports.build = build = 'bbec2ed1';
exports.version = version = '1.9.634';
exports.build = build = '509d3728';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -18995,8 +18995,6 @@ Object.defineProperty(exports, "__esModule", { @@ -18995,8 +18995,6 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PartialEvaluator = exports.OperatorList = 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 _util = __w_pdfjs_require__(0);
var _cmap = __w_pdfjs_require__(108);
@ -19764,17 +19762,21 @@ var PartialEvaluator = function PartialEvaluatorClosure() { @@ -19764,17 +19762,21 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
switch (fn | 0) {
case _util.OPS.paintXObject:
var name = args[0].name;
if (!name) {
(0, _util.warn)('XObject must be referred to by name.');
continue;
}
if (imageCache[name] !== undefined) {
if (name && imageCache[name] !== undefined) {
operatorList.addOp(imageCache[name].fn, imageCache[name].args);
args = null;
continue;
}
var xobj = xobjs.get(name);
if (xobj) {
next(new Promise(function (resolveXObject, rejectXObject) {
if (!name) {
throw new _util.FormatError('XObject must be referred to by name.');
}
var xobj = xobjs.get(name);
if (!xobj) {
operatorList.addOp(fn, args);
resolveXObject();
return;
}
if (!(0, _primitives.isStream)(xobj)) {
throw new _util.FormatError('XObject should be a stream');
}
@ -19784,22 +19786,28 @@ var PartialEvaluator = function PartialEvaluatorClosure() { @@ -19784,22 +19786,28 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
if (type.name === 'Form') {
stateManager.save();
next(self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
stateManager.restore();
}));
resolveXObject();
}, rejectXObject);
return;
} else if (type.name === 'Image') {
self.buildPaintImageXObject(resources, xobj, false, operatorList, name, imageCache);
args = null;
continue;
} else if (type.name === 'PS') {
(0, _util.info)('Ignored XObject subtype PS');
continue;
} else {
throw new _util.FormatError('Unhandled XObject subtype ' + type.name);
}
}
break;
resolveXObject();
}).catch(function (reason) {
if (self.options.ignoreErrors) {
self.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.unknown });
(0, _util.warn)('getOperatorList - ignoring XObject: "' + reason + '".');
return;
}
throw reason;
}));
return;
case _util.OPS.setFont:
var fontSize = args[1];
next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
@ -20234,183 +20242,162 @@ var PartialEvaluator = function PartialEvaluatorClosure() { @@ -20234,183 +20242,162 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var fn = operation.fn;
args = operation.args;
var advance, diff;
var fontNameArg, fontSizeArg;
var isSameTextLine;
var items;
var offset;
var j, jj;
var breakTextRun;
var name;
var xobj;
var type;
var currentState;
var xObjStateManager;
var matrix;
var dictName;
var extGState;
var gState;
var gStateFont;
var _ret2 = function () {
switch (fn | 0) {
case _util.OPS.setFont:
fontNameArg = args[0].name;
fontSizeArg = args[1];
if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
break;
}
flushTextContentItem();
textState.fontName = fontNameArg;
textState.fontSize = fontSizeArg;
next(handleSetFont(fontNameArg, null));
return {
v: void 0
};
case _util.OPS.setTextRise:
flushTextContentItem();
textState.textRise = args[0];
break;
case _util.OPS.setHScale:
flushTextContentItem();
textState.textHScale = args[0] / 100;
break;
case _util.OPS.setLeading:
flushTextContentItem();
textState.leading = args[0];
break;
case _util.OPS.moveText:
isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
advance = args[0] - args[1];
if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(args[0], args[1]);
textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
addFakeSpaces(diff, textContentItem.str);
break;
}
flushTextContentItem();
textState.translateTextLineMatrix(args[0], args[1]);
textState.textMatrix = textState.textLineMatrix.slice();
switch (fn | 0) {
case _util.OPS.setFont:
var fontNameArg = args[0].name,
fontSizeArg = args[1];
if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
break;
case _util.OPS.setLeadingMoveText:
flushTextContentItem();
textState.leading = -args[1];
}
flushTextContentItem();
textState.fontName = fontNameArg;
textState.fontSize = fontSizeArg;
next(handleSetFont(fontNameArg, null));
return;
case _util.OPS.setTextRise:
flushTextContentItem();
textState.textRise = args[0];
break;
case _util.OPS.setHScale:
flushTextContentItem();
textState.textHScale = args[0] / 100;
break;
case _util.OPS.setLeading:
flushTextContentItem();
textState.leading = args[0];
break;
case _util.OPS.moveText:
var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
advance = args[0] - args[1];
if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(args[0], args[1]);
textState.textMatrix = textState.textLineMatrix.slice();
break;
case _util.OPS.nextLine:
flushTextContentItem();
textState.carriageReturn();
break;
case _util.OPS.setTextMatrix:
advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(advance.width, advance.height);
textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
addFakeSpaces(diff, textContentItem.str);
break;
}
flushTextContentItem();
textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
addFakeSpaces(diff, textContentItem.str);
break;
case _util.OPS.setCharSpacing:
textState.charSpacing = args[0];
break;
case _util.OPS.setWordSpacing:
textState.wordSpacing = args[0];
break;
case _util.OPS.beginText:
flushTextContentItem();
textState.textMatrix = _util.IDENTITY_MATRIX.slice();
textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
}
flushTextContentItem();
textState.translateTextLineMatrix(args[0], args[1]);
textState.textMatrix = textState.textLineMatrix.slice();
break;
case _util.OPS.setLeadingMoveText:
flushTextContentItem();
textState.leading = -args[1];
textState.translateTextLineMatrix(args[0], args[1]);
textState.textMatrix = textState.textLineMatrix.slice();
break;
case _util.OPS.nextLine:
flushTextContentItem();
textState.carriageReturn();
break;
case _util.OPS.setTextMatrix:
advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(advance.width, advance.height);
textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
addFakeSpaces(diff, textContentItem.str);
break;
case _util.OPS.showSpacedText:
items = args[0];
for (j = 0, jj = items.length; j < jj; j++) {
if (typeof items[j] === 'string') {
buildTextContentItem(items[j]);
} else if ((0, _util.isNum)(items[j])) {
ensureTextContentItem();
advance = items[j] * textState.fontSize / 1000;
breakTextRun = false;
if (textState.font.vertical) {
offset = advance;
textState.translateTextMatrix(0, offset);
breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
if (!breakTextRun) {
textContentItem.height += offset;
}
} else {
advance = -advance;
offset = advance * textState.textHScale;
textState.translateTextMatrix(offset, 0);
breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
if (!breakTextRun) {
textContentItem.width += offset;
}
}
flushTextContentItem();
textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.setCharSpacing:
textState.charSpacing = args[0];
break;
case _util.OPS.setWordSpacing:
textState.wordSpacing = args[0];
break;
case _util.OPS.beginText:
flushTextContentItem();
textState.textMatrix = _util.IDENTITY_MATRIX.slice();
textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
break;
case _util.OPS.showSpacedText:
var items = args[0];
var offset;
for (var j = 0, jj = items.length; j < jj; j++) {
if (typeof items[j] === 'string') {
buildTextContentItem(items[j]);
} else if ((0, _util.isNum)(items[j])) {
ensureTextContentItem();
advance = items[j] * textState.fontSize / 1000;
var breakTextRun = false;
if (textState.font.vertical) {
offset = advance;
textState.translateTextMatrix(0, offset);
breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
if (!breakTextRun) {
textContentItem.height += offset;
}
if (breakTextRun) {
flushTextContentItem();
} else if (advance > 0) {
addFakeSpaces(advance, textContentItem.str);
} else {
advance = -advance;
offset = advance * textState.textHScale;
textState.translateTextMatrix(offset, 0);
breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
if (!breakTextRun) {
textContentItem.width += offset;
}
}
if (breakTextRun) {
flushTextContentItem();
} else if (advance > 0) {
addFakeSpaces(advance, textContentItem.str);
}
}
}
break;
case _util.OPS.showText:
buildTextContentItem(args[0]);
break;
case _util.OPS.nextLineShowText:
flushTextContentItem();
textState.carriageReturn();
buildTextContentItem(args[0]);
break;
case _util.OPS.nextLineSetSpacingShowText:
flushTextContentItem();
textState.wordSpacing = args[0];
textState.charSpacing = args[1];
textState.carriageReturn();
buildTextContentItem(args[2]);
break;
case _util.OPS.paintXObject:
flushTextContentItem();
if (!xobjs) {
xobjs = resources.get('XObject') || _primitives.Dict.empty;
}
var name = args[0].name;
if (name && skipEmptyXObjs[name] !== undefined) {
break;
case _util.OPS.showText:
buildTextContentItem(args[0]);
break;
case _util.OPS.nextLineShowText:
flushTextContentItem();
textState.carriageReturn();
buildTextContentItem(args[0]);
break;
case _util.OPS.nextLineSetSpacingShowText:
flushTextContentItem();
textState.wordSpacing = args[0];
textState.charSpacing = args[1];
textState.carriageReturn();
buildTextContentItem(args[2]);
break;
case _util.OPS.paintXObject:
flushTextContentItem();
if (!xobjs) {
xobjs = resources.get('XObject') || _primitives.Dict.empty;
}
name = args[0].name;
if (name in skipEmptyXObjs) {
break;
}
next(new Promise(function (resolveXObject, rejectXObject) {
if (!name) {
throw new _util.FormatError('XObject must be referred to by name.');
}
xobj = xobjs.get(name);
var xobj = xobjs.get(name);
if (!xobj) {
break;
resolveXObject();
return;
}
if (!(0, _primitives.isStream)(xobj)) {
throw new _util.FormatError('XObject should be a stream');
}
type = xobj.dict.get('Subtype');
var type = xobj.dict.get('Subtype');
if (!(0, _primitives.isName)(type)) {
throw new _util.FormatError('XObject should have a Name subtype');
}
if (type.name !== 'Form') {
skipEmptyXObjs[name] = true;
break;
resolveXObject();
return;
}
currentState = stateManager.state.clone();
xObjStateManager = new StateManager(currentState);
matrix = xobj.dict.getArray('Matrix');
var currentState = stateManager.state.clone();
var xObjStateManager = new StateManager(currentState);
var matrix = xobj.dict.getArray('Matrix');
if (Array.isArray(matrix) && matrix.length === 6) {
xObjStateManager.transform(matrix);
}
@ -20429,7 +20416,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() { @@ -20429,7 +20416,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return sink.ready;
}
};
next(self.getTextContent({
self.getTextContent({
stream: xobj,
task: task,
resources: xobj.dict.get('Resources') || resources,
@ -20442,38 +20429,39 @@ var PartialEvaluator = function PartialEvaluatorClosure() { @@ -20442,38 +20429,39 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
if (!sinkWrapper.enqueueInvoked) {
skipEmptyXObjs[name] = true;
}
}));
return {
v: void 0
};
case _util.OPS.setGState:
flushTextContentItem();
dictName = args[0];
extGState = resources.get('ExtGState');
if (!(0, _primitives.isDict)(extGState) || !(0, _primitives.isName)(dictName)) {
break;
}
gState = extGState.get(dictName.name);
if (!(0, _primitives.isDict)(gState)) {
break;
resolveXObject();
}, rejectXObject);
}).catch(function (reason) {
if (reason instanceof _util.AbortException) {
return;
}
gStateFont = gState.get('Font');
if (gStateFont) {
textState.fontName = null;
textState.fontSize = gStateFont[1];
next(handleSetFont(null, gStateFont[0]));
return {
v: void 0
};
if (self.options.ignoreErrors) {
(0, _util.warn)('getTextContent - ignoring XObject: "' + reason + '".');
return;
}
throw reason;
}));
return;
case _util.OPS.setGState:
flushTextContentItem();
var dictName = args[0];
var extGState = resources.get('ExtGState');
if (!(0, _primitives.isDict)(extGState) || !(0, _primitives.isName)(dictName)) {
break;
}
}();
if ((typeof _ret2 === 'undefined' ? 'undefined' : _typeof(_ret2)) === "object") return _ret2.v;
}
var gState = extGState.get(dictName.name);
if (!(0, _primitives.isDict)(gState)) {
break;
}
var gStateFont = gState.get('Font');
if (gStateFont) {
textState.fontName = null;
textState.fontSize = gStateFont[1];
next(handleSetFont(null, gStateFont[0]));
return;
}
break;
}
if (textContent.items.length >= sink.desiredSize) {
stop = true;
break;
@ -29773,8 +29761,8 @@ exports.SVGGraphics = SVGGraphics; @@ -29773,8 +29761,8 @@ exports.SVGGraphics = SVGGraphics;
"use strict";
var pdfjsVersion = '1.9.632';
var pdfjsBuild = 'bbec2ed1';
var pdfjsVersion = '1.9.634';
var pdfjsBuild = '509d3728';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(98);
var pdfjsDisplayAPI = __w_pdfjs_require__(54);
@ -35635,8 +35623,8 @@ if (!_global_scope2.default.PDFJS) { @@ -35635,8 +35623,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '1.9.632';
PDFJS.build = 'bbec2ed1';
PDFJS.version = '1.9.634';
PDFJS.build = '509d3728';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -38593,7 +38581,7 @@ var WorkerMessageHandler = { @@ -38593,7 +38581,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
var apiVersion = docParams.apiVersion;
var workerVersion = '1.9.632';
var workerVersion = '1.9.634';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
}

2
build/pdf.combined.js.map

File diff suppressed because one or more lines are too long

14
build/pdf.js

@ -2946,7 +2946,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { @@ -2946,7 +2946,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
if (worker.destroyed) {
return Promise.reject(new Error('Worker was destroyed'));
}
var apiVersion = '1.9.632';
var apiVersion = '1.9.634';
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
source.chunkedViewerLoading = !!pdfDataRangeTransport;
@ -4337,8 +4337,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -4337,8 +4337,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.9.632';
exports.build = build = 'bbec2ed1';
exports.version = version = '1.9.634';
exports.build = build = '509d3728';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -7410,8 +7410,8 @@ exports.SVGGraphics = SVGGraphics; @@ -7410,8 +7410,8 @@ exports.SVGGraphics = SVGGraphics;
"use strict";
var pdfjsVersion = '1.9.632';
var pdfjsBuild = 'bbec2ed1';
var pdfjsVersion = '1.9.634';
var pdfjsBuild = '509d3728';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(82);
var pdfjsDisplayAPI = __w_pdfjs_require__(48);
@ -13272,8 +13272,8 @@ if (!_global_scope2.default.PDFJS) { @@ -13272,8 +13272,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '1.9.632';
PDFJS.build = 'bbec2ed1';
PDFJS.version = '1.9.634';
PDFJS.build = '509d3728';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {

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

398
build/pdf.worker.js vendored

@ -16515,8 +16515,6 @@ Object.defineProperty(exports, "__esModule", { @@ -16515,8 +16515,6 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PartialEvaluator = exports.OperatorList = 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 _util = __w_pdfjs_require__(0);
var _cmap = __w_pdfjs_require__(95);
@ -17284,17 +17282,21 @@ var PartialEvaluator = function PartialEvaluatorClosure() { @@ -17284,17 +17282,21 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
switch (fn | 0) {
case _util.OPS.paintXObject:
var name = args[0].name;
if (!name) {
(0, _util.warn)('XObject must be referred to by name.');
continue;
}
if (imageCache[name] !== undefined) {
if (name && imageCache[name] !== undefined) {
operatorList.addOp(imageCache[name].fn, imageCache[name].args);
args = null;
continue;
}
var xobj = xobjs.get(name);
if (xobj) {
next(new Promise(function (resolveXObject, rejectXObject) {
if (!name) {
throw new _util.FormatError('XObject must be referred to by name.');
}
var xobj = xobjs.get(name);
if (!xobj) {
operatorList.addOp(fn, args);
resolveXObject();
return;
}
if (!(0, _primitives.isStream)(xobj)) {
throw new _util.FormatError('XObject should be a stream');
}
@ -17304,22 +17306,28 @@ var PartialEvaluator = function PartialEvaluatorClosure() { @@ -17304,22 +17306,28 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
if (type.name === 'Form') {
stateManager.save();
next(self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
stateManager.restore();
}));
resolveXObject();
}, rejectXObject);
return;
} else if (type.name === 'Image') {
self.buildPaintImageXObject(resources, xobj, false, operatorList, name, imageCache);
args = null;
continue;
} else if (type.name === 'PS') {
(0, _util.info)('Ignored XObject subtype PS');
continue;
} else {
throw new _util.FormatError('Unhandled XObject subtype ' + type.name);
}
}
break;
resolveXObject();
}).catch(function (reason) {
if (self.options.ignoreErrors) {
self.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.unknown });
(0, _util.warn)('getOperatorList - ignoring XObject: "' + reason + '".');
return;
}
throw reason;
}));
return;
case _util.OPS.setFont:
var fontSize = args[1];
next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
@ -17754,183 +17762,162 @@ var PartialEvaluator = function PartialEvaluatorClosure() { @@ -17754,183 +17762,162 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var fn = operation.fn;
args = operation.args;
var advance, diff;
var fontNameArg, fontSizeArg;
var isSameTextLine;
var items;
var offset;
var j, jj;
var breakTextRun;
var name;
var xobj;
var type;
var currentState;
var xObjStateManager;
var matrix;
var dictName;
var extGState;
var gState;
var gStateFont;
var _ret2 = function () {
switch (fn | 0) {
case _util.OPS.setFont:
fontNameArg = args[0].name;
fontSizeArg = args[1];
if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
break;
}
flushTextContentItem();
textState.fontName = fontNameArg;
textState.fontSize = fontSizeArg;
next(handleSetFont(fontNameArg, null));
return {
v: void 0
};
case _util.OPS.setTextRise:
flushTextContentItem();
textState.textRise = args[0];
break;
case _util.OPS.setHScale:
flushTextContentItem();
textState.textHScale = args[0] / 100;
break;
case _util.OPS.setLeading:
flushTextContentItem();
textState.leading = args[0];
break;
case _util.OPS.moveText:
isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
advance = args[0] - args[1];
if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(args[0], args[1]);
textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
addFakeSpaces(diff, textContentItem.str);
break;
}
flushTextContentItem();
textState.translateTextLineMatrix(args[0], args[1]);
textState.textMatrix = textState.textLineMatrix.slice();
switch (fn | 0) {
case _util.OPS.setFont:
var fontNameArg = args[0].name,
fontSizeArg = args[1];
if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
break;
case _util.OPS.setLeadingMoveText:
flushTextContentItem();
textState.leading = -args[1];
}
flushTextContentItem();
textState.fontName = fontNameArg;
textState.fontSize = fontSizeArg;
next(handleSetFont(fontNameArg, null));
return;
case _util.OPS.setTextRise:
flushTextContentItem();
textState.textRise = args[0];
break;
case _util.OPS.setHScale:
flushTextContentItem();
textState.textHScale = args[0] / 100;
break;
case _util.OPS.setLeading:
flushTextContentItem();
textState.leading = args[0];
break;
case _util.OPS.moveText:
var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
advance = args[0] - args[1];
if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(args[0], args[1]);
textState.textMatrix = textState.textLineMatrix.slice();
break;
case _util.OPS.nextLine:
flushTextContentItem();
textState.carriageReturn();
break;
case _util.OPS.setTextMatrix:
advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(advance.width, advance.height);
textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
addFakeSpaces(diff, textContentItem.str);
break;
}
flushTextContentItem();
textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
addFakeSpaces(diff, textContentItem.str);
break;
case _util.OPS.setCharSpacing:
textState.charSpacing = args[0];
break;
case _util.OPS.setWordSpacing:
textState.wordSpacing = args[0];
break;
case _util.OPS.beginText:
flushTextContentItem();
textState.textMatrix = _util.IDENTITY_MATRIX.slice();
textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
}
flushTextContentItem();
textState.translateTextLineMatrix(args[0], args[1]);
textState.textMatrix = textState.textLineMatrix.slice();
break;
case _util.OPS.setLeadingMoveText:
flushTextContentItem();
textState.leading = -args[1];
textState.translateTextLineMatrix(args[0], args[1]);
textState.textMatrix = textState.textLineMatrix.slice();
break;
case _util.OPS.nextLine:
flushTextContentItem();
textState.carriageReturn();
break;
case _util.OPS.setTextMatrix:
advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(advance.width, advance.height);
textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
addFakeSpaces(diff, textContentItem.str);
break;
case _util.OPS.showSpacedText:
items = args[0];
for (j = 0, jj = items.length; j < jj; j++) {
if (typeof items[j] === 'string') {
buildTextContentItem(items[j]);
} else if ((0, _util.isNum)(items[j])) {
ensureTextContentItem();
advance = items[j] * textState.fontSize / 1000;
breakTextRun = false;
if (textState.font.vertical) {
offset = advance;
textState.translateTextMatrix(0, offset);
breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
if (!breakTextRun) {
textContentItem.height += offset;
}
} else {
advance = -advance;
offset = advance * textState.textHScale;
textState.translateTextMatrix(offset, 0);
breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
if (!breakTextRun) {
textContentItem.width += offset;
}
}
flushTextContentItem();
textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.setCharSpacing:
textState.charSpacing = args[0];
break;
case _util.OPS.setWordSpacing:
textState.wordSpacing = args[0];
break;
case _util.OPS.beginText:
flushTextContentItem();
textState.textMatrix = _util.IDENTITY_MATRIX.slice();
textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
break;
case _util.OPS.showSpacedText:
var items = args[0];
var offset;
for (var j = 0, jj = items.length; j < jj; j++) {
if (typeof items[j] === 'string') {
buildTextContentItem(items[j]);
} else if ((0, _util.isNum)(items[j])) {
ensureTextContentItem();
advance = items[j] * textState.fontSize / 1000;
var breakTextRun = false;
if (textState.font.vertical) {
offset = advance;
textState.translateTextMatrix(0, offset);
breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
if (!breakTextRun) {
textContentItem.height += offset;
}
if (breakTextRun) {
flushTextContentItem();
} else if (advance > 0) {
addFakeSpaces(advance, textContentItem.str);
} else {
advance = -advance;
offset = advance * textState.textHScale;
textState.translateTextMatrix(offset, 0);
breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
if (!breakTextRun) {
textContentItem.width += offset;
}
}
if (breakTextRun) {
flushTextContentItem();
} else if (advance > 0) {
addFakeSpaces(advance, textContentItem.str);
}
}
}
break;
case _util.OPS.showText:
buildTextContentItem(args[0]);
break;
case _util.OPS.nextLineShowText:
flushTextContentItem();
textState.carriageReturn();
buildTextContentItem(args[0]);
break;
case _util.OPS.nextLineSetSpacingShowText:
flushTextContentItem();
textState.wordSpacing = args[0];
textState.charSpacing = args[1];
textState.carriageReturn();
buildTextContentItem(args[2]);
break;
case _util.OPS.paintXObject:
flushTextContentItem();
if (!xobjs) {
xobjs = resources.get('XObject') || _primitives.Dict.empty;
}
var name = args[0].name;
if (name && skipEmptyXObjs[name] !== undefined) {
break;
case _util.OPS.showText:
buildTextContentItem(args[0]);
break;
case _util.OPS.nextLineShowText:
flushTextContentItem();
textState.carriageReturn();
buildTextContentItem(args[0]);
break;
case _util.OPS.nextLineSetSpacingShowText:
flushTextContentItem();
textState.wordSpacing = args[0];
textState.charSpacing = args[1];
textState.carriageReturn();
buildTextContentItem(args[2]);
break;
case _util.OPS.paintXObject:
flushTextContentItem();
if (!xobjs) {
xobjs = resources.get('XObject') || _primitives.Dict.empty;
}
name = args[0].name;
if (name in skipEmptyXObjs) {
break;
}
next(new Promise(function (resolveXObject, rejectXObject) {
if (!name) {
throw new _util.FormatError('XObject must be referred to by name.');
}
xobj = xobjs.get(name);
var xobj = xobjs.get(name);
if (!xobj) {
break;
resolveXObject();
return;
}
if (!(0, _primitives.isStream)(xobj)) {
throw new _util.FormatError('XObject should be a stream');
}
type = xobj.dict.get('Subtype');
var type = xobj.dict.get('Subtype');
if (!(0, _primitives.isName)(type)) {
throw new _util.FormatError('XObject should have a Name subtype');
}
if (type.name !== 'Form') {
skipEmptyXObjs[name] = true;
break;
resolveXObject();
return;
}
currentState = stateManager.state.clone();
xObjStateManager = new StateManager(currentState);
matrix = xobj.dict.getArray('Matrix');
var currentState = stateManager.state.clone();
var xObjStateManager = new StateManager(currentState);
var matrix = xobj.dict.getArray('Matrix');
if (Array.isArray(matrix) && matrix.length === 6) {
xObjStateManager.transform(matrix);
}
@ -17949,7 +17936,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() { @@ -17949,7 +17936,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return sink.ready;
}
};
next(self.getTextContent({
self.getTextContent({
stream: xobj,
task: task,
resources: xobj.dict.get('Resources') || resources,
@ -17962,38 +17949,39 @@ var PartialEvaluator = function PartialEvaluatorClosure() { @@ -17962,38 +17949,39 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
if (!sinkWrapper.enqueueInvoked) {
skipEmptyXObjs[name] = true;
}
}));
return {
v: void 0
};
case _util.OPS.setGState:
flushTextContentItem();
dictName = args[0];
extGState = resources.get('ExtGState');
if (!(0, _primitives.isDict)(extGState) || !(0, _primitives.isName)(dictName)) {
break;
}
gState = extGState.get(dictName.name);
if (!(0, _primitives.isDict)(gState)) {
break;
resolveXObject();
}, rejectXObject);
}).catch(function (reason) {
if (reason instanceof _util.AbortException) {
return;
}
gStateFont = gState.get('Font');
if (gStateFont) {
textState.fontName = null;
textState.fontSize = gStateFont[1];
next(handleSetFont(null, gStateFont[0]));
return {
v: void 0
};
if (self.options.ignoreErrors) {
(0, _util.warn)('getTextContent - ignoring XObject: "' + reason + '".');
return;
}
throw reason;
}));
return;
case _util.OPS.setGState:
flushTextContentItem();
var dictName = args[0];
var extGState = resources.get('ExtGState');
if (!(0, _primitives.isDict)(extGState) || !(0, _primitives.isName)(dictName)) {
break;
}
}();
if ((typeof _ret2 === 'undefined' ? 'undefined' : _typeof(_ret2)) === "object") return _ret2.v;
}
var gState = extGState.get(dictName.name);
if (!(0, _primitives.isDict)(gState)) {
break;
}
var gStateFont = gState.get('Font');
if (gStateFont) {
textState.fontName = null;
textState.fontSize = gStateFont[1];
next(handleSetFont(null, gStateFont[0]));
return;
}
break;
}
if (textContent.items.length >= sink.desiredSize) {
stop = true;
break;
@ -24717,8 +24705,8 @@ exports.PostScriptCompiler = PostScriptCompiler; @@ -24717,8 +24705,8 @@ exports.PostScriptCompiler = PostScriptCompiler;
"use strict";
var pdfjsVersion = '1.9.632';
var pdfjsBuild = 'bbec2ed1';
var pdfjsVersion = '1.9.634';
var pdfjsBuild = '509d3728';
var pdfjsCoreWorker = __w_pdfjs_require__(62);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
@ -24923,7 +24911,7 @@ var WorkerMessageHandler = { @@ -24923,7 +24911,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
var apiVersion = docParams.apiVersion;
var workerVersion = '1.9.632';
var workerVersion = '1.9.634';
if (apiVersion !== null && apiVersion !== 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

392
lib/core/evaluator.js

@ -19,8 +19,6 @@ Object.defineProperty(exports, "__esModule", { @@ -19,8 +19,6 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PartialEvaluator = exports.OperatorList = 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 _util = require('../shared/util');
var _cmap = require('./cmap');
@ -788,17 +786,21 @@ var PartialEvaluator = function PartialEvaluatorClosure() { @@ -788,17 +786,21 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
switch (fn | 0) {
case _util.OPS.paintXObject:
var name = args[0].name;
if (!name) {
(0, _util.warn)('XObject must be referred to by name.');
continue;
}
if (imageCache[name] !== undefined) {
if (name && imageCache[name] !== undefined) {
operatorList.addOp(imageCache[name].fn, imageCache[name].args);
args = null;
continue;
}
var xobj = xobjs.get(name);
if (xobj) {
next(new Promise(function (resolveXObject, rejectXObject) {
if (!name) {
throw new _util.FormatError('XObject must be referred to by name.');
}
var xobj = xobjs.get(name);
if (!xobj) {
operatorList.addOp(fn, args);
resolveXObject();
return;
}
if (!(0, _primitives.isStream)(xobj)) {
throw new _util.FormatError('XObject should be a stream');
}
@ -808,22 +810,28 @@ var PartialEvaluator = function PartialEvaluatorClosure() { @@ -808,22 +810,28 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
if (type.name === 'Form') {
stateManager.save();
next(self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
stateManager.restore();
}));
resolveXObject();
}, rejectXObject);
return;
} else if (type.name === 'Image') {
self.buildPaintImageXObject(resources, xobj, false, operatorList, name, imageCache);
args = null;
continue;
} else if (type.name === 'PS') {
(0, _util.info)('Ignored XObject subtype PS');
continue;
} else {
throw new _util.FormatError('Unhandled XObject subtype ' + type.name);
}
}
break;
resolveXObject();
}).catch(function (reason) {
if (self.options.ignoreErrors) {
self.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.unknown });
(0, _util.warn)('getOperatorList - ignoring XObject: "' + reason + '".');
return;
}
throw reason;
}));
return;
case _util.OPS.setFont:
var fontSize = args[1];
next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
@ -1258,183 +1266,162 @@ var PartialEvaluator = function PartialEvaluatorClosure() { @@ -1258,183 +1266,162 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var fn = operation.fn;
args = operation.args;
var advance, diff;
var fontNameArg, fontSizeArg;
var isSameTextLine;
var items;
var offset;
var j, jj;
var breakTextRun;
var name;
var xobj;
var type;
var currentState;
var xObjStateManager;
var matrix;
var dictName;
var extGState;
var gState;
var gStateFont;
var _ret2 = function () {
switch (fn | 0) {
case _util.OPS.setFont:
fontNameArg = args[0].name;
fontSizeArg = args[1];
if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
break;
}
flushTextContentItem();
textState.fontName = fontNameArg;
textState.fontSize = fontSizeArg;
next(handleSetFont(fontNameArg, null));
return {
v: void 0
};
case _util.OPS.setTextRise:
flushTextContentItem();
textState.textRise = args[0];
break;
case _util.OPS.setHScale:
flushTextContentItem();
textState.textHScale = args[0] / 100;
break;
case _util.OPS.setLeading:
flushTextContentItem();
textState.leading = args[0];
break;
case _util.OPS.moveText:
isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
advance = args[0] - args[1];
if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(args[0], args[1]);
textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
addFakeSpaces(diff, textContentItem.str);
break;
}
flushTextContentItem();
textState.translateTextLineMatrix(args[0], args[1]);
textState.textMatrix = textState.textLineMatrix.slice();
switch (fn | 0) {
case _util.OPS.setFont:
var fontNameArg = args[0].name,
fontSizeArg = args[1];
if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
break;
case _util.OPS.setLeadingMoveText:
flushTextContentItem();
textState.leading = -args[1];
}
flushTextContentItem();
textState.fontName = fontNameArg;
textState.fontSize = fontSizeArg;
next(handleSetFont(fontNameArg, null));
return;
case _util.OPS.setTextRise:
flushTextContentItem();
textState.textRise = args[0];
break;
case _util.OPS.setHScale:
flushTextContentItem();
textState.textHScale = args[0] / 100;
break;
case _util.OPS.setLeading:
flushTextContentItem();
textState.leading = args[0];
break;
case _util.OPS.moveText:
var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
advance = args[0] - args[1];
if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(args[0], args[1]);
textState.textMatrix = textState.textLineMatrix.slice();
break;
case _util.OPS.nextLine:
flushTextContentItem();
textState.carriageReturn();
break;
case _util.OPS.setTextMatrix:
advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(advance.width, advance.height);
textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
addFakeSpaces(diff, textContentItem.str);
break;
}
flushTextContentItem();
textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
addFakeSpaces(diff, textContentItem.str);
break;
case _util.OPS.setCharSpacing:
textState.charSpacing = args[0];
break;
case _util.OPS.setWordSpacing:
textState.wordSpacing = args[0];
break;
case _util.OPS.beginText:
flushTextContentItem();
textState.textMatrix = _util.IDENTITY_MATRIX.slice();
textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
}
flushTextContentItem();
textState.translateTextLineMatrix(args[0], args[1]);
textState.textMatrix = textState.textLineMatrix.slice();
break;
case _util.OPS.setLeadingMoveText:
flushTextContentItem();
textState.leading = -args[1];
textState.translateTextLineMatrix(args[0], args[1]);
textState.textMatrix = textState.textLineMatrix.slice();
break;
case _util.OPS.nextLine:
flushTextContentItem();
textState.carriageReturn();
break;
case _util.OPS.setTextMatrix:
advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(advance.width, advance.height);
textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
addFakeSpaces(diff, textContentItem.str);
break;
case _util.OPS.showSpacedText:
items = args[0];
for (j = 0, jj = items.length; j < jj; j++) {
if (typeof items[j] === 'string') {
buildTextContentItem(items[j]);
} else if ((0, _util.isNum)(items[j])) {
ensureTextContentItem();
advance = items[j] * textState.fontSize / 1000;
breakTextRun = false;
if (textState.font.vertical) {
offset = advance;
textState.translateTextMatrix(0, offset);
breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
if (!breakTextRun) {
textContentItem.height += offset;
}
} else {
advance = -advance;
offset = advance * textState.textHScale;
textState.translateTextMatrix(offset, 0);
breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
if (!breakTextRun) {
textContentItem.width += offset;
}
}
flushTextContentItem();
textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.setCharSpacing:
textState.charSpacing = args[0];
break;
case _util.OPS.setWordSpacing:
textState.wordSpacing = args[0];
break;
case _util.OPS.beginText:
flushTextContentItem();
textState.textMatrix = _util.IDENTITY_MATRIX.slice();
textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
break;
case _util.OPS.showSpacedText:
var items = args[0];
var offset;
for (var j = 0, jj = items.length; j < jj; j++) {
if (typeof items[j] === 'string') {
buildTextContentItem(items[j]);
} else if ((0, _util.isNum)(items[j])) {
ensureTextContentItem();
advance = items[j] * textState.fontSize / 1000;
var breakTextRun = false;
if (textState.font.vertical) {
offset = advance;
textState.translateTextMatrix(0, offset);
breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
if (!breakTextRun) {
textContentItem.height += offset;
}
if (breakTextRun) {
flushTextContentItem();
} else if (advance > 0) {
addFakeSpaces(advance, textContentItem.str);
} else {
advance = -advance;
offset = advance * textState.textHScale;
textState.translateTextMatrix(offset, 0);
breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
if (!breakTextRun) {
textContentItem.width += offset;
}
}
if (breakTextRun) {
flushTextContentItem();
} else if (advance > 0) {
addFakeSpaces(advance, textContentItem.str);
}
}
}
break;
case _util.OPS.showText:
buildTextContentItem(args[0]);
break;
case _util.OPS.nextLineShowText:
flushTextContentItem();
textState.carriageReturn();
buildTextContentItem(args[0]);
break;
case _util.OPS.nextLineSetSpacingShowText:
flushTextContentItem();
textState.wordSpacing = args[0];
textState.charSpacing = args[1];
textState.carriageReturn();
buildTextContentItem(args[2]);
break;
case _util.OPS.paintXObject:
flushTextContentItem();
if (!xobjs) {
xobjs = resources.get('XObject') || _primitives.Dict.empty;
}
var name = args[0].name;
if (name && skipEmptyXObjs[name] !== undefined) {
break;
case _util.OPS.showText:
buildTextContentItem(args[0]);
break;
case _util.OPS.nextLineShowText:
flushTextContentItem();
textState.carriageReturn();
buildTextContentItem(args[0]);
break;
case _util.OPS.nextLineSetSpacingShowText:
flushTextContentItem();
textState.wordSpacing = args[0];
textState.charSpacing = args[1];
textState.carriageReturn();
buildTextContentItem(args[2]);
break;
case _util.OPS.paintXObject:
flushTextContentItem();
if (!xobjs) {
xobjs = resources.get('XObject') || _primitives.Dict.empty;
}
name = args[0].name;
if (name in skipEmptyXObjs) {
break;
}
next(new Promise(function (resolveXObject, rejectXObject) {
if (!name) {
throw new _util.FormatError('XObject must be referred to by name.');
}
xobj = xobjs.get(name);
var xobj = xobjs.get(name);
if (!xobj) {
break;
resolveXObject();
return;
}
if (!(0, _primitives.isStream)(xobj)) {
throw new _util.FormatError('XObject should be a stream');
}
type = xobj.dict.get('Subtype');
var type = xobj.dict.get('Subtype');
if (!(0, _primitives.isName)(type)) {
throw new _util.FormatError('XObject should have a Name subtype');
}
if (type.name !== 'Form') {
skipEmptyXObjs[name] = true;
break;
resolveXObject();
return;
}
currentState = stateManager.state.clone();
xObjStateManager = new StateManager(currentState);
matrix = xobj.dict.getArray('Matrix');
var currentState = stateManager.state.clone();
var xObjStateManager = new StateManager(currentState);
var matrix = xobj.dict.getArray('Matrix');
if (Array.isArray(matrix) && matrix.length === 6) {
xObjStateManager.transform(matrix);
}
@ -1453,7 +1440,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() { @@ -1453,7 +1440,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return sink.ready;
}
};
next(self.getTextContent({
self.getTextContent({
stream: xobj,
task: task,
resources: xobj.dict.get('Resources') || resources,
@ -1466,38 +1453,39 @@ var PartialEvaluator = function PartialEvaluatorClosure() { @@ -1466,38 +1453,39 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
if (!sinkWrapper.enqueueInvoked) {
skipEmptyXObjs[name] = true;
}
}));
return {
v: void 0
};
case _util.OPS.setGState:
flushTextContentItem();
dictName = args[0];
extGState = resources.get('ExtGState');
if (!(0, _primitives.isDict)(extGState) || !(0, _primitives.isName)(dictName)) {
break;
}
gState = extGState.get(dictName.name);
if (!(0, _primitives.isDict)(gState)) {
break;
resolveXObject();
}, rejectXObject);
}).catch(function (reason) {
if (reason instanceof _util.AbortException) {
return;
}
gStateFont = gState.get('Font');
if (gStateFont) {
textState.fontName = null;
textState.fontSize = gStateFont[1];
next(handleSetFont(null, gStateFont[0]));
return {
v: void 0
};
if (self.options.ignoreErrors) {
(0, _util.warn)('getTextContent - ignoring XObject: "' + reason + '".');
return;
}
throw reason;
}));
return;
case _util.OPS.setGState:
flushTextContentItem();
var dictName = args[0];
var extGState = resources.get('ExtGState');
if (!(0, _primitives.isDict)(extGState) || !(0, _primitives.isName)(dictName)) {
break;
}
}();
if ((typeof _ret2 === 'undefined' ? 'undefined' : _typeof(_ret2)) === "object") return _ret2.v;
}
var gState = extGState.get(dictName.name);
if (!(0, _primitives.isDict)(gState)) {
break;
}
var gStateFont = gState.get('Font');
if (gStateFont) {
textState.fontName = null;
textState.fontSize = gStateFont[1];
next(handleSetFont(null, gStateFont[0]));
return;
}
break;
}
if (textContent.items.length >= sink.desiredSize) {
stop = true;
break;

2
lib/core/worker.js

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

6
lib/display/api.js

@ -193,7 +193,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { @@ -193,7 +193,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
if (worker.destroyed) {
return Promise.reject(new Error('Worker was destroyed'));
}
var apiVersion = '1.9.632';
var apiVersion = '1.9.634';
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
source.chunkedViewerLoading = !!pdfDataRangeTransport;
@ -1584,8 +1584,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -1584,8 +1584,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.9.632';
exports.build = build = 'bbec2ed1';
exports.version = version = '1.9.634';
exports.build = build = '509d3728';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;

4
lib/display/global.js

@ -44,8 +44,8 @@ if (!_global_scope2.default.PDFJS) { @@ -44,8 +44,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '1.9.632';
PDFJS.build = 'bbec2ed1';
PDFJS.version = '1.9.634';
PDFJS.build = '509d3728';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {

4
lib/pdf.js

@ -14,8 +14,8 @@ @@ -14,8 +14,8 @@
*/
'use strict';
var pdfjsVersion = '1.9.632';
var pdfjsBuild = 'bbec2ed1';
var pdfjsVersion = '1.9.634';
var pdfjsBuild = '509d3728';
var pdfjsSharedUtil = require('./shared/util.js');
var pdfjsDisplayGlobal = require('./display/global.js');
var pdfjsDisplayAPI = require('./display/api.js');

4
lib/pdf.worker.js vendored

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
*/
'use strict';
var pdfjsVersion = '1.9.632';
var pdfjsBuild = 'bbec2ed1';
var pdfjsVersion = '1.9.634';
var pdfjsBuild = '509d3728';
var pdfjsCoreWorker = require('./core/worker.js');
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

10
lib/test/unit/evaluator_spec.js

@ -16,12 +16,12 @@ @@ -16,12 +16,12 @@
var _primitives = require('../../core/primitives');
var _util = require('../../shared/util');
var _evaluator = require('../../core/evaluator');
var _stream = require('../../core/stream');
var _util = require('../../shared/util');
var _worker = require('../../core/worker');
var _test_utils = require('./test_utils');
@ -55,6 +55,8 @@ describe('evaluator', function () { @@ -55,6 +55,8 @@ describe('evaluator', function () {
operatorList: result
}).then(function () {
callback(result);
}, function (reason) {
callback(reason);
});
}
var partialEvaluator;
@ -213,8 +215,8 @@ describe('evaluator', function () { @@ -213,8 +215,8 @@ describe('evaluator', function () {
it('should skip paintXObject if name is missing', function (done) {
var stream = new _stream.StringStream('/ Do');
runOperatorListCheck(partialEvaluator, stream, new ResourcesMock(), function (result) {
expect(result.argsArray).toEqual([]);
expect(result.fnArray).toEqual([]);
expect(result instanceof _util.FormatError).toEqual(true);
expect(result.message).toEqual('XObject must be referred to by name.');
done();
});
});

2
package.json

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

Loading…
Cancel
Save