@chialab/pdfjs-lib 1.0.0-alpha.4 → 1.0.0-alpha.5
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-DYHYQ33L.js → chunk-KKGFKVEF.js} +103 -61
- package/dist/browser/index.js +328 -345
- package/dist/browser/worker.js +2353 -2087
- package/dist/lib/AnnotationData.d.ts +1 -1
- package/dist/node/{chunk-KTTVPO2G.js → chunk-PWUBNK7D.js} +103 -61
- package/dist/node/index.js +328 -345
- package/dist/node/worker.js +2353 -2087
- package/dist/pdf.js/src/display/api.d.ts +29 -4
- package/dist/pdf.js/src/display/canvas.d.ts +13 -17
- package/dist/pdf.js/src/display/display_utils.d.ts +10 -0
- package/dist/pdf.js/src/display/editor/editor.d.ts +1 -1
- package/dist/pdf.js/src/display/editor/highlight.d.ts +1 -0
- package/dist/pdf.js/src/display/editor/ink.d.ts +1 -0
- package/dist/pdf.js/src/display/editor/signature.d.ts +1 -0
- package/dist/pdf.js/src/display/editor/stamp.d.ts +1 -2
- package/dist/pdf.js/src/display/editor/tools.d.ts +0 -6
- package/dist/pdf.js/src/display/pattern_helper.d.ts +4 -2
- package/dist/pdf.js/src/display/touch_manager.d.ts +5 -1
- package/dist/pdf.js/src/pdf.d.ts +3 -1
- package/dist/pdf.js/src/shared/util.d.ts +105 -92
- package/package.json +1 -1
package/dist/node/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
AnnotationPrefix,
|
|
9
9
|
AnnotationType,
|
|
10
10
|
BaseException,
|
|
11
|
+
DrawOPS,
|
|
11
12
|
FONT_IDENTITY_MATRIX,
|
|
12
13
|
FeatureTest,
|
|
13
14
|
FormatError,
|
|
@@ -15,6 +16,7 @@ import {
|
|
|
15
16
|
ImageKind,
|
|
16
17
|
InvalidPDFException,
|
|
17
18
|
LINE_FACTOR,
|
|
19
|
+
MathClamp,
|
|
18
20
|
MessageHandler,
|
|
19
21
|
MurmurHash3_64,
|
|
20
22
|
OPS,
|
|
@@ -25,6 +27,7 @@ import {
|
|
|
25
27
|
TextRenderingMode,
|
|
26
28
|
Util,
|
|
27
29
|
VerbosityLevel,
|
|
30
|
+
_isValidExplicitDest,
|
|
28
31
|
assert,
|
|
29
32
|
convertBlackAndWhiteToRGBA,
|
|
30
33
|
createValidAbsoluteUrl,
|
|
@@ -43,7 +46,7 @@ import {
|
|
|
43
46
|
unreachable,
|
|
44
47
|
warn,
|
|
45
48
|
wrapReason
|
|
46
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-PWUBNK7D.js";
|
|
47
50
|
import {
|
|
48
51
|
__privateAdd,
|
|
49
52
|
__privateGet,
|
|
@@ -491,9 +494,9 @@ function setLayerDimensions(div, viewport, mustFlip = false, mustRotate = true)
|
|
|
491
494
|
div.setAttribute("data-main-rotation", viewport.rotation);
|
|
492
495
|
}
|
|
493
496
|
}
|
|
494
|
-
var OutputScale = class {
|
|
497
|
+
var OutputScale = class _OutputScale {
|
|
495
498
|
constructor() {
|
|
496
|
-
const pixelRatio =
|
|
499
|
+
const { pixelRatio } = _OutputScale;
|
|
497
500
|
this.sx = pixelRatio;
|
|
498
501
|
this.sy = pixelRatio;
|
|
499
502
|
}
|
|
@@ -503,9 +506,37 @@ var OutputScale = class {
|
|
|
503
506
|
get scaled() {
|
|
504
507
|
return this.sx !== 1 || this.sy !== 1;
|
|
505
508
|
}
|
|
509
|
+
/**
|
|
510
|
+
* @type {boolean} Returns `true` when scaling is symmetric,
|
|
511
|
+
* `false` otherwise.
|
|
512
|
+
*/
|
|
506
513
|
get symmetric() {
|
|
507
514
|
return this.sx === this.sy;
|
|
508
515
|
}
|
|
516
|
+
/**
|
|
517
|
+
* @returns {boolean} Returns `true` if scaling was limited,
|
|
518
|
+
* `false` otherwise.
|
|
519
|
+
*/
|
|
520
|
+
limitCanvas(width, height, maxPixels, maxDim) {
|
|
521
|
+
let maxAreaScale = Infinity, maxWidthScale = Infinity, maxHeightScale = Infinity;
|
|
522
|
+
if (maxPixels > 0) {
|
|
523
|
+
maxAreaScale = Math.sqrt(maxPixels / (width * height));
|
|
524
|
+
}
|
|
525
|
+
if (maxDim !== -1) {
|
|
526
|
+
maxWidthScale = maxDim / width;
|
|
527
|
+
maxHeightScale = maxDim / height;
|
|
528
|
+
}
|
|
529
|
+
const maxScale = Math.min(maxAreaScale, maxWidthScale, maxHeightScale);
|
|
530
|
+
if (this.sx > maxScale || this.sy > maxScale) {
|
|
531
|
+
this.sx = maxScale;
|
|
532
|
+
this.sy = maxScale;
|
|
533
|
+
return true;
|
|
534
|
+
}
|
|
535
|
+
return false;
|
|
536
|
+
}
|
|
537
|
+
static get pixelRatio() {
|
|
538
|
+
return globalThis.devicePixelRatio || 1;
|
|
539
|
+
}
|
|
509
540
|
};
|
|
510
541
|
var SupportedImageMimeTypes = [
|
|
511
542
|
"image/apng",
|
|
@@ -3169,7 +3200,7 @@ setState_fn = async function() {
|
|
|
3169
3200
|
if (!tooltip.parentNode) {
|
|
3170
3201
|
button.append(tooltip);
|
|
3171
3202
|
}
|
|
3172
|
-
const element = __privateGet(this, _editor2).
|
|
3203
|
+
const element = __privateGet(this, _editor2).getElementForAltText();
|
|
3173
3204
|
element?.setAttribute("aria-describedby", tooltip.id);
|
|
3174
3205
|
};
|
|
3175
3206
|
__privateAdd(_AltText, _l10nNewButton, null);
|
|
@@ -3214,12 +3245,12 @@ var _TouchManager = class _TouchManager {
|
|
|
3214
3245
|
signal: __privateGet(this, _signal)
|
|
3215
3246
|
});
|
|
3216
3247
|
}
|
|
3248
|
+
/**
|
|
3249
|
+
* NOTE: Don't shadow this value since `devicePixelRatio` may change if the
|
|
3250
|
+
* window resolution changes, e.g. if the viewer is moved to another monitor.
|
|
3251
|
+
*/
|
|
3217
3252
|
get MIN_TOUCH_DISTANCE_TO_PINCH() {
|
|
3218
|
-
return
|
|
3219
|
-
this,
|
|
3220
|
-
"MIN_TOUCH_DISTANCE_TO_PINCH",
|
|
3221
|
-
35 / (window.devicePixelRatio || 1)
|
|
3222
|
-
);
|
|
3253
|
+
return 35 / OutputScale.pixelRatio;
|
|
3223
3254
|
}
|
|
3224
3255
|
destroy() {
|
|
3225
3256
|
__privateGet(this, _touchManagerAC)?.abort();
|
|
@@ -3801,20 +3832,20 @@ var _AnnotationEditor = class _AnnotationEditor {
|
|
|
3801
3832
|
if (this._mustFixPosition) {
|
|
3802
3833
|
switch (rotation) {
|
|
3803
3834
|
case 0:
|
|
3804
|
-
x =
|
|
3805
|
-
y =
|
|
3835
|
+
x = MathClamp(x, 0, pageWidth - width);
|
|
3836
|
+
y = MathClamp(y, 0, pageHeight - height);
|
|
3806
3837
|
break;
|
|
3807
3838
|
case 90:
|
|
3808
|
-
x =
|
|
3809
|
-
y =
|
|
3839
|
+
x = MathClamp(x, 0, pageWidth - height);
|
|
3840
|
+
y = MathClamp(y, width, pageHeight);
|
|
3810
3841
|
break;
|
|
3811
3842
|
case 180:
|
|
3812
|
-
x =
|
|
3813
|
-
y =
|
|
3843
|
+
x = MathClamp(x, width, pageWidth);
|
|
3844
|
+
y = MathClamp(y, height, pageHeight);
|
|
3814
3845
|
break;
|
|
3815
3846
|
case 270:
|
|
3816
|
-
x =
|
|
3817
|
-
y =
|
|
3847
|
+
x = MathClamp(x, height, pageWidth);
|
|
3848
|
+
y = MathClamp(y, 0, pageHeight - width);
|
|
3818
3849
|
break;
|
|
3819
3850
|
}
|
|
3820
3851
|
}
|
|
@@ -3991,29 +4022,35 @@ var _AnnotationEditor = class _AnnotationEditor {
|
|
|
3991
4022
|
* @returns {HTMLDivElement | null}
|
|
3992
4023
|
*/
|
|
3993
4024
|
render() {
|
|
3994
|
-
this.div = document.createElement("div");
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
4025
|
+
const div = this.div = document.createElement("div");
|
|
4026
|
+
div.setAttribute("data-editor-rotation", (360 - this.rotation) % 360);
|
|
4027
|
+
div.className = this.name;
|
|
4028
|
+
div.setAttribute("id", this.id);
|
|
4029
|
+
div.tabIndex = __privateGet(this, _disabled) ? -1 : 0;
|
|
4030
|
+
div.setAttribute("role", "application");
|
|
4031
|
+
if (this.defaultL10nId) {
|
|
4032
|
+
div.setAttribute("data-l10n-id", this.defaultL10nId);
|
|
4033
|
+
}
|
|
3999
4034
|
if (!this._isVisible) {
|
|
4000
|
-
|
|
4035
|
+
div.classList.add("hidden");
|
|
4001
4036
|
}
|
|
4002
4037
|
this.setInForeground();
|
|
4003
4038
|
__privateMethod(this, _AnnotationEditor_instances, addFocusListeners_fn).call(this);
|
|
4004
4039
|
const [parentWidth, parentHeight] = this.parentDimensions;
|
|
4005
4040
|
if (this.parentRotation % 180 !== 0) {
|
|
4006
|
-
|
|
4041
|
+
div.style.maxWidth = `${(100 * parentHeight / parentWidth).toFixed(
|
|
4042
|
+
2
|
|
4043
|
+
)}%`;
|
|
4044
|
+
div.style.maxHeight = `${(100 * parentWidth / parentHeight).toFixed(
|
|
4007
4045
|
2
|
|
4008
4046
|
)}%`;
|
|
4009
|
-
this.div.style.maxHeight = `${(100 * parentWidth / parentHeight).toFixed(2)}%`;
|
|
4010
4047
|
}
|
|
4011
4048
|
const [tx, ty] = this.getInitialTranslation();
|
|
4012
4049
|
this.translate(tx, ty);
|
|
4013
|
-
bindEvents(this,
|
|
4050
|
+
bindEvents(this, div, ["keydown", "pointerdown"]);
|
|
4014
4051
|
if (this.isResizable && this._uiManager._supportsPinchToZoom) {
|
|
4015
4052
|
__privateGet(this, _touchManager) || __privateSet(this, _touchManager, new TouchManager({
|
|
4016
|
-
container:
|
|
4053
|
+
container: div,
|
|
4017
4054
|
isPinchingDisabled: () => !this.isSelected,
|
|
4018
4055
|
onPinchStart: __privateMethod(this, _AnnotationEditor_instances, touchPinchStartCallback_fn).bind(this),
|
|
4019
4056
|
onPinching: __privateMethod(this, _AnnotationEditor_instances, touchPinchCallback_fn).bind(this),
|
|
@@ -4022,7 +4059,7 @@ var _AnnotationEditor = class _AnnotationEditor {
|
|
|
4022
4059
|
}));
|
|
4023
4060
|
}
|
|
4024
4061
|
this._uiManager._editorUndoBar?.hide();
|
|
4025
|
-
return
|
|
4062
|
+
return div;
|
|
4026
4063
|
}
|
|
4027
4064
|
/**
|
|
4028
4065
|
* Onpointerdown callback.
|
|
@@ -4312,7 +4349,6 @@ var _AnnotationEditor = class _AnnotationEditor {
|
|
|
4312
4349
|
if (this.isResizable) {
|
|
4313
4350
|
__privateMethod(this, _AnnotationEditor_instances, createResizers_fn).call(this);
|
|
4314
4351
|
__privateGet(this, _resizersDiv).classList.remove("hidden");
|
|
4315
|
-
bindEvents(this, this.div, ["keydown"]);
|
|
4316
4352
|
}
|
|
4317
4353
|
}
|
|
4318
4354
|
get toolbarPosition() {
|
|
@@ -4454,8 +4490,8 @@ var _AnnotationEditor = class _AnnotationEditor {
|
|
|
4454
4490
|
/**
|
|
4455
4491
|
* @returns {HTMLElement | null} the element requiring an alt text.
|
|
4456
4492
|
*/
|
|
4457
|
-
|
|
4458
|
-
return
|
|
4493
|
+
getElementForAltText() {
|
|
4494
|
+
return this.div;
|
|
4459
4495
|
}
|
|
4460
4496
|
/**
|
|
4461
4497
|
* Get the div which really contains the displayed content.
|
|
@@ -4859,14 +4895,12 @@ resizerPointermove_fn = function(name, event) {
|
|
|
4859
4895
|
minHeight / savedHeight
|
|
4860
4896
|
);
|
|
4861
4897
|
} else if (isHorizontal) {
|
|
4862
|
-
ratioX = Math.
|
|
4863
|
-
minWidth,
|
|
4864
|
-
Math.min(1, Math.abs(oppositePoint[0] - point[0] - deltaX))
|
|
4865
|
-
) / savedWidth;
|
|
4898
|
+
ratioX = MathClamp(Math.abs(oppositePoint[0] - point[0] - deltaX), minWidth, 1) / savedWidth;
|
|
4866
4899
|
} else {
|
|
4867
|
-
ratioY =
|
|
4900
|
+
ratioY = MathClamp(
|
|
4901
|
+
Math.abs(oppositePoint[1] - point[1] - deltaY),
|
|
4868
4902
|
minHeight,
|
|
4869
|
-
|
|
4903
|
+
1
|
|
4870
4904
|
) / savedHeight;
|
|
4871
4905
|
}
|
|
4872
4906
|
const newWidth = _AnnotationEditor._round(savedWidth * ratioX);
|
|
@@ -6695,6 +6729,9 @@ var BaseShadingPattern = class {
|
|
|
6695
6729
|
unreachable("Cannot initialize BaseShadingPattern.");
|
|
6696
6730
|
}
|
|
6697
6731
|
}
|
|
6732
|
+
isModifyingCurrentTransform() {
|
|
6733
|
+
return false;
|
|
6734
|
+
}
|
|
6698
6735
|
getPattern() {
|
|
6699
6736
|
unreachable("Abstract method `getPattern` called.");
|
|
6700
6737
|
}
|
|
@@ -6993,6 +7030,9 @@ var MeshShadingPattern = class extends BaseShadingPattern {
|
|
|
6993
7030
|
scaleY
|
|
6994
7031
|
};
|
|
6995
7032
|
}
|
|
7033
|
+
isModifyingCurrentTransform() {
|
|
7034
|
+
return true;
|
|
7035
|
+
}
|
|
6996
7036
|
getPattern(ctx, owner, inverse, pathType) {
|
|
6997
7037
|
applyBoundingBox(ctx, this._bbox);
|
|
6998
7038
|
let scale;
|
|
@@ -7045,7 +7085,8 @@ var PaintType = {
|
|
|
7045
7085
|
UNCOLORED: 2
|
|
7046
7086
|
};
|
|
7047
7087
|
var _TilingPattern = class _TilingPattern {
|
|
7048
|
-
constructor(IR,
|
|
7088
|
+
constructor(IR, ctx, canvasGraphicsFactory, baseTransform) {
|
|
7089
|
+
this.color = IR[1];
|
|
7049
7090
|
this.operatorList = IR[2];
|
|
7050
7091
|
this.matrix = IR[3];
|
|
7051
7092
|
this.bbox = IR[4];
|
|
@@ -7053,7 +7094,6 @@ var _TilingPattern = class _TilingPattern {
|
|
|
7053
7094
|
this.ystep = IR[6];
|
|
7054
7095
|
this.paintType = IR[7];
|
|
7055
7096
|
this.tilingType = IR[8];
|
|
7056
|
-
this.color = color;
|
|
7057
7097
|
this.ctx = ctx;
|
|
7058
7098
|
this.canvasGraphicsFactory = canvasGraphicsFactory;
|
|
7059
7099
|
this.baseTransform = baseTransform;
|
|
@@ -7225,6 +7265,9 @@ var _TilingPattern = class _TilingPattern {
|
|
|
7225
7265
|
throw new FormatError(`Unsupported paint type: ${paintType}`);
|
|
7226
7266
|
}
|
|
7227
7267
|
}
|
|
7268
|
+
isModifyingCurrentTransform() {
|
|
7269
|
+
return false;
|
|
7270
|
+
}
|
|
7228
7271
|
getPattern(ctx, owner, inverse, pathType) {
|
|
7229
7272
|
let matrix = inverse;
|
|
7230
7273
|
if (pathType !== PathType.SHADING) {
|
|
@@ -7259,6 +7302,7 @@ var EXECUTION_TIME = 15;
|
|
|
7259
7302
|
var EXECUTION_STEPS = 10;
|
|
7260
7303
|
var MAX_SIZE_TO_COMPILE = 1e3;
|
|
7261
7304
|
var FULL_CHUNK_HEIGHT = 16;
|
|
7305
|
+
var SCALE_MATRIX = new DOMMatrix();
|
|
7262
7306
|
function mirrorContextOperations(ctx, destCtx) {
|
|
7263
7307
|
if (ctx._removeMirroring) {
|
|
7264
7308
|
throw new Error("Context is already forwarding operations.");
|
|
@@ -7444,10 +7488,11 @@ function compileType3Glyph(imgData) {
|
|
|
7444
7488
|
0
|
|
7445
7489
|
]);
|
|
7446
7490
|
const width1 = width + 1;
|
|
7447
|
-
|
|
7491
|
+
const points = new Uint8Array(width1 * (height + 1));
|
|
7448
7492
|
let i, j, j0;
|
|
7449
7493
|
const lineSize = width + 7 & ~7;
|
|
7450
|
-
|
|
7494
|
+
const data = new Uint8Array(lineSize * height);
|
|
7495
|
+
let pos = 0;
|
|
7451
7496
|
for (const elem of imgData.data) {
|
|
7452
7497
|
let mask = 128;
|
|
7453
7498
|
while (mask > 0) {
|
|
@@ -7518,6 +7563,7 @@ function compileType3Glyph(imgData) {
|
|
|
7518
7563
|
}
|
|
7519
7564
|
const steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]);
|
|
7520
7565
|
const path = new SvgPath2D();
|
|
7566
|
+
const { a, b, c, d, e, f } = new DOMMatrix().scaleSelf(1 / width, -1 / height).translateSelf(0, -height);
|
|
7521
7567
|
for (i = 0; count && i <= height; i++) {
|
|
7522
7568
|
let p = i * width1;
|
|
7523
7569
|
const end = p + width;
|
|
@@ -7527,7 +7573,9 @@ function compileType3Glyph(imgData) {
|
|
|
7527
7573
|
if (p === end) {
|
|
7528
7574
|
continue;
|
|
7529
7575
|
}
|
|
7530
|
-
|
|
7576
|
+
let x = p % width1;
|
|
7577
|
+
let y = i;
|
|
7578
|
+
path.moveTo(a * x + c * y + e, b * x + d * y + f);
|
|
7531
7579
|
const p0 = p;
|
|
7532
7580
|
let type = points[p];
|
|
7533
7581
|
do {
|
|
@@ -7543,24 +7591,16 @@ function compileType3Glyph(imgData) {
|
|
|
7543
7591
|
type = pp & 51 * type >> 4;
|
|
7544
7592
|
points[p] &= type >> 2 | type << 2;
|
|
7545
7593
|
}
|
|
7546
|
-
|
|
7594
|
+
x = p % width1;
|
|
7595
|
+
y = p / width1 | 0;
|
|
7596
|
+
path.lineTo(a * x + c * y + e, b * x + d * y + f);
|
|
7547
7597
|
if (!points[p]) {
|
|
7548
7598
|
--count;
|
|
7549
7599
|
}
|
|
7550
7600
|
} while (p0 !== p);
|
|
7551
7601
|
--i;
|
|
7552
7602
|
}
|
|
7553
|
-
|
|
7554
|
-
points = null;
|
|
7555
|
-
const drawOutline = function(c) {
|
|
7556
|
-
c.save();
|
|
7557
|
-
c.scale(1 / width, -1 / height);
|
|
7558
|
-
c.translate(0, -height);
|
|
7559
|
-
c.fill(path);
|
|
7560
|
-
c.beginPath();
|
|
7561
|
-
c.restore();
|
|
7562
|
-
};
|
|
7563
|
-
return drawOutline;
|
|
7603
|
+
return path;
|
|
7564
7604
|
}
|
|
7565
7605
|
var CanvasExtraState = class {
|
|
7566
7606
|
constructor(width, height) {
|
|
@@ -7596,17 +7636,6 @@ var CanvasExtraState = class {
|
|
|
7596
7636
|
clone.clipBox = this.clipBox.slice();
|
|
7597
7637
|
return clone;
|
|
7598
7638
|
}
|
|
7599
|
-
setCurrentPoint(x, y) {
|
|
7600
|
-
this.x = x;
|
|
7601
|
-
this.y = y;
|
|
7602
|
-
}
|
|
7603
|
-
updatePathMinMax(transform, x, y) {
|
|
7604
|
-
[x, y] = Util.applyTransform([x, y], transform);
|
|
7605
|
-
this.minX = Math.min(this.minX, x);
|
|
7606
|
-
this.minY = Math.min(this.minY, y);
|
|
7607
|
-
this.maxX = Math.max(this.maxX, x);
|
|
7608
|
-
this.maxY = Math.max(this.maxY, y);
|
|
7609
|
-
}
|
|
7610
7639
|
updateRectMinMax(transform, rect) {
|
|
7611
7640
|
const p1 = Util.applyTransform(rect, transform);
|
|
7612
7641
|
const p2 = Util.applyTransform(rect.slice(2), transform);
|
|
@@ -7617,20 +7646,6 @@ var CanvasExtraState = class {
|
|
|
7617
7646
|
this.maxX = Math.max(this.maxX, p1[0], p2[0], p3[0], p4[0]);
|
|
7618
7647
|
this.maxY = Math.max(this.maxY, p1[1], p2[1], p3[1], p4[1]);
|
|
7619
7648
|
}
|
|
7620
|
-
updateScalingPathMinMax(transform, minMax) {
|
|
7621
|
-
Util.scaleMinMax(transform, minMax);
|
|
7622
|
-
this.minX = Math.min(this.minX, minMax[0]);
|
|
7623
|
-
this.minY = Math.min(this.minY, minMax[1]);
|
|
7624
|
-
this.maxX = Math.max(this.maxX, minMax[2]);
|
|
7625
|
-
this.maxY = Math.max(this.maxY, minMax[3]);
|
|
7626
|
-
}
|
|
7627
|
-
updateCurvePathMinMax(transform, x0, y0, x1, y1, x2, y2, x3, y3, minMax) {
|
|
7628
|
-
const box = Util.bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3, minMax);
|
|
7629
|
-
if (minMax) {
|
|
7630
|
-
return;
|
|
7631
|
-
}
|
|
7632
|
-
this.updateRectMinMax(transform, box);
|
|
7633
|
-
}
|
|
7634
7649
|
getPathBoundingBox(pathType = PathType.FILL, transform = null) {
|
|
7635
7650
|
const box = [this.minX, this.minY, this.maxX, this.maxY];
|
|
7636
7651
|
if (pathType === PathType.STROKE) {
|
|
@@ -7838,7 +7853,7 @@ function getImageSmoothingEnabled(transform, interpolate) {
|
|
|
7838
7853
|
scale[0] = Math.fround(scale[0]);
|
|
7839
7854
|
scale[1] = Math.fround(scale[1]);
|
|
7840
7855
|
const actualScale = Math.fround(
|
|
7841
|
-
|
|
7856
|
+
OutputScale.pixelRatio * PixelsPerInch.PDF_TO_CSS_UNITS
|
|
7842
7857
|
);
|
|
7843
7858
|
return scale[0] <= actualScale && scale[1] <= actualScale;
|
|
7844
7859
|
}
|
|
@@ -8208,8 +8223,7 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
8208
8223
|
this.current.strokeAlpha = value;
|
|
8209
8224
|
break;
|
|
8210
8225
|
case "ca":
|
|
8211
|
-
this.current.fillAlpha = value;
|
|
8212
|
-
this.ctx.globalAlpha = value;
|
|
8226
|
+
this.ctx.globalAlpha = this.current.fillAlpha = value;
|
|
8213
8227
|
break;
|
|
8214
8228
|
case "BM":
|
|
8215
8229
|
this.ctx.globalCompositeOperation = value;
|
|
@@ -8258,16 +8272,11 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
8258
8272
|
drawnHeight
|
|
8259
8273
|
);
|
|
8260
8274
|
this.suspendedCtx = this.ctx;
|
|
8261
|
-
this.ctx = scratchCanvas.context;
|
|
8262
|
-
|
|
8263
|
-
ctx.setTransform(...getCurrentTransform(this.suspendedCtx));
|
|
8275
|
+
const ctx = this.ctx = scratchCanvas.context;
|
|
8276
|
+
ctx.setTransform(this.suspendedCtx.getTransform());
|
|
8264
8277
|
copyCtxState(this.suspendedCtx, ctx);
|
|
8265
8278
|
mirrorContextOperations(ctx, this.suspendedCtx);
|
|
8266
|
-
this.setGState([
|
|
8267
|
-
["BM", "source-over"],
|
|
8268
|
-
["ca", 1],
|
|
8269
|
-
["CA", 1]
|
|
8270
|
-
]);
|
|
8279
|
+
this.setGState([["BM", "source-over"]]);
|
|
8271
8280
|
}
|
|
8272
8281
|
endSMaskMode() {
|
|
8273
8282
|
if (!this.inSMaskMode) {
|
|
@@ -8387,31 +8396,28 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
8387
8396
|
save() {
|
|
8388
8397
|
if (this.inSMaskMode) {
|
|
8389
8398
|
copyCtxState(this.ctx, this.suspendedCtx);
|
|
8390
|
-
this.suspendedCtx.save();
|
|
8391
|
-
} else {
|
|
8392
|
-
this.ctx.save();
|
|
8393
8399
|
}
|
|
8400
|
+
this.ctx.save();
|
|
8394
8401
|
const old = this.current;
|
|
8395
8402
|
this.stateStack.push(old);
|
|
8396
8403
|
this.current = old.clone();
|
|
8397
8404
|
}
|
|
8398
8405
|
restore() {
|
|
8399
|
-
if (this.stateStack.length === 0
|
|
8400
|
-
this.endSMaskMode();
|
|
8401
|
-
}
|
|
8402
|
-
if (this.stateStack.length !== 0) {
|
|
8403
|
-
this.current = this.stateStack.pop();
|
|
8406
|
+
if (this.stateStack.length === 0) {
|
|
8404
8407
|
if (this.inSMaskMode) {
|
|
8405
|
-
this.
|
|
8406
|
-
copyCtxState(this.suspendedCtx, this.ctx);
|
|
8407
|
-
} else {
|
|
8408
|
-
this.ctx.restore();
|
|
8408
|
+
this.endSMaskMode();
|
|
8409
8409
|
}
|
|
8410
|
-
|
|
8411
|
-
this.pendingClip = null;
|
|
8412
|
-
this._cachedScaleForStroking[0] = -1;
|
|
8413
|
-
this._cachedGetSinglePixelWidth = null;
|
|
8410
|
+
return;
|
|
8414
8411
|
}
|
|
8412
|
+
this.current = this.stateStack.pop();
|
|
8413
|
+
this.ctx.restore();
|
|
8414
|
+
if (this.inSMaskMode) {
|
|
8415
|
+
copyCtxState(this.suspendedCtx, this.ctx);
|
|
8416
|
+
}
|
|
8417
|
+
this.checkSMaskState();
|
|
8418
|
+
this.pendingClip = null;
|
|
8419
|
+
this._cachedScaleForStroking[0] = -1;
|
|
8420
|
+
this._cachedGetSinglePixelWidth = null;
|
|
8415
8421
|
}
|
|
8416
8422
|
transform(a, b, c, d, e, f) {
|
|
8417
8423
|
this.ctx.transform(a, b, c, d, e, f);
|
|
@@ -8419,145 +8425,56 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
8419
8425
|
this._cachedGetSinglePixelWidth = null;
|
|
8420
8426
|
}
|
|
8421
8427
|
// Path
|
|
8422
|
-
constructPath(
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
const isScalingMatrix = currentTransform[0] === 0 && currentTransform[3] === 0 || currentTransform[1] === 0 && currentTransform[2] === 0;
|
|
8429
|
-
const minMaxForBezier = isScalingMatrix ? minMax.slice(0) : null;
|
|
8430
|
-
for (let i = 0, j = 0, ii = ops.length; i < ii; i++) {
|
|
8431
|
-
switch (ops[i] | 0) {
|
|
8432
|
-
case OPS.rectangle:
|
|
8433
|
-
x = args[j++];
|
|
8434
|
-
y = args[j++];
|
|
8435
|
-
const width = args[j++];
|
|
8436
|
-
const height = args[j++];
|
|
8437
|
-
const xw = x + width;
|
|
8438
|
-
const yh = y + height;
|
|
8439
|
-
ctx.moveTo(x, y);
|
|
8440
|
-
if (width === 0 || height === 0) {
|
|
8441
|
-
ctx.lineTo(xw, yh);
|
|
8442
|
-
} else {
|
|
8443
|
-
ctx.lineTo(xw, y);
|
|
8444
|
-
ctx.lineTo(xw, yh);
|
|
8445
|
-
ctx.lineTo(x, yh);
|
|
8446
|
-
}
|
|
8447
|
-
if (!isScalingMatrix) {
|
|
8448
|
-
current.updateRectMinMax(currentTransform, [x, y, xw, yh]);
|
|
8449
|
-
}
|
|
8450
|
-
ctx.closePath();
|
|
8451
|
-
break;
|
|
8452
|
-
case OPS.moveTo:
|
|
8453
|
-
x = args[j++];
|
|
8454
|
-
y = args[j++];
|
|
8455
|
-
ctx.moveTo(x, y);
|
|
8456
|
-
if (!isScalingMatrix) {
|
|
8457
|
-
current.updatePathMinMax(currentTransform, x, y);
|
|
8458
|
-
}
|
|
8459
|
-
break;
|
|
8460
|
-
case OPS.lineTo:
|
|
8461
|
-
x = args[j++];
|
|
8462
|
-
y = args[j++];
|
|
8463
|
-
ctx.lineTo(x, y);
|
|
8464
|
-
if (!isScalingMatrix) {
|
|
8465
|
-
current.updatePathMinMax(currentTransform, x, y);
|
|
8466
|
-
}
|
|
8467
|
-
break;
|
|
8468
|
-
case OPS.curveTo:
|
|
8469
|
-
startX = x;
|
|
8470
|
-
startY = y;
|
|
8471
|
-
x = args[j + 4];
|
|
8472
|
-
y = args[j + 5];
|
|
8473
|
-
ctx.bezierCurveTo(
|
|
8474
|
-
args[j],
|
|
8475
|
-
args[j + 1],
|
|
8476
|
-
args[j + 2],
|
|
8477
|
-
args[j + 3],
|
|
8478
|
-
x,
|
|
8479
|
-
y
|
|
8480
|
-
);
|
|
8481
|
-
current.updateCurvePathMinMax(
|
|
8482
|
-
currentTransform,
|
|
8483
|
-
startX,
|
|
8484
|
-
startY,
|
|
8485
|
-
args[j],
|
|
8486
|
-
args[j + 1],
|
|
8487
|
-
args[j + 2],
|
|
8488
|
-
args[j + 3],
|
|
8489
|
-
x,
|
|
8490
|
-
y,
|
|
8491
|
-
minMaxForBezier
|
|
8492
|
-
);
|
|
8493
|
-
j += 6;
|
|
8494
|
-
break;
|
|
8495
|
-
case OPS.curveTo2:
|
|
8496
|
-
startX = x;
|
|
8497
|
-
startY = y;
|
|
8498
|
-
ctx.bezierCurveTo(
|
|
8499
|
-
x,
|
|
8500
|
-
y,
|
|
8501
|
-
args[j],
|
|
8502
|
-
args[j + 1],
|
|
8503
|
-
args[j + 2],
|
|
8504
|
-
args[j + 3]
|
|
8505
|
-
);
|
|
8506
|
-
current.updateCurvePathMinMax(
|
|
8507
|
-
currentTransform,
|
|
8508
|
-
startX,
|
|
8509
|
-
startY,
|
|
8510
|
-
x,
|
|
8511
|
-
y,
|
|
8512
|
-
args[j],
|
|
8513
|
-
args[j + 1],
|
|
8514
|
-
args[j + 2],
|
|
8515
|
-
args[j + 3],
|
|
8516
|
-
minMaxForBezier
|
|
8517
|
-
);
|
|
8518
|
-
x = args[j + 2];
|
|
8519
|
-
y = args[j + 3];
|
|
8520
|
-
j += 4;
|
|
8521
|
-
break;
|
|
8522
|
-
case OPS.curveTo3:
|
|
8523
|
-
startX = x;
|
|
8524
|
-
startY = y;
|
|
8525
|
-
x = args[j + 2];
|
|
8526
|
-
y = args[j + 3];
|
|
8527
|
-
ctx.bezierCurveTo(args[j], args[j + 1], x, y, x, y);
|
|
8528
|
-
current.updateCurvePathMinMax(
|
|
8529
|
-
currentTransform,
|
|
8530
|
-
startX,
|
|
8531
|
-
startY,
|
|
8532
|
-
args[j],
|
|
8533
|
-
args[j + 1],
|
|
8534
|
-
x,
|
|
8535
|
-
y,
|
|
8536
|
-
x,
|
|
8537
|
-
y,
|
|
8538
|
-
minMaxForBezier
|
|
8539
|
-
);
|
|
8540
|
-
j += 4;
|
|
8541
|
-
break;
|
|
8542
|
-
case OPS.closePath:
|
|
8543
|
-
ctx.closePath();
|
|
8544
|
-
break;
|
|
8545
|
-
}
|
|
8428
|
+
constructPath(op, data, minMax) {
|
|
8429
|
+
let [path] = data;
|
|
8430
|
+
if (!minMax) {
|
|
8431
|
+
path || (path = data[0] = new SvgPath2D());
|
|
8432
|
+
this[op](path);
|
|
8433
|
+
return;
|
|
8546
8434
|
}
|
|
8547
|
-
if (
|
|
8548
|
-
|
|
8435
|
+
if (!(path instanceof SvgPath2D)) {
|
|
8436
|
+
const path2d = data[0] = new SvgPath2D();
|
|
8437
|
+
for (let i = 0, ii = path.length; i < ii; ) {
|
|
8438
|
+
switch (path[i++]) {
|
|
8439
|
+
case DrawOPS.moveTo:
|
|
8440
|
+
path2d.moveTo(path[i++], path[i++]);
|
|
8441
|
+
break;
|
|
8442
|
+
case DrawOPS.lineTo:
|
|
8443
|
+
path2d.lineTo(path[i++], path[i++]);
|
|
8444
|
+
break;
|
|
8445
|
+
case DrawOPS.curveTo:
|
|
8446
|
+
path2d.bezierCurveTo(
|
|
8447
|
+
path[i++],
|
|
8448
|
+
path[i++],
|
|
8449
|
+
path[i++],
|
|
8450
|
+
path[i++],
|
|
8451
|
+
path[i++],
|
|
8452
|
+
path[i++]
|
|
8453
|
+
);
|
|
8454
|
+
break;
|
|
8455
|
+
case DrawOPS.closePath:
|
|
8456
|
+
path2d.closePath();
|
|
8457
|
+
break;
|
|
8458
|
+
default:
|
|
8459
|
+
warn(`Unrecognized drawing path operator: ${path[i - 1]}`);
|
|
8460
|
+
break;
|
|
8461
|
+
}
|
|
8462
|
+
}
|
|
8463
|
+
path = path2d;
|
|
8549
8464
|
}
|
|
8550
|
-
current.
|
|
8465
|
+
this.current.updateRectMinMax(getCurrentTransform(this.ctx), minMax);
|
|
8466
|
+
this[op](path);
|
|
8551
8467
|
}
|
|
8552
8468
|
closePath() {
|
|
8553
8469
|
this.ctx.closePath();
|
|
8554
8470
|
}
|
|
8555
|
-
stroke(consumePath = true) {
|
|
8471
|
+
stroke(path, consumePath = true) {
|
|
8556
8472
|
const ctx = this.ctx;
|
|
8557
8473
|
const strokeColor = this.current.strokeColor;
|
|
8558
8474
|
ctx.globalAlpha = this.current.strokeAlpha;
|
|
8559
8475
|
if (this.contentVisible) {
|
|
8560
8476
|
if (typeof strokeColor === "object" && strokeColor?.getPattern) {
|
|
8477
|
+
const baseTransform = strokeColor.isModifyingCurrentTransform() ? ctx.getTransform() : null;
|
|
8561
8478
|
ctx.save();
|
|
8562
8479
|
ctx.strokeStyle = strokeColor.getPattern(
|
|
8563
8480
|
ctx,
|
|
@@ -8565,33 +8482,49 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
8565
8482
|
getCurrentTransformInverse(ctx),
|
|
8566
8483
|
PathType.STROKE
|
|
8567
8484
|
);
|
|
8485
|
+
if (baseTransform) {
|
|
8486
|
+
const newPath = new SvgPath2D();
|
|
8487
|
+
newPath.addPath(
|
|
8488
|
+
path,
|
|
8489
|
+
ctx.getTransform().invertSelf().multiplySelf(baseTransform)
|
|
8490
|
+
);
|
|
8491
|
+
path = newPath;
|
|
8492
|
+
}
|
|
8568
8493
|
this.rescaleAndStroke(
|
|
8494
|
+
path,
|
|
8569
8495
|
/* saveRestore */
|
|
8570
8496
|
false
|
|
8571
8497
|
);
|
|
8572
8498
|
ctx.restore();
|
|
8573
8499
|
} else {
|
|
8574
8500
|
this.rescaleAndStroke(
|
|
8501
|
+
path,
|
|
8575
8502
|
/* saveRestore */
|
|
8576
8503
|
true
|
|
8577
8504
|
);
|
|
8578
8505
|
}
|
|
8579
8506
|
}
|
|
8580
8507
|
if (consumePath) {
|
|
8581
|
-
this.consumePath(
|
|
8508
|
+
this.consumePath(
|
|
8509
|
+
path,
|
|
8510
|
+
this.current.getClippedPathBoundingBox(
|
|
8511
|
+
PathType.STROKE,
|
|
8512
|
+
getCurrentTransform(this.ctx)
|
|
8513
|
+
)
|
|
8514
|
+
);
|
|
8582
8515
|
}
|
|
8583
8516
|
ctx.globalAlpha = this.current.fillAlpha;
|
|
8584
8517
|
}
|
|
8585
|
-
closeStroke() {
|
|
8586
|
-
this.
|
|
8587
|
-
this.stroke();
|
|
8518
|
+
closeStroke(path) {
|
|
8519
|
+
this.stroke(path);
|
|
8588
8520
|
}
|
|
8589
|
-
fill(consumePath = true) {
|
|
8521
|
+
fill(path, consumePath = true) {
|
|
8590
8522
|
const ctx = this.ctx;
|
|
8591
8523
|
const fillColor = this.current.fillColor;
|
|
8592
8524
|
const isPatternFill = this.current.patternFill;
|
|
8593
8525
|
let needRestore = false;
|
|
8594
8526
|
if (isPatternFill) {
|
|
8527
|
+
const baseTransform = fillColor.isModifyingCurrentTransform() ? ctx.getTransform() : null;
|
|
8595
8528
|
ctx.save();
|
|
8596
8529
|
ctx.fillStyle = fillColor.getPattern(
|
|
8597
8530
|
ctx,
|
|
@@ -8599,48 +8532,54 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
8599
8532
|
getCurrentTransformInverse(ctx),
|
|
8600
8533
|
PathType.FILL
|
|
8601
8534
|
);
|
|
8535
|
+
if (baseTransform) {
|
|
8536
|
+
const newPath = new SvgPath2D();
|
|
8537
|
+
newPath.addPath(
|
|
8538
|
+
path,
|
|
8539
|
+
ctx.getTransform().invertSelf().multiplySelf(baseTransform)
|
|
8540
|
+
);
|
|
8541
|
+
path = newPath;
|
|
8542
|
+
}
|
|
8602
8543
|
needRestore = true;
|
|
8603
8544
|
}
|
|
8604
8545
|
const intersect = this.current.getClippedPathBoundingBox();
|
|
8605
8546
|
if (this.contentVisible && intersect !== null) {
|
|
8606
8547
|
if (this.pendingEOFill) {
|
|
8607
|
-
ctx.fill("evenodd");
|
|
8548
|
+
ctx.fill(path, "evenodd");
|
|
8608
8549
|
this.pendingEOFill = false;
|
|
8609
8550
|
} else {
|
|
8610
|
-
ctx.fill();
|
|
8551
|
+
ctx.fill(path);
|
|
8611
8552
|
}
|
|
8612
8553
|
}
|
|
8613
8554
|
if (needRestore) {
|
|
8614
8555
|
ctx.restore();
|
|
8615
8556
|
}
|
|
8616
8557
|
if (consumePath) {
|
|
8617
|
-
this.consumePath(intersect);
|
|
8558
|
+
this.consumePath(path, intersect);
|
|
8618
8559
|
}
|
|
8619
8560
|
}
|
|
8620
|
-
eoFill() {
|
|
8561
|
+
eoFill(path) {
|
|
8621
8562
|
this.pendingEOFill = true;
|
|
8622
|
-
this.fill();
|
|
8563
|
+
this.fill(path);
|
|
8623
8564
|
}
|
|
8624
|
-
fillStroke() {
|
|
8625
|
-
this.fill(false);
|
|
8626
|
-
this.stroke(false);
|
|
8627
|
-
this.consumePath();
|
|
8565
|
+
fillStroke(path) {
|
|
8566
|
+
this.fill(path, false);
|
|
8567
|
+
this.stroke(path, false);
|
|
8568
|
+
this.consumePath(path);
|
|
8628
8569
|
}
|
|
8629
|
-
eoFillStroke() {
|
|
8570
|
+
eoFillStroke(path) {
|
|
8630
8571
|
this.pendingEOFill = true;
|
|
8631
|
-
this.fillStroke();
|
|
8572
|
+
this.fillStroke(path);
|
|
8632
8573
|
}
|
|
8633
|
-
closeFillStroke() {
|
|
8634
|
-
this.
|
|
8635
|
-
this.fillStroke();
|
|
8574
|
+
closeFillStroke(path) {
|
|
8575
|
+
this.fillStroke(path);
|
|
8636
8576
|
}
|
|
8637
|
-
closeEOFillStroke() {
|
|
8577
|
+
closeEOFillStroke(path) {
|
|
8638
8578
|
this.pendingEOFill = true;
|
|
8639
|
-
this.
|
|
8640
|
-
this.fillStroke();
|
|
8579
|
+
this.fillStroke(path);
|
|
8641
8580
|
}
|
|
8642
|
-
endPath() {
|
|
8643
|
-
this.consumePath();
|
|
8581
|
+
endPath(path) {
|
|
8582
|
+
this.consumePath(path);
|
|
8644
8583
|
}
|
|
8645
8584
|
// Clipping
|
|
8646
8585
|
clip() {
|
|
@@ -9032,9 +8971,7 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
9032
8971
|
const operatorList = font.charProcOperatorList[glyph.operatorListId];
|
|
9033
8972
|
if (!operatorList) {
|
|
9034
8973
|
warn(`Type3 character "${glyph.operatorListId}" is not available.`);
|
|
9035
|
-
|
|
9036
|
-
}
|
|
9037
|
-
if (this.contentVisible) {
|
|
8974
|
+
} else if (this.contentVisible) {
|
|
9038
8975
|
this.processingType3 = glyph;
|
|
9039
8976
|
this.save();
|
|
9040
8977
|
ctx.scale(fontSize, fontSize);
|
|
@@ -9062,7 +8999,6 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
9062
8999
|
getColorN_Pattern(IR) {
|
|
9063
9000
|
let pattern;
|
|
9064
9001
|
if (IR[0] === "TilingPattern") {
|
|
9065
|
-
const color = IR[1];
|
|
9066
9002
|
const baseTransform = this.baseTransform || getCurrentTransform(this.ctx);
|
|
9067
9003
|
const canvasGraphicsFactory = {
|
|
9068
9004
|
createCanvasGraphics: (ctx) => new _CanvasGraphics(
|
|
@@ -9079,7 +9015,6 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
9079
9015
|
};
|
|
9080
9016
|
pattern = new TilingPattern(
|
|
9081
9017
|
IR,
|
|
9082
|
-
color,
|
|
9083
9018
|
this.ctx,
|
|
9084
9019
|
canvasGraphicsFactory,
|
|
9085
9020
|
baseTransform
|
|
@@ -9241,6 +9176,15 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
9241
9176
|
const groupCtx = scratchCanvas.context;
|
|
9242
9177
|
groupCtx.translate(-offsetX, -offsetY);
|
|
9243
9178
|
groupCtx.transform(...currentTransform);
|
|
9179
|
+
let clip = new SvgPath2D();
|
|
9180
|
+
const [x0, y0, x1, y1] = group.bbox;
|
|
9181
|
+
clip.rect(x0, y0, x1 - x0, y1 - y0);
|
|
9182
|
+
if (group.matrix) {
|
|
9183
|
+
const path = new SvgPath2D();
|
|
9184
|
+
path.addPath(clip, new DOMMatrix(group.matrix));
|
|
9185
|
+
clip = path;
|
|
9186
|
+
}
|
|
9187
|
+
groupCtx.clip(clip);
|
|
9244
9188
|
if (group.smask) {
|
|
9245
9189
|
this.smaskStack.push({
|
|
9246
9190
|
canvas: scratchCanvas.canvas,
|
|
@@ -9373,7 +9317,7 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
9373
9317
|
glyph.compiled = compileType3Glyph(img);
|
|
9374
9318
|
}
|
|
9375
9319
|
if (glyph.compiled) {
|
|
9376
|
-
glyph.compiled
|
|
9320
|
+
ctx.fill(glyph.compiled);
|
|
9377
9321
|
return;
|
|
9378
9322
|
}
|
|
9379
9323
|
}
|
|
@@ -9650,7 +9594,7 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
9650
9594
|
endCompat() {
|
|
9651
9595
|
}
|
|
9652
9596
|
// Helper functions
|
|
9653
|
-
consumePath(clipBox) {
|
|
9597
|
+
consumePath(path, clipBox) {
|
|
9654
9598
|
const isEmpty = this.current.isEmptyClip();
|
|
9655
9599
|
if (this.pendingClip) {
|
|
9656
9600
|
this.current.updateClipFromPath();
|
|
@@ -9662,9 +9606,9 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
9662
9606
|
if (this.pendingClip) {
|
|
9663
9607
|
if (!isEmpty) {
|
|
9664
9608
|
if (this.pendingClip === EO_CLIP) {
|
|
9665
|
-
ctx.clip("evenodd");
|
|
9609
|
+
ctx.clip(path, "evenodd");
|
|
9666
9610
|
} else {
|
|
9667
|
-
ctx.clip();
|
|
9611
|
+
ctx.clip(path);
|
|
9668
9612
|
}
|
|
9669
9613
|
}
|
|
9670
9614
|
this.pendingClip = null;
|
|
@@ -9730,13 +9674,15 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
9730
9674
|
}
|
|
9731
9675
|
// Rescale before stroking in order to have a final lineWidth
|
|
9732
9676
|
// with both thicknesses greater or equal to 1.
|
|
9733
|
-
rescaleAndStroke(saveRestore) {
|
|
9734
|
-
const {
|
|
9735
|
-
|
|
9677
|
+
rescaleAndStroke(path, saveRestore) {
|
|
9678
|
+
const {
|
|
9679
|
+
ctx,
|
|
9680
|
+
current: { lineWidth }
|
|
9681
|
+
} = this;
|
|
9736
9682
|
const [scaleX, scaleY] = this.getScaleForStroking();
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
ctx.stroke();
|
|
9683
|
+
if (scaleX === scaleY) {
|
|
9684
|
+
ctx.lineWidth = (lineWidth || 1) * scaleX;
|
|
9685
|
+
ctx.stroke(path);
|
|
9740
9686
|
return;
|
|
9741
9687
|
}
|
|
9742
9688
|
const dashes = ctx.getLineDash();
|
|
@@ -9744,12 +9690,17 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
9744
9690
|
ctx.save();
|
|
9745
9691
|
}
|
|
9746
9692
|
ctx.scale(scaleX, scaleY);
|
|
9693
|
+
SCALE_MATRIX.a = 1 / scaleX;
|
|
9694
|
+
SCALE_MATRIX.d = 1 / scaleY;
|
|
9695
|
+
const newPath = new SvgPath2D();
|
|
9696
|
+
newPath.addPath(path, SCALE_MATRIX);
|
|
9747
9697
|
if (dashes.length > 0) {
|
|
9748
9698
|
const scale = Math.max(scaleX, scaleY);
|
|
9749
9699
|
ctx.setLineDash(dashes.map((x) => x / scale));
|
|
9750
9700
|
ctx.lineDashOffset /= scale;
|
|
9751
9701
|
}
|
|
9752
|
-
ctx.
|
|
9702
|
+
ctx.lineWidth = lineWidth || 1;
|
|
9703
|
+
ctx.stroke(newPath);
|
|
9753
9704
|
if (saveRestore) {
|
|
9754
9705
|
ctx.restore();
|
|
9755
9706
|
}
|
|
@@ -11452,7 +11403,7 @@ var _TextLayer = class _TextLayer {
|
|
|
11452
11403
|
throw new Error('No "textContentSource" parameter specified.');
|
|
11453
11404
|
}
|
|
11454
11405
|
__privateSet(this, _container3, __privateSet(this, _rootContainer, container));
|
|
11455
|
-
__privateSet(this, _scale, viewport.scale *
|
|
11406
|
+
__privateSet(this, _scale, viewport.scale * OutputScale.pixelRatio);
|
|
11456
11407
|
__privateSet(this, _rotation, viewport.rotation);
|
|
11457
11408
|
__privateSet(this, _layoutTextParams, {
|
|
11458
11409
|
div: null,
|
|
@@ -11530,7 +11481,7 @@ var _TextLayer = class _TextLayer {
|
|
|
11530
11481
|
*/
|
|
11531
11482
|
update({ viewport, onBefore = null }) {
|
|
11532
11483
|
var _a2;
|
|
11533
|
-
const scale = viewport.scale *
|
|
11484
|
+
const scale = viewport.scale * OutputScale.pixelRatio;
|
|
11534
11485
|
const rotation = viewport.rotation;
|
|
11535
11486
|
if (rotation !== __privateGet(this, _rotation)) {
|
|
11536
11487
|
onBefore?.();
|
|
@@ -11910,6 +11861,7 @@ function getDocument(src = {}) {
|
|
|
11910
11861
|
const cMapUrl = getFactoryUrlProp(src.cMapUrl);
|
|
11911
11862
|
const cMapPacked = src.cMapPacked !== false;
|
|
11912
11863
|
const CMapReaderFactory = src.CMapReaderFactory || (isNodeJS ? NodeCMapReaderFactory : DOMCMapReaderFactory);
|
|
11864
|
+
const iccUrl = getFactoryUrlProp(src.iccUrl);
|
|
11913
11865
|
const standardFontDataUrl = getFactoryUrlProp(src.standardFontDataUrl);
|
|
11914
11866
|
const StandardFontDataFactory2 = src.StandardFontDataFactory || (isNodeJS ? NodeStandardFontDataFactory : DOMStandardFontDataFactory);
|
|
11915
11867
|
const wasmUrl = getFactoryUrlProp(src.wasmUrl);
|
|
@@ -11981,6 +11933,7 @@ function getDocument(src = {}) {
|
|
|
11981
11933
|
useWasm,
|
|
11982
11934
|
useWorkerFetch,
|
|
11983
11935
|
cMapUrl,
|
|
11936
|
+
iccUrl,
|
|
11984
11937
|
standardFontDataUrl,
|
|
11985
11938
|
wasmUrl
|
|
11986
11939
|
}
|
|
@@ -12114,19 +12067,54 @@ function getFactoryUrlProp(val) {
|
|
|
12114
12067
|
}
|
|
12115
12068
|
throw new Error(`Invalid factory url: "${val}" must include trailing slash.`);
|
|
12116
12069
|
}
|
|
12117
|
-
|
|
12118
|
-
|
|
12119
|
-
|
|
12070
|
+
var isRefProxy = (v) => typeof v === "object" && Number.isInteger(v?.num) && v.num >= 0 && Number.isInteger(v?.gen) && v.gen >= 0;
|
|
12071
|
+
var isNameProxy = (v) => typeof v === "object" && typeof v?.name === "string";
|
|
12072
|
+
var isValidExplicitDest = _isValidExplicitDest.bind(
|
|
12073
|
+
null,
|
|
12074
|
+
/* validRef = */
|
|
12075
|
+
isRefProxy,
|
|
12076
|
+
/* validName = */
|
|
12077
|
+
isNameProxy
|
|
12078
|
+
);
|
|
12120
12079
|
var _docId2;
|
|
12121
12080
|
var _PDFDocumentLoadingTask = class _PDFDocumentLoadingTask {
|
|
12122
12081
|
constructor() {
|
|
12123
|
-
|
|
12124
|
-
|
|
12125
|
-
|
|
12126
|
-
this
|
|
12127
|
-
|
|
12128
|
-
|
|
12129
|
-
|
|
12082
|
+
/**
|
|
12083
|
+
* @private
|
|
12084
|
+
*/
|
|
12085
|
+
__publicField(this, "_capability", Promise.withResolvers());
|
|
12086
|
+
/**
|
|
12087
|
+
* @private
|
|
12088
|
+
*/
|
|
12089
|
+
__publicField(this, "_transport", null);
|
|
12090
|
+
/**
|
|
12091
|
+
* @private
|
|
12092
|
+
*/
|
|
12093
|
+
__publicField(this, "_worker", null);
|
|
12094
|
+
/**
|
|
12095
|
+
* Unique identifier for the document loading task.
|
|
12096
|
+
* @type {string}
|
|
12097
|
+
*/
|
|
12098
|
+
__publicField(this, "docId", `d${__privateWrapper(_PDFDocumentLoadingTask, _docId2)._++}`);
|
|
12099
|
+
/**
|
|
12100
|
+
* Whether the loading task is destroyed or not.
|
|
12101
|
+
* @type {boolean}
|
|
12102
|
+
*/
|
|
12103
|
+
__publicField(this, "destroyed", false);
|
|
12104
|
+
/**
|
|
12105
|
+
* Callback to request a password if a wrong or no password was provided.
|
|
12106
|
+
* The callback receives two parameters: a function that should be called
|
|
12107
|
+
* with the new password, and a reason (see {@link PasswordResponses}).
|
|
12108
|
+
* @type {function}
|
|
12109
|
+
*/
|
|
12110
|
+
__publicField(this, "onPassword", null);
|
|
12111
|
+
/**
|
|
12112
|
+
* Callback to be able to monitor the loading progress of the PDF file
|
|
12113
|
+
* (necessary to implement e.g. a loading bar).
|
|
12114
|
+
* The callback receives an {@link OnProgressParameters} argument.
|
|
12115
|
+
* @type {function}
|
|
12116
|
+
*/
|
|
12117
|
+
__publicField(this, "onProgress", null);
|
|
12130
12118
|
}
|
|
12131
12119
|
/**
|
|
12132
12120
|
* Promise for document loading task completion.
|
|
@@ -12161,6 +12149,15 @@ var _PDFDocumentLoadingTask = class _PDFDocumentLoadingTask {
|
|
|
12161
12149
|
this._worker?.destroy();
|
|
12162
12150
|
this._worker = null;
|
|
12163
12151
|
}
|
|
12152
|
+
/**
|
|
12153
|
+
* Attempt to fetch the raw data of the PDF document, when e.g.
|
|
12154
|
+
* - An exception was thrown during document initialization.
|
|
12155
|
+
* - An `onPassword` callback is delaying initialization.
|
|
12156
|
+
* @returns {Promise<Uint8Array>}
|
|
12157
|
+
*/
|
|
12158
|
+
async getData() {
|
|
12159
|
+
return this._transport.getData();
|
|
12160
|
+
}
|
|
12164
12161
|
};
|
|
12165
12162
|
_docId2 = new WeakMap();
|
|
12166
12163
|
__privateAdd(_PDFDocumentLoadingTask, _docId2, 0);
|
|
@@ -13337,6 +13334,7 @@ var _PDFWorker = class _PDFWorker {
|
|
|
13337
13334
|
}
|
|
13338
13335
|
/**
|
|
13339
13336
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
13337
|
+
* @returns {PDFWorker}
|
|
13340
13338
|
*/
|
|
13341
13339
|
static fromPort(params) {
|
|
13342
13340
|
if (false) {
|
|
@@ -13372,7 +13370,7 @@ var _PDFWorker = class _PDFWorker {
|
|
|
13372
13370
|
if (__privateGet(this, _PDFWorker_static, mainThreadWorkerMessageHandler_get)) {
|
|
13373
13371
|
return __privateGet(this, _PDFWorker_static, mainThreadWorkerMessageHandler_get);
|
|
13374
13372
|
}
|
|
13375
|
-
const worker = true ? await import("./worker.js") : await
|
|
13373
|
+
const worker = true ? await import("./worker.js") : await __raw_import__(this.workerSrc);
|
|
13376
13374
|
return worker.WorkerMessageHandler;
|
|
13377
13375
|
};
|
|
13378
13376
|
return shadow(this, "_setupFakeWorkerGlobal", loader());
|
|
@@ -17901,7 +17899,7 @@ var _FreeTextEditor = class _FreeTextEditor extends AnnotationEditor {
|
|
|
17901
17899
|
__privateSet(this, _content, `${bufferBefore.join("\n")}${paste}${bufferAfter.join("\n")}`);
|
|
17902
17900
|
__privateMethod(this, _FreeTextEditor_instances, setContent_fn).call(this);
|
|
17903
17901
|
const newRange = new Range();
|
|
17904
|
-
let beforeLength = bufferBefore.
|
|
17902
|
+
let beforeLength = Math.sumPrecise(bufferBefore.map((line) => line.length));
|
|
17905
17903
|
for (const { firstChild } of this.editorDiv.childNodes) {
|
|
17906
17904
|
if (firstChild.nodeType === Node.TEXT_NODE) {
|
|
17907
17905
|
const length = firstChild.nodeValue.length;
|
|
@@ -18751,35 +18749,24 @@ computeMinMax_fn = function(isLTR) {
|
|
|
18751
18749
|
const outline = __privateGet(this, _outline);
|
|
18752
18750
|
let lastX = outline[4];
|
|
18753
18751
|
let lastY = outline[5];
|
|
18754
|
-
|
|
18755
|
-
let minY = lastY;
|
|
18756
|
-
let maxX = lastX;
|
|
18757
|
-
let maxY = lastY;
|
|
18752
|
+
const minMax = [lastX, lastY, lastX, lastY];
|
|
18758
18753
|
let lastPointX = lastX;
|
|
18759
18754
|
let lastPointY = lastY;
|
|
18760
18755
|
const ltrCallback = isLTR ? Math.max : Math.min;
|
|
18761
18756
|
for (let i = 6, ii = outline.length; i < ii; i += 6) {
|
|
18757
|
+
const x = outline[i + 4], y = outline[i + 5];
|
|
18762
18758
|
if (isNaN(outline[i])) {
|
|
18763
|
-
|
|
18764
|
-
|
|
18765
|
-
|
|
18766
|
-
|
|
18767
|
-
if (lastPointY
|
|
18768
|
-
lastPointX =
|
|
18769
|
-
lastPointY = outline[i + 5];
|
|
18770
|
-
} else if (lastPointY === outline[i + 5]) {
|
|
18771
|
-
lastPointX = ltrCallback(lastPointX, outline[i + 4]);
|
|
18759
|
+
Util.pointBoundingBox(x, y, minMax);
|
|
18760
|
+
if (lastPointY < y) {
|
|
18761
|
+
lastPointX = x;
|
|
18762
|
+
lastPointY = y;
|
|
18763
|
+
} else if (lastPointY === y) {
|
|
18764
|
+
lastPointX = ltrCallback(lastPointX, x);
|
|
18772
18765
|
}
|
|
18773
18766
|
} else {
|
|
18774
|
-
const bbox2 =
|
|
18775
|
-
|
|
18776
|
-
|
|
18777
|
-
...outline.slice(i, i + 6)
|
|
18778
|
-
);
|
|
18779
|
-
minX = Math.min(minX, bbox2[0]);
|
|
18780
|
-
minY = Math.min(minY, bbox2[1]);
|
|
18781
|
-
maxX = Math.max(maxX, bbox2[2]);
|
|
18782
|
-
maxY = Math.max(maxY, bbox2[3]);
|
|
18767
|
+
const bbox2 = [Infinity, Infinity, -Infinity, -Infinity];
|
|
18768
|
+
Util.bezierBoundingBox(lastX, lastY, ...outline.slice(i, i + 6), bbox2);
|
|
18769
|
+
Util.rectBoundingBox(...bbox2, minMax);
|
|
18783
18770
|
if (lastPointY < bbox2[3]) {
|
|
18784
18771
|
lastPointX = bbox2[2];
|
|
18785
18772
|
lastPointY = bbox2[3];
|
|
@@ -18787,14 +18774,14 @@ computeMinMax_fn = function(isLTR) {
|
|
|
18787
18774
|
lastPointX = ltrCallback(lastPointX, bbox2[2]);
|
|
18788
18775
|
}
|
|
18789
18776
|
}
|
|
18790
|
-
lastX =
|
|
18791
|
-
lastY =
|
|
18777
|
+
lastX = x;
|
|
18778
|
+
lastY = y;
|
|
18792
18779
|
}
|
|
18793
18780
|
const bbox = __privateGet(this, _bbox);
|
|
18794
|
-
bbox[0] =
|
|
18795
|
-
bbox[1] =
|
|
18796
|
-
bbox[2] =
|
|
18797
|
-
bbox[3] =
|
|
18781
|
+
bbox[0] = minMax[0] - __privateGet(this, _innerMargin2);
|
|
18782
|
+
bbox[1] = minMax[1] - __privateGet(this, _innerMargin2);
|
|
18783
|
+
bbox[2] = minMax[2] - minMax[0] + 2 * __privateGet(this, _innerMargin2);
|
|
18784
|
+
bbox[3] = minMax[3] - minMax[1] + 2 * __privateGet(this, _innerMargin2);
|
|
18798
18785
|
this.lastPoint = [lastPointX, lastPointY];
|
|
18799
18786
|
};
|
|
18800
18787
|
|
|
@@ -18819,10 +18806,7 @@ var HighlightOutliner = class {
|
|
|
18819
18806
|
__privateAdd(this, _lastPoint);
|
|
18820
18807
|
__privateAdd(this, _verticalEdges, []);
|
|
18821
18808
|
__privateAdd(this, _intervals, []);
|
|
18822
|
-
|
|
18823
|
-
let maxX = -Infinity;
|
|
18824
|
-
let minY = Infinity;
|
|
18825
|
-
let maxY = -Infinity;
|
|
18809
|
+
const minMax = [Infinity, Infinity, -Infinity, -Infinity];
|
|
18826
18810
|
const NUMBER_OF_DIGITS = 4;
|
|
18827
18811
|
const EPSILON = 10 ** -NUMBER_OF_DIGITS;
|
|
18828
18812
|
for (const { x, y, width, height } of boxes) {
|
|
@@ -18833,15 +18817,12 @@ var HighlightOutliner = class {
|
|
|
18833
18817
|
const left = [x1, y1, y2, true];
|
|
18834
18818
|
const right = [x2, y1, y2, false];
|
|
18835
18819
|
__privateGet(this, _verticalEdges).push(left, right);
|
|
18836
|
-
|
|
18837
|
-
|
|
18838
|
-
|
|
18839
|
-
|
|
18840
|
-
|
|
18841
|
-
const
|
|
18842
|
-
const bboxHeight = maxY - minY + 2 * innerMargin;
|
|
18843
|
-
const shiftedMinX = minX - innerMargin;
|
|
18844
|
-
const shiftedMinY = minY - innerMargin;
|
|
18820
|
+
Util.rectBoundingBox(x1, y1, x2, y2, minMax);
|
|
18821
|
+
}
|
|
18822
|
+
const bboxWidth = minMax[2] - minMax[0] + 2 * innerMargin;
|
|
18823
|
+
const bboxHeight = minMax[3] - minMax[1] + 2 * innerMargin;
|
|
18824
|
+
const shiftedMinX = minMax[0] - innerMargin;
|
|
18825
|
+
const shiftedMinY = minMax[1] - innerMargin;
|
|
18845
18826
|
const lastEdge = __privateGet(this, _verticalEdges).at(isLTR ? -1 : -2);
|
|
18846
18827
|
const lastPoint = [lastEdge[0], lastEdge[2]];
|
|
18847
18828
|
for (const edge of __privateGet(this, _verticalEdges)) {
|
|
@@ -19370,6 +19351,7 @@ var _HighlightEditor = class _HighlightEditor extends AnnotationEditor {
|
|
|
19370
19351
|
__privateSet(this, _methodOfCreation, params.methodOfCreation || "");
|
|
19371
19352
|
__privateSet(this, _text, params.text || "");
|
|
19372
19353
|
this._isDraggable = false;
|
|
19354
|
+
this.defaultL10nId = "pdfjs-editor-highlight-editor";
|
|
19373
19355
|
if (params.highlightId > -1) {
|
|
19374
19356
|
__privateSet(this, _isFreeHighlight, true);
|
|
19375
19357
|
__privateMethod(this, _HighlightEditor_instances, createFreeOutlines_fn).call(this, params);
|
|
@@ -19884,6 +19866,7 @@ var _HighlightEditor = class _HighlightEditor extends AnnotationEditor {
|
|
|
19884
19866
|
clipPathId
|
|
19885
19867
|
});
|
|
19886
19868
|
__privateMethod(_d = editor, _HighlightEditor_instances, addToDrawLayer_fn).call(_d);
|
|
19869
|
+
editor.rotate(editor.parentRotation);
|
|
19887
19870
|
}
|
|
19888
19871
|
return editor;
|
|
19889
19872
|
}
|
|
@@ -21793,11 +21776,7 @@ computeBbox_fn = function() {
|
|
|
21793
21776
|
for (const { line } of __privateGet(this, _lines2)) {
|
|
21794
21777
|
if (line.length <= 12) {
|
|
21795
21778
|
for (let i = 4, ii = line.length; i < ii; i += 6) {
|
|
21796
|
-
|
|
21797
|
-
bbox[0] = Math.min(bbox[0], x);
|
|
21798
|
-
bbox[1] = Math.min(bbox[1], y);
|
|
21799
|
-
bbox[2] = Math.max(bbox[2], x);
|
|
21800
|
-
bbox[3] = Math.max(bbox[3], y);
|
|
21779
|
+
Util.pointBoundingBox(line[i], line[i + 1], bbox);
|
|
21801
21780
|
}
|
|
21802
21781
|
continue;
|
|
21803
21782
|
}
|
|
@@ -21810,10 +21789,10 @@ computeBbox_fn = function() {
|
|
|
21810
21789
|
}
|
|
21811
21790
|
}
|
|
21812
21791
|
const [marginX, marginY] = __privateMethod(this, _InkDrawOutline_instances, getMarginComponents_fn).call(this);
|
|
21813
|
-
bbox[0] =
|
|
21814
|
-
bbox[1] =
|
|
21815
|
-
bbox[2] =
|
|
21816
|
-
bbox[3] =
|
|
21792
|
+
bbox[0] = MathClamp(bbox[0] - marginX, 0, 1);
|
|
21793
|
+
bbox[1] = MathClamp(bbox[1] - marginY, 0, 1);
|
|
21794
|
+
bbox[2] = MathClamp(bbox[2] + marginX, 0, 1);
|
|
21795
|
+
bbox[3] = MathClamp(bbox[3] + marginY, 0, 1);
|
|
21817
21796
|
bbox[2] -= bbox[0];
|
|
21818
21797
|
bbox[3] -= bbox[1];
|
|
21819
21798
|
};
|
|
@@ -21867,6 +21846,7 @@ var _InkEditor = class _InkEditor extends DrawingEditor {
|
|
|
21867
21846
|
super({ ...params, name: "inkEditor" });
|
|
21868
21847
|
__privateAdd(this, _InkEditor_instances);
|
|
21869
21848
|
this._willKeepAspectRatio = true;
|
|
21849
|
+
this.defaultL10nId = "pdfjs-editor-ink-editor";
|
|
21870
21850
|
}
|
|
21871
21851
|
/** @inheritdoc */
|
|
21872
21852
|
static initialize(l10n, uiManager) {
|
|
@@ -22760,6 +22740,7 @@ var _SignatureEditor = class _SignatureEditor extends DrawingEditor {
|
|
|
22760
22740
|
this._willKeepAspectRatio = true;
|
|
22761
22741
|
__privateSet(this, _signatureData, params.signatureData || null);
|
|
22762
22742
|
__privateSet(this, _description, null);
|
|
22743
|
+
this.defaultL10nId = "pdfjs-editor-signature-editor1";
|
|
22763
22744
|
}
|
|
22764
22745
|
/** @inheritdoc */
|
|
22765
22746
|
static initialize(l10n, uiManager) {
|
|
@@ -22823,7 +22804,6 @@ var _SignatureEditor = class _SignatureEditor extends DrawingEditor {
|
|
|
22823
22804
|
baseY = this.y;
|
|
22824
22805
|
}
|
|
22825
22806
|
super.render();
|
|
22826
|
-
this.div.setAttribute("role", "figure");
|
|
22827
22807
|
if (this._drawId === null) {
|
|
22828
22808
|
if (__privateGet(this, _signatureData)) {
|
|
22829
22809
|
const {
|
|
@@ -22849,6 +22829,10 @@ var _SignatureEditor = class _SignatureEditor extends DrawingEditor {
|
|
|
22849
22829
|
});
|
|
22850
22830
|
this.addSignature(outline, heightInPage, description, uuid);
|
|
22851
22831
|
} else {
|
|
22832
|
+
this.div.setAttribute(
|
|
22833
|
+
"data-l10n-args",
|
|
22834
|
+
JSON.stringify({ description: "" })
|
|
22835
|
+
);
|
|
22852
22836
|
this.div.hidden = true;
|
|
22853
22837
|
this._uiManager.getSignature(this);
|
|
22854
22838
|
}
|
|
@@ -22915,6 +22899,7 @@ var _SignatureEditor = class _SignatureEditor extends DrawingEditor {
|
|
|
22915
22899
|
const { outline } = __privateSet(this, _signatureData, data);
|
|
22916
22900
|
__privateSet(this, _isExtracted, outline instanceof ContourDrawOutline);
|
|
22917
22901
|
__privateSet(this, _description, description);
|
|
22902
|
+
this.div.setAttribute("data-l10n-args", JSON.stringify({ description }));
|
|
22918
22903
|
let drawingOptions;
|
|
22919
22904
|
if (__privateGet(this, _isExtracted)) {
|
|
22920
22905
|
drawingOptions = _SignatureEditor.getDefaultDrawingOptions();
|
|
@@ -23095,6 +23080,7 @@ var StampEditor = class extends AnnotationEditor {
|
|
|
23095
23080
|
__privateAdd(this, _hasBeenAddedInUndoStack, false);
|
|
23096
23081
|
__privateSet(this, _bitmapUrl, params.bitmapUrl);
|
|
23097
23082
|
__privateSet(this, _bitmapFile, params.bitmapFile);
|
|
23083
|
+
this.defaultL10nId = "pdfjs-editor-stamp-editor";
|
|
23098
23084
|
}
|
|
23099
23085
|
/** @inheritdoc */
|
|
23100
23086
|
static initialize(l10n, uiManager) {
|
|
@@ -23236,7 +23222,6 @@ var StampEditor = class extends AnnotationEditor {
|
|
|
23236
23222
|
}
|
|
23237
23223
|
super.render();
|
|
23238
23224
|
this.div.hidden = true;
|
|
23239
|
-
this.div.setAttribute("role", "figure");
|
|
23240
23225
|
this.addAltTextButton();
|
|
23241
23226
|
if (!__privateGet(this, _missingCanvas)) {
|
|
23242
23227
|
if (__privateGet(this, _bitmap)) {
|
|
@@ -23384,10 +23369,6 @@ var StampEditor = class extends AnnotationEditor {
|
|
|
23384
23369
|
return { canvas, width, height, imageData };
|
|
23385
23370
|
}
|
|
23386
23371
|
/** @inheritdoc */
|
|
23387
|
-
getImageForAltText() {
|
|
23388
|
-
return __privateGet(this, _canvas);
|
|
23389
|
-
}
|
|
23390
|
-
/** @inheritdoc */
|
|
23391
23372
|
static async deserialize(data, parent, uiManager) {
|
|
23392
23373
|
let initialData = null;
|
|
23393
23374
|
let missingCanvas = false;
|
|
@@ -23703,7 +23684,7 @@ createCanvas_fn = function() {
|
|
|
23703
23684
|
action: "inserted_image"
|
|
23704
23685
|
});
|
|
23705
23686
|
if (__privateGet(this, _bitmapFileName)) {
|
|
23706
|
-
|
|
23687
|
+
this.div.setAttribute("aria-description", __privateGet(this, _bitmapFileName));
|
|
23707
23688
|
}
|
|
23708
23689
|
};
|
|
23709
23690
|
scaleBitmap_fn = function(width, height) {
|
|
@@ -26521,6 +26502,7 @@ export {
|
|
|
26521
26502
|
GlobalWorkerOptions,
|
|
26522
26503
|
ImageKind,
|
|
26523
26504
|
InvalidPDFException,
|
|
26505
|
+
MathClamp,
|
|
26524
26506
|
OPS,
|
|
26525
26507
|
OutputScale,
|
|
26526
26508
|
PDFDataRangeTransport,
|
|
@@ -26587,6 +26569,7 @@ export {
|
|
|
26587
26569
|
isThreeDAnnotation,
|
|
26588
26570
|
isTrapNetAnnotation,
|
|
26589
26571
|
isUnderlineAnnotation,
|
|
26572
|
+
isValidExplicitDest,
|
|
26590
26573
|
isWatermarkAnnotation,
|
|
26591
26574
|
isWidgetAnnotation,
|
|
26592
26575
|
loadDefaultFonts,
|