Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/core/bounding_boxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class BoundingBoxesCalculator {
this.boundingBoxes = {};
this.refBoundingBoxes = {};
this.ignoreCalculations = ignoreCalculations;
this.operandNameArray = [];
this.operationArray = [];
this.mcidArray = [];
this.sameMcidDepth = 0;
Expand Down Expand Up @@ -652,7 +653,8 @@ class BoundingBoxesCalculator {
}
break;
case OPS.paintXObject:
const [type, bboxes] = args;
const [name, type, bboxes] = args;
this.operandNameArray[this.operationIndex] = name;
if (type === "Image") {
this.getImageBoundingBox();
this.saveGraphicsBoundingBox();
Expand Down
7 changes: 6 additions & 1 deletion src/core/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,8 @@ class Page {
let MCIDBoundingBoxes,
positionByOperationIndex,
noMCIDBoundingBoxes,
refMCIDBoundingBoxes;
refMCIDBoundingBoxes,
operandNameByIndex;
const pageListPromise = Promise.all([
contentStreamPromise,
resourcesPromise,
Expand Down Expand Up @@ -555,11 +556,13 @@ class Page {
operationArray,
boundingBoxesWithoutMCID,
refBoundingBoxesByMCID,
operandNameArray,
]) {
MCIDBoundingBoxes = boundingBoxesByMCID;
positionByOperationIndex = operationArray;
noMCIDBoundingBoxes = boundingBoxesWithoutMCID;
refMCIDBoundingBoxes = refBoundingBoxesByMCID;
operandNameByIndex = operandNameArray;
});

return opList;
Expand Down Expand Up @@ -600,6 +603,7 @@ class Page {
intent & RenderingIntentFlag.ANNOTATIONS_DISABLE
) {
if (intent & RenderingIntentFlag.OPLIST) {
pageOpList.addOp(OPS.operandName, operandNameByIndex);
pageOpList.addOp(OPS.annotBBoxesAndOpPos, []);
pageOpList.addOp(OPS.operationPosition, positionByOperationIndex);
pageOpList.addOp(OPS.boundingBoxes, [
Expand Down Expand Up @@ -668,6 +672,7 @@ class Page {
);
}
if (intent & RenderingIntentFlag.OPLIST) {
pageOpList.addOp(OPS.operandName, operandNameByIndex);
pageOpList.addOp(
OPS.annotBBoxesAndOpPos,
annotationsBBoxesAndOperationPosition
Expand Down
5 changes: 5 additions & 0 deletions src/core/evaluator.js
Original file line number Diff line number Diff line change
Expand Up @@ -1814,6 +1814,7 @@ class PartialEvaluator {
const localImage = localImageCache.getByName(name);
if (localImage) {
boundingBoxCalculator.parseOperator(OPS.paintXObject, [
name,
"Image",
]);
addCachedImageOps(operatorList, localImage);
Expand All @@ -1837,6 +1838,7 @@ class PartialEvaluator {

if (cachedImage) {
boundingBoxCalculator.parseOperator(OPS.paintXObject, [
name,
"Image",
]);
addCachedImageOps(operatorList, cachedImage);
Expand Down Expand Up @@ -1879,6 +1881,7 @@ class PartialEvaluator {
boundingBoxesByMCID
);
boundingBoxCalculator.parseOperator(OPS.paintXObject, [
name,
type.name,
boundingBoxesWithoutMCID,
]);
Expand All @@ -1889,6 +1892,7 @@ class PartialEvaluator {
return;
} else if (type.name === "Image") {
boundingBoxCalculator.parseOperator(OPS.paintXObject, [
name,
type.name,
]);
self
Expand Down Expand Up @@ -2439,6 +2443,7 @@ class PartialEvaluator {
boundingBoxCalculator.operationArray,
boundingBoxCalculator.getNoMCIDBoundingBoxes(),
boundingBoxCalculator.refBoundingBoxes,
boundingBoxCalculator.operandNameArray,
]);
}).catch(reason => {
if (reason instanceof AbortException) {
Expand Down
1 change: 1 addition & 0 deletions src/shared/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ const OPS = {
boundingBoxes: 100,
operationPosition: 101,
annotBBoxesAndOpPos: 102,
operandName: 103,
};

// In order to have a switch statement that is fast (i.e. which use a jump
Expand Down
Loading