@chialab/pdfjs-lib 1.0.0-alpha.15 → 1.0.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/{chunk-TKDBOXH4.js → chunk-O4CM6PII.js} +89 -1
- package/dist/browser/index.js +416 -195
- package/dist/browser/worker.js +283 -12
- package/dist/lib/AnnotationData.d.ts +1 -1
- package/dist/lib/StandardFontDataFactory.d.ts +2 -2
- package/dist/lib/SvgCanvasContext.d.ts +20 -5
- package/dist/lib/WasmFactory.d.ts +2 -2
- package/dist/lib/utils.d.ts +1 -1
- package/dist/node/{chunk-MAMMG4XK.js → chunk-4FQTXXTH.js} +89 -1
- package/dist/node/index.js +416 -195
- package/dist/node/worker.js +283 -12
- package/dist/pdf.js/src/display/annotation_layer.d.ts +1 -2
- package/dist/pdf.js/src/display/editor/editor.d.ts +11 -1
- package/dist/pdf.js/src/display/editor/highlight.d.ts +2 -0
- package/dist/pdf.js/src/display/editor/signature.d.ts +2 -0
- package/dist/pdf.js/src/display/editor/stamp.d.ts +2 -0
- package/dist/pdf.js/src/display/editor/toolbar.d.ts +2 -0
- package/dist/pdf.js/src/display/editor/tools.d.ts +5 -2
- package/dist/pdf.js/src/shared/scripting_utils.d.ts +2 -0
- package/package.json +1 -1
package/dist/node/worker.js
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
AnnotationType,
|
|
12
12
|
BASELINE_FACTOR,
|
|
13
13
|
BaseException,
|
|
14
|
+
DateFormats,
|
|
14
15
|
DocumentActionEventType,
|
|
15
16
|
DrawOPS,
|
|
16
17
|
FONT_IDENTITY_MATRIX,
|
|
@@ -30,6 +31,7 @@ import {
|
|
|
30
31
|
PermissionFlag,
|
|
31
32
|
RenderingIntentFlag,
|
|
32
33
|
TextRenderingMode,
|
|
34
|
+
TimeFormats,
|
|
33
35
|
Util,
|
|
34
36
|
VerbosityLevel,
|
|
35
37
|
_isValidExplicitDest,
|
|
@@ -59,7 +61,7 @@ import {
|
|
|
59
61
|
utf8StringToString,
|
|
60
62
|
warn,
|
|
61
63
|
wrapReason
|
|
62
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-4FQTXXTH.js";
|
|
63
65
|
import {
|
|
64
66
|
__privateAdd,
|
|
65
67
|
__privateGet,
|
|
@@ -22572,7 +22574,7 @@ var CFFCompiler = class _CFFCompiler {
|
|
|
22572
22574
|
// format
|
|
22573
22575
|
0,
|
|
22574
22576
|
// first CID upper byte
|
|
22575
|
-
|
|
22577
|
+
1,
|
|
22576
22578
|
// first CID lower byte
|
|
22577
22579
|
nLeft >> 8 & 255,
|
|
22578
22580
|
nLeft & 255
|
|
@@ -55983,7 +55985,8 @@ var PartialEvaluator = class _PartialEvaluator {
|
|
|
55983
55985
|
markedContentData = null,
|
|
55984
55986
|
disableNormalization = false,
|
|
55985
55987
|
keepWhiteSpace = false,
|
|
55986
|
-
prevRefs = null
|
|
55988
|
+
prevRefs = null,
|
|
55989
|
+
intersector = null
|
|
55987
55990
|
}) {
|
|
55988
55991
|
const objId = stream.dict?.objId;
|
|
55989
55992
|
const seenRefs = new RefSet(prevRefs);
|
|
@@ -56060,6 +56063,7 @@ var PartialEvaluator = class _PartialEvaluator {
|
|
|
56060
56063
|
transform = textContentItem.prevTransform,
|
|
56061
56064
|
fontName = textContentItem.fontName
|
|
56062
56065
|
}) {
|
|
56066
|
+
intersector?.addExtraChar(" ");
|
|
56063
56067
|
textContent.items.push({
|
|
56064
56068
|
str: " ",
|
|
56065
56069
|
dir: "ltr",
|
|
@@ -56397,9 +56401,21 @@ var PartialEvaluator = class _PartialEvaluator {
|
|
|
56397
56401
|
}
|
|
56398
56402
|
if (!font.vertical) {
|
|
56399
56403
|
scaledDim *= textState.textHScale;
|
|
56404
|
+
intersector?.addGlyph(
|
|
56405
|
+
getCurrentTextTransform(),
|
|
56406
|
+
scaledDim,
|
|
56407
|
+
0,
|
|
56408
|
+
glyph.unicode
|
|
56409
|
+
);
|
|
56400
56410
|
textState.translateTextMatrix(scaledDim, 0);
|
|
56401
56411
|
textChunk.width += scaledDim;
|
|
56402
56412
|
} else {
|
|
56413
|
+
intersector?.addGlyph(
|
|
56414
|
+
getCurrentTextTransform(),
|
|
56415
|
+
0,
|
|
56416
|
+
scaledDim,
|
|
56417
|
+
glyph.unicode
|
|
56418
|
+
);
|
|
56403
56419
|
textState.translateTextMatrix(0, scaledDim);
|
|
56404
56420
|
scaledDim = Math.abs(scaledDim);
|
|
56405
56421
|
textChunk.height += scaledDim;
|
|
@@ -56410,8 +56426,11 @@ var PartialEvaluator = class _PartialEvaluator {
|
|
|
56410
56426
|
const glyphUnicode = glyph.unicode;
|
|
56411
56427
|
if (saveLastChar(glyphUnicode)) {
|
|
56412
56428
|
textChunk.str.push(" ");
|
|
56429
|
+
intersector?.addExtraChar(" ");
|
|
56430
|
+
}
|
|
56431
|
+
if (!intersector) {
|
|
56432
|
+
textChunk.str.push(glyphUnicode);
|
|
56413
56433
|
}
|
|
56414
|
-
textChunk.str.push(glyphUnicode);
|
|
56415
56434
|
if (charSpacing) {
|
|
56416
56435
|
if (!font.vertical) {
|
|
56417
56436
|
textState.translateTextMatrix(
|
|
@@ -56425,6 +56444,7 @@ var PartialEvaluator = class _PartialEvaluator {
|
|
|
56425
56444
|
}
|
|
56426
56445
|
}
|
|
56427
56446
|
function appendEOL() {
|
|
56447
|
+
intersector?.addExtraChar("\n");
|
|
56428
56448
|
resetLastChars();
|
|
56429
56449
|
if (textContentItem.initialized) {
|
|
56430
56450
|
textContentItem.hasEOL = true;
|
|
@@ -56446,6 +56466,7 @@ var PartialEvaluator = class _PartialEvaluator {
|
|
|
56446
56466
|
if (textContentItem.initialized) {
|
|
56447
56467
|
resetLastChars();
|
|
56448
56468
|
textContentItem.str.push(" ");
|
|
56469
|
+
intersector?.addExtraChar(" ");
|
|
56449
56470
|
}
|
|
56450
56471
|
return false;
|
|
56451
56472
|
}
|
|
@@ -56486,7 +56507,7 @@ var PartialEvaluator = class _PartialEvaluator {
|
|
|
56486
56507
|
if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
|
|
56487
56508
|
return;
|
|
56488
56509
|
}
|
|
56489
|
-
sink
|
|
56510
|
+
sink?.enqueue(textContent, length);
|
|
56490
56511
|
textContent.items = [];
|
|
56491
56512
|
textContent.styles = /* @__PURE__ */ Object.create(null);
|
|
56492
56513
|
}
|
|
@@ -56497,7 +56518,7 @@ var PartialEvaluator = class _PartialEvaluator {
|
|
|
56497
56518
|
/* batch = */
|
|
56498
56519
|
true
|
|
56499
56520
|
);
|
|
56500
|
-
Promise.all([promise, sink
|
|
56521
|
+
Promise.all([promise, sink?.ready]).then(function() {
|
|
56501
56522
|
try {
|
|
56502
56523
|
promiseBody(resolve, reject);
|
|
56503
56524
|
} catch (ex) {
|
|
@@ -56700,7 +56721,7 @@ var PartialEvaluator = class _PartialEvaluator {
|
|
|
56700
56721
|
sink.enqueue(chunk, size);
|
|
56701
56722
|
},
|
|
56702
56723
|
get desiredSize() {
|
|
56703
|
-
return sink.desiredSize;
|
|
56724
|
+
return sink.desiredSize ?? 0;
|
|
56704
56725
|
},
|
|
56705
56726
|
get ready() {
|
|
56706
56727
|
return sink.ready;
|
|
@@ -56712,7 +56733,7 @@ var PartialEvaluator = class _PartialEvaluator {
|
|
|
56712
56733
|
resources: localResources instanceof Dict ? localResources : resources,
|
|
56713
56734
|
stateManager: xObjStateManager,
|
|
56714
56735
|
includeMarkedContent,
|
|
56715
|
-
sink: sinkWrapper,
|
|
56736
|
+
sink: sink && sinkWrapper,
|
|
56716
56737
|
seenStyles,
|
|
56717
56738
|
viewBox,
|
|
56718
56739
|
lang,
|
|
@@ -56825,7 +56846,7 @@ var PartialEvaluator = class _PartialEvaluator {
|
|
|
56825
56846
|
}
|
|
56826
56847
|
break;
|
|
56827
56848
|
}
|
|
56828
|
-
if (textContent.items.length >= sink
|
|
56849
|
+
if (textContent.items.length >= (sink?.desiredSize ?? 1)) {
|
|
56829
56850
|
stop = true;
|
|
56830
56851
|
break;
|
|
56831
56852
|
}
|
|
@@ -74944,6 +74965,9 @@ var Annotation = class {
|
|
|
74944
74965
|
async save(evaluator, task, annotationStorage, changes) {
|
|
74945
74966
|
return null;
|
|
74946
74967
|
}
|
|
74968
|
+
get overlaysTextContent() {
|
|
74969
|
+
return false;
|
|
74970
|
+
}
|
|
74947
74971
|
get hasTextContent() {
|
|
74948
74972
|
return false;
|
|
74949
74973
|
}
|
|
@@ -76085,6 +76109,21 @@ var TextWidgetAnnotation = class extends WidgetAnnotation {
|
|
|
76085
76109
|
this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
|
|
76086
76110
|
this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.data.multiLine && !this.data.password && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== 0;
|
|
76087
76111
|
this.data.doNotScroll = this.hasFieldFlag(AnnotationFieldFlag.DONOTSCROLL);
|
|
76112
|
+
const {
|
|
76113
|
+
data: { actions }
|
|
76114
|
+
} = this;
|
|
76115
|
+
for (const keystrokeAction of actions?.Keystroke || []) {
|
|
76116
|
+
const m = keystrokeAction.trim().match(/^AF(Date|Time)_Keystroke(?:Ex)?\(['"]?([^'"]+)['"]?\);$/);
|
|
76117
|
+
if (m) {
|
|
76118
|
+
let format = m[2];
|
|
76119
|
+
const num = parseInt(format, 10);
|
|
76120
|
+
if (!isNaN(num) && Math.floor(Math.log10(num)) + 1 === m[2].length) {
|
|
76121
|
+
format = (m[1] === "Date" ? DateFormats : TimeFormats)[num] ?? format;
|
|
76122
|
+
}
|
|
76123
|
+
this.data[m[1] === "Date" ? "dateFormat" : "timeFormat"] = format;
|
|
76124
|
+
break;
|
|
76125
|
+
}
|
|
76126
|
+
}
|
|
76088
76127
|
}
|
|
76089
76128
|
get hasTextContent() {
|
|
76090
76129
|
return !!this.appearance && !this._needAppearances;
|
|
@@ -77575,6 +77614,9 @@ var HighlightAnnotation = class extends MarkupAnnotation {
|
|
|
77575
77614
|
this.data.popupRef = null;
|
|
77576
77615
|
}
|
|
77577
77616
|
}
|
|
77617
|
+
get overlaysTextContent() {
|
|
77618
|
+
return true;
|
|
77619
|
+
}
|
|
77578
77620
|
static createNewDict(annotation, xref, { apRef, ap }) {
|
|
77579
77621
|
const { color, oldAnnotation, opacity, rect, rotation, user, quadPoints } = annotation;
|
|
77580
77622
|
const highlight = oldAnnotation || new Dict(xref);
|
|
@@ -77679,6 +77721,9 @@ var UnderlineAnnotation = class extends MarkupAnnotation {
|
|
|
77679
77721
|
this.data.popupRef = null;
|
|
77680
77722
|
}
|
|
77681
77723
|
}
|
|
77724
|
+
get overlaysTextContent() {
|
|
77725
|
+
return true;
|
|
77726
|
+
}
|
|
77682
77727
|
};
|
|
77683
77728
|
var SquigglyAnnotation = class extends MarkupAnnotation {
|
|
77684
77729
|
constructor(params) {
|
|
@@ -77716,6 +77761,9 @@ var SquigglyAnnotation = class extends MarkupAnnotation {
|
|
|
77716
77761
|
this.data.popupRef = null;
|
|
77717
77762
|
}
|
|
77718
77763
|
}
|
|
77764
|
+
get overlaysTextContent() {
|
|
77765
|
+
return true;
|
|
77766
|
+
}
|
|
77719
77767
|
};
|
|
77720
77768
|
var StrikeOutAnnotation = class extends MarkupAnnotation {
|
|
77721
77769
|
constructor(params) {
|
|
@@ -77746,6 +77794,9 @@ var StrikeOutAnnotation = class extends MarkupAnnotation {
|
|
|
77746
77794
|
this.data.popupRef = null;
|
|
77747
77795
|
}
|
|
77748
77796
|
}
|
|
77797
|
+
get overlaysTextContent() {
|
|
77798
|
+
return true;
|
|
77799
|
+
}
|
|
77749
77800
|
};
|
|
77750
77801
|
var _savedHasOwnCanvas, _StampAnnotation_static, createNewAppearanceStreamForDrawing_fn;
|
|
77751
77802
|
var StampAnnotation = class extends MarkupAnnotation {
|
|
@@ -78786,6 +78837,156 @@ var DatasetReader = class {
|
|
|
78786
78837
|
}
|
|
78787
78838
|
};
|
|
78788
78839
|
|
|
78840
|
+
// src/pdf.js/src/core/intersector.js
|
|
78841
|
+
var _annotation, _minX, _minY, _maxX, _maxY, _quadPoints, _text, _extraChars, _lastIntersectingQuadIndex, _canTakeExtraChars, _SingleIntersector_instances, intersects_fn;
|
|
78842
|
+
var SingleIntersector = class {
|
|
78843
|
+
constructor(annotation) {
|
|
78844
|
+
__privateAdd(this, _SingleIntersector_instances);
|
|
78845
|
+
__privateAdd(this, _annotation);
|
|
78846
|
+
__privateAdd(this, _minX, Infinity);
|
|
78847
|
+
__privateAdd(this, _minY, Infinity);
|
|
78848
|
+
__privateAdd(this, _maxX, -Infinity);
|
|
78849
|
+
__privateAdd(this, _maxY, -Infinity);
|
|
78850
|
+
__privateAdd(this, _quadPoints);
|
|
78851
|
+
__privateAdd(this, _text, []);
|
|
78852
|
+
__privateAdd(this, _extraChars, []);
|
|
78853
|
+
__privateAdd(this, _lastIntersectingQuadIndex, -1);
|
|
78854
|
+
__privateAdd(this, _canTakeExtraChars, false);
|
|
78855
|
+
__privateSet(this, _annotation, annotation);
|
|
78856
|
+
const quadPoints = __privateSet(this, _quadPoints, annotation.data.quadPoints);
|
|
78857
|
+
for (let i = 0, ii = quadPoints.length; i < ii; i += 8) {
|
|
78858
|
+
__privateSet(this, _minX, Math.min(__privateGet(this, _minX), quadPoints[i]));
|
|
78859
|
+
__privateSet(this, _maxX, Math.max(__privateGet(this, _maxX), quadPoints[i + 2]));
|
|
78860
|
+
__privateSet(this, _minY, Math.min(__privateGet(this, _minY), quadPoints[i + 5]));
|
|
78861
|
+
__privateSet(this, _maxY, Math.max(__privateGet(this, _maxY), quadPoints[i + 1]));
|
|
78862
|
+
}
|
|
78863
|
+
}
|
|
78864
|
+
overlaps(other) {
|
|
78865
|
+
return !(__privateGet(this, _minX) >= __privateGet(other, _maxX) || __privateGet(this, _maxX) <= __privateGet(other, _minX) || __privateGet(this, _minY) >= __privateGet(other, _maxY) || __privateGet(this, _maxY) <= __privateGet(other, _minY));
|
|
78866
|
+
}
|
|
78867
|
+
addGlyph(x, y, glyph) {
|
|
78868
|
+
if (!__privateMethod(this, _SingleIntersector_instances, intersects_fn).call(this, x, y)) {
|
|
78869
|
+
this.disableExtraChars();
|
|
78870
|
+
return false;
|
|
78871
|
+
}
|
|
78872
|
+
if (__privateGet(this, _extraChars).length > 0) {
|
|
78873
|
+
__privateGet(this, _text).push(__privateGet(this, _extraChars).join(""));
|
|
78874
|
+
__privateGet(this, _extraChars).length = 0;
|
|
78875
|
+
}
|
|
78876
|
+
__privateGet(this, _text).push(glyph);
|
|
78877
|
+
__privateSet(this, _canTakeExtraChars, true);
|
|
78878
|
+
return true;
|
|
78879
|
+
}
|
|
78880
|
+
addExtraChar(char) {
|
|
78881
|
+
if (__privateGet(this, _canTakeExtraChars)) {
|
|
78882
|
+
__privateGet(this, _extraChars).push(char);
|
|
78883
|
+
}
|
|
78884
|
+
}
|
|
78885
|
+
disableExtraChars() {
|
|
78886
|
+
if (!__privateGet(this, _canTakeExtraChars)) {
|
|
78887
|
+
return;
|
|
78888
|
+
}
|
|
78889
|
+
__privateSet(this, _canTakeExtraChars, false);
|
|
78890
|
+
__privateGet(this, _extraChars).length = 0;
|
|
78891
|
+
}
|
|
78892
|
+
setText() {
|
|
78893
|
+
__privateGet(this, _annotation).data.overlaidText = __privateGet(this, _text).join("");
|
|
78894
|
+
}
|
|
78895
|
+
};
|
|
78896
|
+
_annotation = new WeakMap();
|
|
78897
|
+
_minX = new WeakMap();
|
|
78898
|
+
_minY = new WeakMap();
|
|
78899
|
+
_maxX = new WeakMap();
|
|
78900
|
+
_maxY = new WeakMap();
|
|
78901
|
+
_quadPoints = new WeakMap();
|
|
78902
|
+
_text = new WeakMap();
|
|
78903
|
+
_extraChars = new WeakMap();
|
|
78904
|
+
_lastIntersectingQuadIndex = new WeakMap();
|
|
78905
|
+
_canTakeExtraChars = new WeakMap();
|
|
78906
|
+
_SingleIntersector_instances = new WeakSet();
|
|
78907
|
+
/**
|
|
78908
|
+
* Check if the given point intersects with the annotation's quad points.
|
|
78909
|
+
* The point (x, y) is supposed to be the center of the glyph.
|
|
78910
|
+
* @param {number} x
|
|
78911
|
+
* @param {number} y
|
|
78912
|
+
* @returns {boolean}
|
|
78913
|
+
*/
|
|
78914
|
+
intersects_fn = function(x, y) {
|
|
78915
|
+
if (__privateGet(this, _minX) >= x || __privateGet(this, _maxX) <= x || __privateGet(this, _minY) >= y || __privateGet(this, _maxY) <= y) {
|
|
78916
|
+
return false;
|
|
78917
|
+
}
|
|
78918
|
+
const quadPoints = __privateGet(this, _quadPoints);
|
|
78919
|
+
if (quadPoints.length === 8) {
|
|
78920
|
+
return true;
|
|
78921
|
+
}
|
|
78922
|
+
if (__privateGet(this, _lastIntersectingQuadIndex) >= 0) {
|
|
78923
|
+
const i = __privateGet(this, _lastIntersectingQuadIndex);
|
|
78924
|
+
if (!(quadPoints[i] >= x || quadPoints[i + 2] <= x || quadPoints[i + 5] >= y || quadPoints[i + 1] <= y)) {
|
|
78925
|
+
return true;
|
|
78926
|
+
}
|
|
78927
|
+
__privateSet(this, _lastIntersectingQuadIndex, -1);
|
|
78928
|
+
}
|
|
78929
|
+
for (let i = 0, ii = quadPoints.length; i < ii; i += 8) {
|
|
78930
|
+
if (!(quadPoints[i] >= x || quadPoints[i + 2] <= x || quadPoints[i + 5] >= y || quadPoints[i + 1] <= y)) {
|
|
78931
|
+
__privateSet(this, _lastIntersectingQuadIndex, i);
|
|
78932
|
+
return true;
|
|
78933
|
+
}
|
|
78934
|
+
}
|
|
78935
|
+
return false;
|
|
78936
|
+
};
|
|
78937
|
+
var _intersectors;
|
|
78938
|
+
var Intersector = class {
|
|
78939
|
+
constructor(annotations) {
|
|
78940
|
+
__privateAdd(this, _intersectors, /* @__PURE__ */ new Map());
|
|
78941
|
+
for (const annotation of annotations) {
|
|
78942
|
+
if (!annotation.data.quadPoints) {
|
|
78943
|
+
continue;
|
|
78944
|
+
}
|
|
78945
|
+
const intersector = new SingleIntersector(annotation);
|
|
78946
|
+
for (const [otherIntersector, overlapping] of __privateGet(this, _intersectors)) {
|
|
78947
|
+
if (otherIntersector.overlaps(intersector)) {
|
|
78948
|
+
if (!overlapping) {
|
|
78949
|
+
__privateGet(this, _intersectors).set(otherIntersector, /* @__PURE__ */ new Set([intersector]));
|
|
78950
|
+
} else {
|
|
78951
|
+
overlapping.add(intersector);
|
|
78952
|
+
}
|
|
78953
|
+
}
|
|
78954
|
+
}
|
|
78955
|
+
__privateGet(this, _intersectors).set(intersector, null);
|
|
78956
|
+
}
|
|
78957
|
+
}
|
|
78958
|
+
addGlyph(transform, width, height, glyph) {
|
|
78959
|
+
const x = transform[4] + width / 2;
|
|
78960
|
+
const y = transform[5] + height / 2;
|
|
78961
|
+
let overlappingIntersectors;
|
|
78962
|
+
for (const [intersector, overlapping] of __privateGet(this, _intersectors)) {
|
|
78963
|
+
if (overlappingIntersectors) {
|
|
78964
|
+
if (overlappingIntersectors.has(intersector)) {
|
|
78965
|
+
intersector.addGlyph(x, y, glyph);
|
|
78966
|
+
} else {
|
|
78967
|
+
intersector.disableExtraChars();
|
|
78968
|
+
}
|
|
78969
|
+
continue;
|
|
78970
|
+
}
|
|
78971
|
+
if (!intersector.addGlyph(x, y, glyph)) {
|
|
78972
|
+
continue;
|
|
78973
|
+
}
|
|
78974
|
+
overlappingIntersectors = overlapping;
|
|
78975
|
+
}
|
|
78976
|
+
}
|
|
78977
|
+
addExtraChar(char) {
|
|
78978
|
+
for (const intersector of __privateGet(this, _intersectors).keys()) {
|
|
78979
|
+
intersector.addExtraChar(char);
|
|
78980
|
+
}
|
|
78981
|
+
}
|
|
78982
|
+
setText() {
|
|
78983
|
+
for (const intersector of __privateGet(this, _intersectors).keys()) {
|
|
78984
|
+
intersector.setText();
|
|
78985
|
+
}
|
|
78986
|
+
}
|
|
78987
|
+
};
|
|
78988
|
+
_intersectors = new WeakMap();
|
|
78989
|
+
|
|
78789
78990
|
// src/pdf.js/src/core/calculate_sha_other.js
|
|
78790
78991
|
var Word64 = class {
|
|
78791
78992
|
constructor(highInteger, lowInteger) {
|
|
@@ -82364,7 +82565,8 @@ var Page = class {
|
|
|
82364
82565
|
task,
|
|
82365
82566
|
includeMarkedContent,
|
|
82366
82567
|
disableNormalization,
|
|
82367
|
-
sink
|
|
82568
|
+
sink,
|
|
82569
|
+
intersector = null
|
|
82368
82570
|
}) {
|
|
82369
82571
|
const contentStreamPromise = this.getContentStream();
|
|
82370
82572
|
const resourcesPromise = this.loadResources(RESOURCES_KEYS_TEXT_CONTENT);
|
|
@@ -82384,7 +82586,8 @@ var Page = class {
|
|
|
82384
82586
|
disableNormalization,
|
|
82385
82587
|
sink,
|
|
82386
82588
|
viewBox: this.view,
|
|
82387
|
-
lang
|
|
82589
|
+
lang,
|
|
82590
|
+
intersector
|
|
82388
82591
|
});
|
|
82389
82592
|
}
|
|
82390
82593
|
async getStructTree() {
|
|
@@ -82422,6 +82625,7 @@ var Page = class {
|
|
|
82422
82625
|
const annotationsData = [], textContentPromises = [];
|
|
82423
82626
|
let partialEvaluator;
|
|
82424
82627
|
const intentAny = !!(intent & RenderingIntentFlag.ANY), intentDisplay = !!(intent & RenderingIntentFlag.DISPLAY), intentPrint = !!(intent & RenderingIntentFlag.PRINT);
|
|
82628
|
+
const highlightedAnnotations = [];
|
|
82425
82629
|
for (const annotation of annotations) {
|
|
82426
82630
|
const isVisible = intentAny || intentDisplay && annotation.viewable;
|
|
82427
82631
|
if (isVisible || intentPrint && annotation.printable) {
|
|
@@ -82441,8 +82645,27 @@ var Page = class {
|
|
|
82441
82645
|
);
|
|
82442
82646
|
})
|
|
82443
82647
|
);
|
|
82648
|
+
} else if (annotation.overlaysTextContent && isVisible) {
|
|
82649
|
+
highlightedAnnotations.push(annotation);
|
|
82444
82650
|
}
|
|
82445
82651
|
}
|
|
82652
|
+
if (highlightedAnnotations.length > 0) {
|
|
82653
|
+
const intersector = new Intersector(highlightedAnnotations);
|
|
82654
|
+
textContentPromises.push(
|
|
82655
|
+
this.extractTextContent({
|
|
82656
|
+
handler,
|
|
82657
|
+
task,
|
|
82658
|
+
includeMarkedContent: false,
|
|
82659
|
+
disableNormalization: false,
|
|
82660
|
+
sink: null,
|
|
82661
|
+
viewBox: this.view,
|
|
82662
|
+
lang: null,
|
|
82663
|
+
intersector
|
|
82664
|
+
}).then(() => {
|
|
82665
|
+
intersector.setText();
|
|
82666
|
+
})
|
|
82667
|
+
);
|
|
82668
|
+
}
|
|
82446
82669
|
await Promise.all(textContentPromises);
|
|
82447
82670
|
return annotationsData;
|
|
82448
82671
|
}
|
|
@@ -82679,7 +82902,7 @@ function find(stream, signature, limit = 1024, backwards = false) {
|
|
|
82679
82902
|
}
|
|
82680
82903
|
return false;
|
|
82681
82904
|
}
|
|
82682
|
-
var _pagePromises, _version, _PDFDocument_instances, hasOnlyDocumentSignatures_fn, loadXfaImages_fn, loadXfaFonts_fn, getLinearizationPage_fn, collectFieldObjects_fn;
|
|
82905
|
+
var _pagePromises, _version, _PDFDocument_instances, hasOnlyDocumentSignatures_fn, collectSignatureCertificates_fn, loadXfaImages_fn, loadXfaFonts_fn, getLinearizationPage_fn, collectFieldObjects_fn;
|
|
82683
82906
|
var PDFDocument = class {
|
|
82684
82907
|
constructor(pdfManager, stream) {
|
|
82685
82908
|
__privateAdd(this, _PDFDocument_instances);
|
|
@@ -82952,6 +83175,17 @@ var PDFDocument = class {
|
|
|
82952
83175
|
formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof BaseStream && !xfa.isEmpty;
|
|
82953
83176
|
const sigFlags = acroForm.get("SigFlags");
|
|
82954
83177
|
const hasSignatures = !!(sigFlags & 1);
|
|
83178
|
+
if (false) {
|
|
83179
|
+
if (hasSignatures) {
|
|
83180
|
+
const collectedSignatureCertificates = /* @__PURE__ */ new Set();
|
|
83181
|
+
__privateMethod(this, _PDFDocument_instances, collectSignatureCertificates_fn).call(this, fields, collectedSignatureCertificates);
|
|
83182
|
+
if (collectedSignatureCertificates.size > 0) {
|
|
83183
|
+
formInfo.collectedSignatureCertificates = Array.from(
|
|
83184
|
+
collectedSignatureCertificates
|
|
83185
|
+
);
|
|
83186
|
+
}
|
|
83187
|
+
}
|
|
83188
|
+
}
|
|
82955
83189
|
const hasOnlyDocumentSignatures = hasSignatures && __privateMethod(this, _PDFDocument_instances, hasOnlyDocumentSignatures_fn).call(this, fields);
|
|
82956
83190
|
formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
|
|
82957
83191
|
formInfo.hasSignatures = hasSignatures;
|
|
@@ -82975,6 +83209,9 @@ var PDFDocument = class {
|
|
|
82975
83209
|
IsCollectionPresent: !!catalog.collection,
|
|
82976
83210
|
IsSignaturesPresent: formInfo.hasSignatures
|
|
82977
83211
|
};
|
|
83212
|
+
if (false) {
|
|
83213
|
+
docInfo.collectedSignatureCertificates = formInfo.collectedSignatureCertificates ?? null;
|
|
83214
|
+
}
|
|
82978
83215
|
let infoDict;
|
|
82979
83216
|
try {
|
|
82980
83217
|
infoDict = xref.trailer.get("Info");
|
|
@@ -83298,6 +83535,40 @@ hasOnlyDocumentSignatures_fn = function(fields, recursionDepth = 0) {
|
|
|
83298
83535
|
return isSignature && isInvisible;
|
|
83299
83536
|
});
|
|
83300
83537
|
};
|
|
83538
|
+
collectSignatureCertificates_fn = function(fields, collectedSignatureCertificates, visited = new RefSet()) {
|
|
83539
|
+
if (!Array.isArray(fields)) {
|
|
83540
|
+
return;
|
|
83541
|
+
}
|
|
83542
|
+
for (let field of fields) {
|
|
83543
|
+
if (field instanceof Ref) {
|
|
83544
|
+
if (visited.has(field)) {
|
|
83545
|
+
continue;
|
|
83546
|
+
}
|
|
83547
|
+
visited.put(field);
|
|
83548
|
+
}
|
|
83549
|
+
field = this.xref.fetchIfRef(field);
|
|
83550
|
+
if (!(field instanceof Dict)) {
|
|
83551
|
+
continue;
|
|
83552
|
+
}
|
|
83553
|
+
if (field.has("Kids")) {
|
|
83554
|
+
__privateMethod(this, _PDFDocument_instances, collectSignatureCertificates_fn).call(this, field.get("Kids"), collectedSignatureCertificates, visited);
|
|
83555
|
+
continue;
|
|
83556
|
+
}
|
|
83557
|
+
const isSignature = isName(field.get("FT"), "Sig");
|
|
83558
|
+
if (!isSignature) {
|
|
83559
|
+
continue;
|
|
83560
|
+
}
|
|
83561
|
+
const value = field.get("V");
|
|
83562
|
+
if (!(value instanceof Dict)) {
|
|
83563
|
+
continue;
|
|
83564
|
+
}
|
|
83565
|
+
const subFilter = value.get("SubFilter");
|
|
83566
|
+
if (!(subFilter instanceof Name)) {
|
|
83567
|
+
continue;
|
|
83568
|
+
}
|
|
83569
|
+
collectedSignatureCertificates.add(subFilter.name);
|
|
83570
|
+
}
|
|
83571
|
+
};
|
|
83301
83572
|
loadXfaImages_fn = async function() {
|
|
83302
83573
|
const xfaImages = await this.pdfManager.ensureCatalog("xfaImages");
|
|
83303
83574
|
if (!xfaImages) {
|
|
@@ -152,8 +152,7 @@ export class StampAnnotationElement extends AnnotationElement {
|
|
|
152
152
|
}
|
|
153
153
|
import { AnnotationStorage } from "./annotation_storage.js";
|
|
154
154
|
declare class AnnotationElement {
|
|
155
|
-
static _hasPopupData({
|
|
156
|
-
titleObj: any;
|
|
155
|
+
static _hasPopupData({ contentsObj, richText }: {
|
|
157
156
|
contentsObj: any;
|
|
158
157
|
richText: any;
|
|
159
158
|
}): boolean;
|
|
@@ -118,6 +118,7 @@ export class AnnotationEditor {
|
|
|
118
118
|
isAttachedToDOM: boolean;
|
|
119
119
|
deleted: boolean;
|
|
120
120
|
get editorType(): any;
|
|
121
|
+
get mode(): any;
|
|
121
122
|
/**
|
|
122
123
|
* Get the properties to update in the UI for this editor.
|
|
123
124
|
* @returns {Array}
|
|
@@ -255,6 +256,11 @@ export class AnnotationEditor {
|
|
|
255
256
|
* Called when the alt text dialog is closed.
|
|
256
257
|
*/
|
|
257
258
|
altTextFinish(): void;
|
|
259
|
+
/**
|
|
260
|
+
* Get the toolbar buttons for this editor.
|
|
261
|
+
* @returns {Array<Array<string|object>>|null}
|
|
262
|
+
*/
|
|
263
|
+
get toolbarButtons(): Array<Array<string | object>> | null;
|
|
258
264
|
/**
|
|
259
265
|
* Add a toolbar for this editor.
|
|
260
266
|
* @returns {Promise<EditorToolbar|null>}
|
|
@@ -263,7 +269,11 @@ export class AnnotationEditor {
|
|
|
263
269
|
removeEditToolbar(): void;
|
|
264
270
|
addContainer(container: any): void;
|
|
265
271
|
getClientDimensions(): DOMRect;
|
|
266
|
-
|
|
272
|
+
/**
|
|
273
|
+
* Create the alt text for this editor.
|
|
274
|
+
* @returns {object}
|
|
275
|
+
*/
|
|
276
|
+
createAltText(): object;
|
|
267
277
|
/**
|
|
268
278
|
* Set the alt text data.
|
|
269
279
|
*/
|
|
@@ -52,6 +52,8 @@ export class HighlightEditor extends AnnotationEditor {
|
|
|
52
52
|
/** @inheritdoc */
|
|
53
53
|
get propertiesToUpdate(): any[][];
|
|
54
54
|
/** @inheritdoc */
|
|
55
|
+
get toolbarButtons(): (string | object)[][] | null;
|
|
56
|
+
/** @inheritdoc */
|
|
55
57
|
fixAndSetPosition(): void;
|
|
56
58
|
/** @inheritdoc */
|
|
57
59
|
getRect(tx: any, ty: any): any[];
|
|
@@ -31,6 +31,8 @@ export class SignatureEditor extends DrawingEditor {
|
|
|
31
31
|
areContours: any;
|
|
32
32
|
outline: InkDrawOutline;
|
|
33
33
|
};
|
|
34
|
+
/** @inheritdoc */
|
|
35
|
+
get toolbarButtons(): any[][] | null;
|
|
34
36
|
addSignature(data: any, heightInPage: any, description: any, uuid: any): void;
|
|
35
37
|
getFromImage(bitmap: any): {
|
|
36
38
|
outline: InkDrawOutline;
|
|
@@ -26,6 +26,8 @@ export class StampEditor extends AnnotationEditor {
|
|
|
26
26
|
mlGuessAltText(imageData?: null, updateAltTextData?: boolean): Promise<any>;
|
|
27
27
|
/** @inheritdoc */
|
|
28
28
|
onceAdded(focus: any): void;
|
|
29
|
+
/** @inheritdoc */
|
|
30
|
+
get toolbarButtons(): (string | object)[][];
|
|
29
31
|
setCanvas(annotationElementId: any, canvas: any): void;
|
|
30
32
|
onScaleChanging(): void;
|
|
31
33
|
copyCanvas(maxDataDimension: any, maxPreviewDimension: any, createImageData?: boolean): {
|
|
@@ -6,9 +6,11 @@ export class EditorToolbar {
|
|
|
6
6
|
get div(): null;
|
|
7
7
|
hide(): void;
|
|
8
8
|
show(): void;
|
|
9
|
+
addDeleteButton(): void;
|
|
9
10
|
addAltText(altText: any): Promise<void>;
|
|
10
11
|
addColorPicker(colorPicker: any): void;
|
|
11
12
|
addEditSignatureButton(signatureManager: any): Promise<void>;
|
|
13
|
+
addButton(name: any, tool: any): Promise<void>;
|
|
12
14
|
updateEditSignatureButton(description: any): void;
|
|
13
15
|
remove(): void;
|
|
14
16
|
#private;
|
|
@@ -12,7 +12,7 @@ export class AnnotationEditorUIManager {
|
|
|
12
12
|
static TRANSLATE_SMALL: number;
|
|
13
13
|
static TRANSLATE_BIG: number;
|
|
14
14
|
static get _keyboardManager(): any;
|
|
15
|
-
constructor(container: any, viewer: any, altTextManager: any, signatureManager: any, eventBus: any, pdfDocument: any, pageColors: any, highlightColors: any, enableHighlightFloatingButton: any, enableUpdatedAddImage: any, enableNewAltTextWhenAddingImage: any, mlManager: any, editorUndoBar: any, supportsPinchToZoom: any);
|
|
15
|
+
constructor(container: any, viewer: any, viewerAlert: any, altTextManager: any, signatureManager: any, eventBus: any, pdfDocument: any, pageColors: any, highlightColors: any, enableHighlightFloatingButton: any, enableUpdatedAddImage: any, enableNewAltTextWhenAddingImage: any, mlManager: any, editorUndoBar: any, supportsPinchToZoom: any);
|
|
16
16
|
_editorUndoBar: null;
|
|
17
17
|
_signal: AbortSignal;
|
|
18
18
|
_eventBus: any;
|
|
@@ -66,6 +66,7 @@ export class AnnotationEditorUIManager {
|
|
|
66
66
|
* @param {AnnotationEditor} editor
|
|
67
67
|
*/
|
|
68
68
|
addToAnnotationStorage(editor: AnnotationEditor): void;
|
|
69
|
+
a11yAlert(messageId: any, args?: null): void;
|
|
69
70
|
blur(): void;
|
|
70
71
|
focus(): void;
|
|
71
72
|
addEditListeners(): void;
|
|
@@ -141,8 +142,10 @@ export class AnnotationEditorUIManager {
|
|
|
141
142
|
* @param {string|null} editId
|
|
142
143
|
* @param {boolean} [isFromKeyboard] - true if the mode change is due to a
|
|
143
144
|
* keyboard action.
|
|
145
|
+
* @param {boolean} [mustEnterInEditMode] - true if the editor must enter in
|
|
146
|
+
* edit mode.
|
|
144
147
|
*/
|
|
145
|
-
updateMode(mode: number, editId?: string | null, isFromKeyboard?: boolean): Promise<void>;
|
|
148
|
+
updateMode(mode: number, editId?: string | null, isFromKeyboard?: boolean, mustEnterInEditMode?: boolean): Promise<void>;
|
|
146
149
|
addNewEditorFromKeyboard(): void;
|
|
147
150
|
/**
|
|
148
151
|
* Update the toolbar if it's required to reflect the tool currently used.
|
package/package.json
CHANGED