@chialab/pdfjs-lib 1.0.0-alpha.3 → 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 +330 -348
- 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 +330 -348
- 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 +4 -3
package/dist/browser/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-KKGFKVEF.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);
|
|
@@ -6037,6 +6071,9 @@ var BaseShadingPattern = class {
|
|
|
6037
6071
|
unreachable("Cannot initialize BaseShadingPattern.");
|
|
6038
6072
|
}
|
|
6039
6073
|
}
|
|
6074
|
+
isModifyingCurrentTransform() {
|
|
6075
|
+
return false;
|
|
6076
|
+
}
|
|
6040
6077
|
getPattern() {
|
|
6041
6078
|
unreachable("Abstract method `getPattern` called.");
|
|
6042
6079
|
}
|
|
@@ -6335,6 +6372,9 @@ var MeshShadingPattern = class extends BaseShadingPattern {
|
|
|
6335
6372
|
scaleY
|
|
6336
6373
|
};
|
|
6337
6374
|
}
|
|
6375
|
+
isModifyingCurrentTransform() {
|
|
6376
|
+
return true;
|
|
6377
|
+
}
|
|
6338
6378
|
getPattern(ctx, owner, inverse, pathType) {
|
|
6339
6379
|
applyBoundingBox(ctx, this._bbox);
|
|
6340
6380
|
let scale;
|
|
@@ -6387,7 +6427,8 @@ var PaintType = {
|
|
|
6387
6427
|
UNCOLORED: 2
|
|
6388
6428
|
};
|
|
6389
6429
|
var _TilingPattern = class _TilingPattern {
|
|
6390
|
-
constructor(IR,
|
|
6430
|
+
constructor(IR, ctx, canvasGraphicsFactory, baseTransform) {
|
|
6431
|
+
this.color = IR[1];
|
|
6391
6432
|
this.operatorList = IR[2];
|
|
6392
6433
|
this.matrix = IR[3];
|
|
6393
6434
|
this.bbox = IR[4];
|
|
@@ -6395,7 +6436,6 @@ var _TilingPattern = class _TilingPattern {
|
|
|
6395
6436
|
this.ystep = IR[6];
|
|
6396
6437
|
this.paintType = IR[7];
|
|
6397
6438
|
this.tilingType = IR[8];
|
|
6398
|
-
this.color = color;
|
|
6399
6439
|
this.ctx = ctx;
|
|
6400
6440
|
this.canvasGraphicsFactory = canvasGraphicsFactory;
|
|
6401
6441
|
this.baseTransform = baseTransform;
|
|
@@ -6567,6 +6607,9 @@ var _TilingPattern = class _TilingPattern {
|
|
|
6567
6607
|
throw new FormatError(`Unsupported paint type: ${paintType}`);
|
|
6568
6608
|
}
|
|
6569
6609
|
}
|
|
6610
|
+
isModifyingCurrentTransform() {
|
|
6611
|
+
return false;
|
|
6612
|
+
}
|
|
6570
6613
|
getPattern(ctx, owner, inverse, pathType) {
|
|
6571
6614
|
let matrix = inverse;
|
|
6572
6615
|
if (pathType !== PathType.SHADING) {
|
|
@@ -6601,6 +6644,7 @@ var EXECUTION_TIME = 15;
|
|
|
6601
6644
|
var EXECUTION_STEPS = 10;
|
|
6602
6645
|
var MAX_SIZE_TO_COMPILE = 1e3;
|
|
6603
6646
|
var FULL_CHUNK_HEIGHT = 16;
|
|
6647
|
+
var SCALE_MATRIX = new DOMMatrix();
|
|
6604
6648
|
function mirrorContextOperations(ctx, destCtx) {
|
|
6605
6649
|
if (ctx._removeMirroring) {
|
|
6606
6650
|
throw new Error("Context is already forwarding operations.");
|
|
@@ -6786,10 +6830,11 @@ function compileType3Glyph(imgData) {
|
|
|
6786
6830
|
0
|
|
6787
6831
|
]);
|
|
6788
6832
|
const width1 = width + 1;
|
|
6789
|
-
|
|
6833
|
+
const points = new Uint8Array(width1 * (height + 1));
|
|
6790
6834
|
let i, j, j0;
|
|
6791
6835
|
const lineSize = width + 7 & ~7;
|
|
6792
|
-
|
|
6836
|
+
const data = new Uint8Array(lineSize * height);
|
|
6837
|
+
let pos = 0;
|
|
6793
6838
|
for (const elem of imgData.data) {
|
|
6794
6839
|
let mask = 128;
|
|
6795
6840
|
while (mask > 0) {
|
|
@@ -6860,6 +6905,7 @@ function compileType3Glyph(imgData) {
|
|
|
6860
6905
|
}
|
|
6861
6906
|
const steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]);
|
|
6862
6907
|
const path = new SvgPath2D();
|
|
6908
|
+
const { a, b, c, d, e, f } = new DOMMatrix().scaleSelf(1 / width, -1 / height).translateSelf(0, -height);
|
|
6863
6909
|
for (i = 0; count && i <= height; i++) {
|
|
6864
6910
|
let p = i * width1;
|
|
6865
6911
|
const end = p + width;
|
|
@@ -6869,7 +6915,9 @@ function compileType3Glyph(imgData) {
|
|
|
6869
6915
|
if (p === end) {
|
|
6870
6916
|
continue;
|
|
6871
6917
|
}
|
|
6872
|
-
|
|
6918
|
+
let x = p % width1;
|
|
6919
|
+
let y = i;
|
|
6920
|
+
path.moveTo(a * x + c * y + e, b * x + d * y + f);
|
|
6873
6921
|
const p0 = p;
|
|
6874
6922
|
let type = points[p];
|
|
6875
6923
|
do {
|
|
@@ -6885,24 +6933,16 @@ function compileType3Glyph(imgData) {
|
|
|
6885
6933
|
type = pp & 51 * type >> 4;
|
|
6886
6934
|
points[p] &= type >> 2 | type << 2;
|
|
6887
6935
|
}
|
|
6888
|
-
|
|
6936
|
+
x = p % width1;
|
|
6937
|
+
y = p / width1 | 0;
|
|
6938
|
+
path.lineTo(a * x + c * y + e, b * x + d * y + f);
|
|
6889
6939
|
if (!points[p]) {
|
|
6890
6940
|
--count;
|
|
6891
6941
|
}
|
|
6892
6942
|
} while (p0 !== p);
|
|
6893
6943
|
--i;
|
|
6894
6944
|
}
|
|
6895
|
-
|
|
6896
|
-
points = null;
|
|
6897
|
-
const drawOutline = function(c) {
|
|
6898
|
-
c.save();
|
|
6899
|
-
c.scale(1 / width, -1 / height);
|
|
6900
|
-
c.translate(0, -height);
|
|
6901
|
-
c.fill(path);
|
|
6902
|
-
c.beginPath();
|
|
6903
|
-
c.restore();
|
|
6904
|
-
};
|
|
6905
|
-
return drawOutline;
|
|
6945
|
+
return path;
|
|
6906
6946
|
}
|
|
6907
6947
|
var CanvasExtraState = class {
|
|
6908
6948
|
constructor(width, height) {
|
|
@@ -6938,17 +6978,6 @@ var CanvasExtraState = class {
|
|
|
6938
6978
|
clone.clipBox = this.clipBox.slice();
|
|
6939
6979
|
return clone;
|
|
6940
6980
|
}
|
|
6941
|
-
setCurrentPoint(x, y) {
|
|
6942
|
-
this.x = x;
|
|
6943
|
-
this.y = y;
|
|
6944
|
-
}
|
|
6945
|
-
updatePathMinMax(transform, x, y) {
|
|
6946
|
-
[x, y] = Util.applyTransform([x, y], transform);
|
|
6947
|
-
this.minX = Math.min(this.minX, x);
|
|
6948
|
-
this.minY = Math.min(this.minY, y);
|
|
6949
|
-
this.maxX = Math.max(this.maxX, x);
|
|
6950
|
-
this.maxY = Math.max(this.maxY, y);
|
|
6951
|
-
}
|
|
6952
6981
|
updateRectMinMax(transform, rect) {
|
|
6953
6982
|
const p1 = Util.applyTransform(rect, transform);
|
|
6954
6983
|
const p2 = Util.applyTransform(rect.slice(2), transform);
|
|
@@ -6959,20 +6988,6 @@ var CanvasExtraState = class {
|
|
|
6959
6988
|
this.maxX = Math.max(this.maxX, p1[0], p2[0], p3[0], p4[0]);
|
|
6960
6989
|
this.maxY = Math.max(this.maxY, p1[1], p2[1], p3[1], p4[1]);
|
|
6961
6990
|
}
|
|
6962
|
-
updateScalingPathMinMax(transform, minMax) {
|
|
6963
|
-
Util.scaleMinMax(transform, minMax);
|
|
6964
|
-
this.minX = Math.min(this.minX, minMax[0]);
|
|
6965
|
-
this.minY = Math.min(this.minY, minMax[1]);
|
|
6966
|
-
this.maxX = Math.max(this.maxX, minMax[2]);
|
|
6967
|
-
this.maxY = Math.max(this.maxY, minMax[3]);
|
|
6968
|
-
}
|
|
6969
|
-
updateCurvePathMinMax(transform, x0, y0, x1, y1, x2, y2, x3, y3, minMax) {
|
|
6970
|
-
const box = Util.bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3, minMax);
|
|
6971
|
-
if (minMax) {
|
|
6972
|
-
return;
|
|
6973
|
-
}
|
|
6974
|
-
this.updateRectMinMax(transform, box);
|
|
6975
|
-
}
|
|
6976
6991
|
getPathBoundingBox(pathType = PathType.FILL, transform = null) {
|
|
6977
6992
|
const box = [this.minX, this.minY, this.maxX, this.maxY];
|
|
6978
6993
|
if (pathType === PathType.STROKE) {
|
|
@@ -7180,7 +7195,7 @@ function getImageSmoothingEnabled(transform, interpolate) {
|
|
|
7180
7195
|
scale[0] = Math.fround(scale[0]);
|
|
7181
7196
|
scale[1] = Math.fround(scale[1]);
|
|
7182
7197
|
const actualScale = Math.fround(
|
|
7183
|
-
|
|
7198
|
+
OutputScale.pixelRatio * PixelsPerInch.PDF_TO_CSS_UNITS
|
|
7184
7199
|
);
|
|
7185
7200
|
return scale[0] <= actualScale && scale[1] <= actualScale;
|
|
7186
7201
|
}
|
|
@@ -7550,8 +7565,7 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
7550
7565
|
this.current.strokeAlpha = value;
|
|
7551
7566
|
break;
|
|
7552
7567
|
case "ca":
|
|
7553
|
-
this.current.fillAlpha = value;
|
|
7554
|
-
this.ctx.globalAlpha = value;
|
|
7568
|
+
this.ctx.globalAlpha = this.current.fillAlpha = value;
|
|
7555
7569
|
break;
|
|
7556
7570
|
case "BM":
|
|
7557
7571
|
this.ctx.globalCompositeOperation = value;
|
|
@@ -7600,16 +7614,11 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
7600
7614
|
drawnHeight
|
|
7601
7615
|
);
|
|
7602
7616
|
this.suspendedCtx = this.ctx;
|
|
7603
|
-
this.ctx = scratchCanvas.context;
|
|
7604
|
-
|
|
7605
|
-
ctx.setTransform(...getCurrentTransform(this.suspendedCtx));
|
|
7617
|
+
const ctx = this.ctx = scratchCanvas.context;
|
|
7618
|
+
ctx.setTransform(this.suspendedCtx.getTransform());
|
|
7606
7619
|
copyCtxState(this.suspendedCtx, ctx);
|
|
7607
7620
|
mirrorContextOperations(ctx, this.suspendedCtx);
|
|
7608
|
-
this.setGState([
|
|
7609
|
-
["BM", "source-over"],
|
|
7610
|
-
["ca", 1],
|
|
7611
|
-
["CA", 1]
|
|
7612
|
-
]);
|
|
7621
|
+
this.setGState([["BM", "source-over"]]);
|
|
7613
7622
|
}
|
|
7614
7623
|
endSMaskMode() {
|
|
7615
7624
|
if (!this.inSMaskMode) {
|
|
@@ -7729,31 +7738,28 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
7729
7738
|
save() {
|
|
7730
7739
|
if (this.inSMaskMode) {
|
|
7731
7740
|
copyCtxState(this.ctx, this.suspendedCtx);
|
|
7732
|
-
this.suspendedCtx.save();
|
|
7733
|
-
} else {
|
|
7734
|
-
this.ctx.save();
|
|
7735
7741
|
}
|
|
7742
|
+
this.ctx.save();
|
|
7736
7743
|
const old = this.current;
|
|
7737
7744
|
this.stateStack.push(old);
|
|
7738
7745
|
this.current = old.clone();
|
|
7739
7746
|
}
|
|
7740
7747
|
restore() {
|
|
7741
|
-
if (this.stateStack.length === 0
|
|
7742
|
-
this.endSMaskMode();
|
|
7743
|
-
}
|
|
7744
|
-
if (this.stateStack.length !== 0) {
|
|
7745
|
-
this.current = this.stateStack.pop();
|
|
7748
|
+
if (this.stateStack.length === 0) {
|
|
7746
7749
|
if (this.inSMaskMode) {
|
|
7747
|
-
this.
|
|
7748
|
-
copyCtxState(this.suspendedCtx, this.ctx);
|
|
7749
|
-
} else {
|
|
7750
|
-
this.ctx.restore();
|
|
7750
|
+
this.endSMaskMode();
|
|
7751
7751
|
}
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7752
|
+
return;
|
|
7753
|
+
}
|
|
7754
|
+
this.current = this.stateStack.pop();
|
|
7755
|
+
this.ctx.restore();
|
|
7756
|
+
if (this.inSMaskMode) {
|
|
7757
|
+
copyCtxState(this.suspendedCtx, this.ctx);
|
|
7756
7758
|
}
|
|
7759
|
+
this.checkSMaskState();
|
|
7760
|
+
this.pendingClip = null;
|
|
7761
|
+
this._cachedScaleForStroking[0] = -1;
|
|
7762
|
+
this._cachedGetSinglePixelWidth = null;
|
|
7757
7763
|
}
|
|
7758
7764
|
transform(a, b, c, d, e, f) {
|
|
7759
7765
|
this.ctx.transform(a, b, c, d, e, f);
|
|
@@ -7761,145 +7767,56 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
7761
7767
|
this._cachedGetSinglePixelWidth = null;
|
|
7762
7768
|
}
|
|
7763
7769
|
// Path
|
|
7764
|
-
constructPath(
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
const isScalingMatrix = currentTransform[0] === 0 && currentTransform[3] === 0 || currentTransform[1] === 0 && currentTransform[2] === 0;
|
|
7771
|
-
const minMaxForBezier = isScalingMatrix ? minMax.slice(0) : null;
|
|
7772
|
-
for (let i = 0, j = 0, ii = ops.length; i < ii; i++) {
|
|
7773
|
-
switch (ops[i] | 0) {
|
|
7774
|
-
case OPS.rectangle:
|
|
7775
|
-
x = args[j++];
|
|
7776
|
-
y = args[j++];
|
|
7777
|
-
const width = args[j++];
|
|
7778
|
-
const height = args[j++];
|
|
7779
|
-
const xw = x + width;
|
|
7780
|
-
const yh = y + height;
|
|
7781
|
-
ctx.moveTo(x, y);
|
|
7782
|
-
if (width === 0 || height === 0) {
|
|
7783
|
-
ctx.lineTo(xw, yh);
|
|
7784
|
-
} else {
|
|
7785
|
-
ctx.lineTo(xw, y);
|
|
7786
|
-
ctx.lineTo(xw, yh);
|
|
7787
|
-
ctx.lineTo(x, yh);
|
|
7788
|
-
}
|
|
7789
|
-
if (!isScalingMatrix) {
|
|
7790
|
-
current.updateRectMinMax(currentTransform, [x, y, xw, yh]);
|
|
7791
|
-
}
|
|
7792
|
-
ctx.closePath();
|
|
7793
|
-
break;
|
|
7794
|
-
case OPS.moveTo:
|
|
7795
|
-
x = args[j++];
|
|
7796
|
-
y = args[j++];
|
|
7797
|
-
ctx.moveTo(x, y);
|
|
7798
|
-
if (!isScalingMatrix) {
|
|
7799
|
-
current.updatePathMinMax(currentTransform, x, y);
|
|
7800
|
-
}
|
|
7801
|
-
break;
|
|
7802
|
-
case OPS.lineTo:
|
|
7803
|
-
x = args[j++];
|
|
7804
|
-
y = args[j++];
|
|
7805
|
-
ctx.lineTo(x, y);
|
|
7806
|
-
if (!isScalingMatrix) {
|
|
7807
|
-
current.updatePathMinMax(currentTransform, x, y);
|
|
7808
|
-
}
|
|
7809
|
-
break;
|
|
7810
|
-
case OPS.curveTo:
|
|
7811
|
-
startX = x;
|
|
7812
|
-
startY = y;
|
|
7813
|
-
x = args[j + 4];
|
|
7814
|
-
y = args[j + 5];
|
|
7815
|
-
ctx.bezierCurveTo(
|
|
7816
|
-
args[j],
|
|
7817
|
-
args[j + 1],
|
|
7818
|
-
args[j + 2],
|
|
7819
|
-
args[j + 3],
|
|
7820
|
-
x,
|
|
7821
|
-
y
|
|
7822
|
-
);
|
|
7823
|
-
current.updateCurvePathMinMax(
|
|
7824
|
-
currentTransform,
|
|
7825
|
-
startX,
|
|
7826
|
-
startY,
|
|
7827
|
-
args[j],
|
|
7828
|
-
args[j + 1],
|
|
7829
|
-
args[j + 2],
|
|
7830
|
-
args[j + 3],
|
|
7831
|
-
x,
|
|
7832
|
-
y,
|
|
7833
|
-
minMaxForBezier
|
|
7834
|
-
);
|
|
7835
|
-
j += 6;
|
|
7836
|
-
break;
|
|
7837
|
-
case OPS.curveTo2:
|
|
7838
|
-
startX = x;
|
|
7839
|
-
startY = y;
|
|
7840
|
-
ctx.bezierCurveTo(
|
|
7841
|
-
x,
|
|
7842
|
-
y,
|
|
7843
|
-
args[j],
|
|
7844
|
-
args[j + 1],
|
|
7845
|
-
args[j + 2],
|
|
7846
|
-
args[j + 3]
|
|
7847
|
-
);
|
|
7848
|
-
current.updateCurvePathMinMax(
|
|
7849
|
-
currentTransform,
|
|
7850
|
-
startX,
|
|
7851
|
-
startY,
|
|
7852
|
-
x,
|
|
7853
|
-
y,
|
|
7854
|
-
args[j],
|
|
7855
|
-
args[j + 1],
|
|
7856
|
-
args[j + 2],
|
|
7857
|
-
args[j + 3],
|
|
7858
|
-
minMaxForBezier
|
|
7859
|
-
);
|
|
7860
|
-
x = args[j + 2];
|
|
7861
|
-
y = args[j + 3];
|
|
7862
|
-
j += 4;
|
|
7863
|
-
break;
|
|
7864
|
-
case OPS.curveTo3:
|
|
7865
|
-
startX = x;
|
|
7866
|
-
startY = y;
|
|
7867
|
-
x = args[j + 2];
|
|
7868
|
-
y = args[j + 3];
|
|
7869
|
-
ctx.bezierCurveTo(args[j], args[j + 1], x, y, x, y);
|
|
7870
|
-
current.updateCurvePathMinMax(
|
|
7871
|
-
currentTransform,
|
|
7872
|
-
startX,
|
|
7873
|
-
startY,
|
|
7874
|
-
args[j],
|
|
7875
|
-
args[j + 1],
|
|
7876
|
-
x,
|
|
7877
|
-
y,
|
|
7878
|
-
x,
|
|
7879
|
-
y,
|
|
7880
|
-
minMaxForBezier
|
|
7881
|
-
);
|
|
7882
|
-
j += 4;
|
|
7883
|
-
break;
|
|
7884
|
-
case OPS.closePath:
|
|
7885
|
-
ctx.closePath();
|
|
7886
|
-
break;
|
|
7887
|
-
}
|
|
7770
|
+
constructPath(op, data, minMax) {
|
|
7771
|
+
let [path] = data;
|
|
7772
|
+
if (!minMax) {
|
|
7773
|
+
path || (path = data[0] = new SvgPath2D());
|
|
7774
|
+
this[op](path);
|
|
7775
|
+
return;
|
|
7888
7776
|
}
|
|
7889
|
-
if (
|
|
7890
|
-
|
|
7777
|
+
if (!(path instanceof SvgPath2D)) {
|
|
7778
|
+
const path2d = data[0] = new SvgPath2D();
|
|
7779
|
+
for (let i = 0, ii = path.length; i < ii; ) {
|
|
7780
|
+
switch (path[i++]) {
|
|
7781
|
+
case DrawOPS.moveTo:
|
|
7782
|
+
path2d.moveTo(path[i++], path[i++]);
|
|
7783
|
+
break;
|
|
7784
|
+
case DrawOPS.lineTo:
|
|
7785
|
+
path2d.lineTo(path[i++], path[i++]);
|
|
7786
|
+
break;
|
|
7787
|
+
case DrawOPS.curveTo:
|
|
7788
|
+
path2d.bezierCurveTo(
|
|
7789
|
+
path[i++],
|
|
7790
|
+
path[i++],
|
|
7791
|
+
path[i++],
|
|
7792
|
+
path[i++],
|
|
7793
|
+
path[i++],
|
|
7794
|
+
path[i++]
|
|
7795
|
+
);
|
|
7796
|
+
break;
|
|
7797
|
+
case DrawOPS.closePath:
|
|
7798
|
+
path2d.closePath();
|
|
7799
|
+
break;
|
|
7800
|
+
default:
|
|
7801
|
+
warn(`Unrecognized drawing path operator: ${path[i - 1]}`);
|
|
7802
|
+
break;
|
|
7803
|
+
}
|
|
7804
|
+
}
|
|
7805
|
+
path = path2d;
|
|
7891
7806
|
}
|
|
7892
|
-
current.
|
|
7807
|
+
this.current.updateRectMinMax(getCurrentTransform(this.ctx), minMax);
|
|
7808
|
+
this[op](path);
|
|
7893
7809
|
}
|
|
7894
7810
|
closePath() {
|
|
7895
7811
|
this.ctx.closePath();
|
|
7896
7812
|
}
|
|
7897
|
-
stroke(consumePath = true) {
|
|
7813
|
+
stroke(path, consumePath = true) {
|
|
7898
7814
|
const ctx = this.ctx;
|
|
7899
7815
|
const strokeColor = this.current.strokeColor;
|
|
7900
7816
|
ctx.globalAlpha = this.current.strokeAlpha;
|
|
7901
7817
|
if (this.contentVisible) {
|
|
7902
7818
|
if (typeof strokeColor === "object" && strokeColor?.getPattern) {
|
|
7819
|
+
const baseTransform = strokeColor.isModifyingCurrentTransform() ? ctx.getTransform() : null;
|
|
7903
7820
|
ctx.save();
|
|
7904
7821
|
ctx.strokeStyle = strokeColor.getPattern(
|
|
7905
7822
|
ctx,
|
|
@@ -7907,33 +7824,49 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
7907
7824
|
getCurrentTransformInverse(ctx),
|
|
7908
7825
|
PathType.STROKE
|
|
7909
7826
|
);
|
|
7827
|
+
if (baseTransform) {
|
|
7828
|
+
const newPath = new SvgPath2D();
|
|
7829
|
+
newPath.addPath(
|
|
7830
|
+
path,
|
|
7831
|
+
ctx.getTransform().invertSelf().multiplySelf(baseTransform)
|
|
7832
|
+
);
|
|
7833
|
+
path = newPath;
|
|
7834
|
+
}
|
|
7910
7835
|
this.rescaleAndStroke(
|
|
7836
|
+
path,
|
|
7911
7837
|
/* saveRestore */
|
|
7912
7838
|
false
|
|
7913
7839
|
);
|
|
7914
7840
|
ctx.restore();
|
|
7915
7841
|
} else {
|
|
7916
7842
|
this.rescaleAndStroke(
|
|
7843
|
+
path,
|
|
7917
7844
|
/* saveRestore */
|
|
7918
7845
|
true
|
|
7919
7846
|
);
|
|
7920
7847
|
}
|
|
7921
7848
|
}
|
|
7922
7849
|
if (consumePath) {
|
|
7923
|
-
this.consumePath(
|
|
7850
|
+
this.consumePath(
|
|
7851
|
+
path,
|
|
7852
|
+
this.current.getClippedPathBoundingBox(
|
|
7853
|
+
PathType.STROKE,
|
|
7854
|
+
getCurrentTransform(this.ctx)
|
|
7855
|
+
)
|
|
7856
|
+
);
|
|
7924
7857
|
}
|
|
7925
7858
|
ctx.globalAlpha = this.current.fillAlpha;
|
|
7926
7859
|
}
|
|
7927
|
-
closeStroke() {
|
|
7928
|
-
this.
|
|
7929
|
-
this.stroke();
|
|
7860
|
+
closeStroke(path) {
|
|
7861
|
+
this.stroke(path);
|
|
7930
7862
|
}
|
|
7931
|
-
fill(consumePath = true) {
|
|
7863
|
+
fill(path, consumePath = true) {
|
|
7932
7864
|
const ctx = this.ctx;
|
|
7933
7865
|
const fillColor = this.current.fillColor;
|
|
7934
7866
|
const isPatternFill = this.current.patternFill;
|
|
7935
7867
|
let needRestore = false;
|
|
7936
7868
|
if (isPatternFill) {
|
|
7869
|
+
const baseTransform = fillColor.isModifyingCurrentTransform() ? ctx.getTransform() : null;
|
|
7937
7870
|
ctx.save();
|
|
7938
7871
|
ctx.fillStyle = fillColor.getPattern(
|
|
7939
7872
|
ctx,
|
|
@@ -7941,48 +7874,54 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
7941
7874
|
getCurrentTransformInverse(ctx),
|
|
7942
7875
|
PathType.FILL
|
|
7943
7876
|
);
|
|
7877
|
+
if (baseTransform) {
|
|
7878
|
+
const newPath = new SvgPath2D();
|
|
7879
|
+
newPath.addPath(
|
|
7880
|
+
path,
|
|
7881
|
+
ctx.getTransform().invertSelf().multiplySelf(baseTransform)
|
|
7882
|
+
);
|
|
7883
|
+
path = newPath;
|
|
7884
|
+
}
|
|
7944
7885
|
needRestore = true;
|
|
7945
7886
|
}
|
|
7946
7887
|
const intersect = this.current.getClippedPathBoundingBox();
|
|
7947
7888
|
if (this.contentVisible && intersect !== null) {
|
|
7948
7889
|
if (this.pendingEOFill) {
|
|
7949
|
-
ctx.fill("evenodd");
|
|
7890
|
+
ctx.fill(path, "evenodd");
|
|
7950
7891
|
this.pendingEOFill = false;
|
|
7951
7892
|
} else {
|
|
7952
|
-
ctx.fill();
|
|
7893
|
+
ctx.fill(path);
|
|
7953
7894
|
}
|
|
7954
7895
|
}
|
|
7955
7896
|
if (needRestore) {
|
|
7956
7897
|
ctx.restore();
|
|
7957
7898
|
}
|
|
7958
7899
|
if (consumePath) {
|
|
7959
|
-
this.consumePath(intersect);
|
|
7900
|
+
this.consumePath(path, intersect);
|
|
7960
7901
|
}
|
|
7961
7902
|
}
|
|
7962
|
-
eoFill() {
|
|
7903
|
+
eoFill(path) {
|
|
7963
7904
|
this.pendingEOFill = true;
|
|
7964
|
-
this.fill();
|
|
7905
|
+
this.fill(path);
|
|
7965
7906
|
}
|
|
7966
|
-
fillStroke() {
|
|
7967
|
-
this.fill(false);
|
|
7968
|
-
this.stroke(false);
|
|
7969
|
-
this.consumePath();
|
|
7907
|
+
fillStroke(path) {
|
|
7908
|
+
this.fill(path, false);
|
|
7909
|
+
this.stroke(path, false);
|
|
7910
|
+
this.consumePath(path);
|
|
7970
7911
|
}
|
|
7971
|
-
eoFillStroke() {
|
|
7912
|
+
eoFillStroke(path) {
|
|
7972
7913
|
this.pendingEOFill = true;
|
|
7973
|
-
this.fillStroke();
|
|
7914
|
+
this.fillStroke(path);
|
|
7974
7915
|
}
|
|
7975
|
-
closeFillStroke() {
|
|
7976
|
-
this.
|
|
7977
|
-
this.fillStroke();
|
|
7916
|
+
closeFillStroke(path) {
|
|
7917
|
+
this.fillStroke(path);
|
|
7978
7918
|
}
|
|
7979
|
-
closeEOFillStroke() {
|
|
7919
|
+
closeEOFillStroke(path) {
|
|
7980
7920
|
this.pendingEOFill = true;
|
|
7981
|
-
this.
|
|
7982
|
-
this.fillStroke();
|
|
7921
|
+
this.fillStroke(path);
|
|
7983
7922
|
}
|
|
7984
|
-
endPath() {
|
|
7985
|
-
this.consumePath();
|
|
7923
|
+
endPath(path) {
|
|
7924
|
+
this.consumePath(path);
|
|
7986
7925
|
}
|
|
7987
7926
|
// Clipping
|
|
7988
7927
|
clip() {
|
|
@@ -8374,9 +8313,7 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
8374
8313
|
const operatorList = font.charProcOperatorList[glyph.operatorListId];
|
|
8375
8314
|
if (!operatorList) {
|
|
8376
8315
|
warn(`Type3 character "${glyph.operatorListId}" is not available.`);
|
|
8377
|
-
|
|
8378
|
-
}
|
|
8379
|
-
if (this.contentVisible) {
|
|
8316
|
+
} else if (this.contentVisible) {
|
|
8380
8317
|
this.processingType3 = glyph;
|
|
8381
8318
|
this.save();
|
|
8382
8319
|
ctx.scale(fontSize, fontSize);
|
|
@@ -8404,7 +8341,6 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
8404
8341
|
getColorN_Pattern(IR) {
|
|
8405
8342
|
let pattern;
|
|
8406
8343
|
if (IR[0] === "TilingPattern") {
|
|
8407
|
-
const color = IR[1];
|
|
8408
8344
|
const baseTransform = this.baseTransform || getCurrentTransform(this.ctx);
|
|
8409
8345
|
const canvasGraphicsFactory = {
|
|
8410
8346
|
createCanvasGraphics: (ctx) => new _CanvasGraphics(
|
|
@@ -8421,7 +8357,6 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
8421
8357
|
};
|
|
8422
8358
|
pattern = new TilingPattern(
|
|
8423
8359
|
IR,
|
|
8424
|
-
color,
|
|
8425
8360
|
this.ctx,
|
|
8426
8361
|
canvasGraphicsFactory,
|
|
8427
8362
|
baseTransform
|
|
@@ -8583,6 +8518,15 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
8583
8518
|
const groupCtx = scratchCanvas.context;
|
|
8584
8519
|
groupCtx.translate(-offsetX, -offsetY);
|
|
8585
8520
|
groupCtx.transform(...currentTransform);
|
|
8521
|
+
let clip = new SvgPath2D();
|
|
8522
|
+
const [x0, y0, x1, y1] = group.bbox;
|
|
8523
|
+
clip.rect(x0, y0, x1 - x0, y1 - y0);
|
|
8524
|
+
if (group.matrix) {
|
|
8525
|
+
const path = new SvgPath2D();
|
|
8526
|
+
path.addPath(clip, new DOMMatrix(group.matrix));
|
|
8527
|
+
clip = path;
|
|
8528
|
+
}
|
|
8529
|
+
groupCtx.clip(clip);
|
|
8586
8530
|
if (group.smask) {
|
|
8587
8531
|
this.smaskStack.push({
|
|
8588
8532
|
canvas: scratchCanvas.canvas,
|
|
@@ -8715,7 +8659,7 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
8715
8659
|
glyph.compiled = compileType3Glyph(img);
|
|
8716
8660
|
}
|
|
8717
8661
|
if (glyph.compiled) {
|
|
8718
|
-
glyph.compiled
|
|
8662
|
+
ctx.fill(glyph.compiled);
|
|
8719
8663
|
return;
|
|
8720
8664
|
}
|
|
8721
8665
|
}
|
|
@@ -8992,7 +8936,7 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
8992
8936
|
endCompat() {
|
|
8993
8937
|
}
|
|
8994
8938
|
// Helper functions
|
|
8995
|
-
consumePath(clipBox) {
|
|
8939
|
+
consumePath(path, clipBox) {
|
|
8996
8940
|
const isEmpty = this.current.isEmptyClip();
|
|
8997
8941
|
if (this.pendingClip) {
|
|
8998
8942
|
this.current.updateClipFromPath();
|
|
@@ -9004,9 +8948,9 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
9004
8948
|
if (this.pendingClip) {
|
|
9005
8949
|
if (!isEmpty) {
|
|
9006
8950
|
if (this.pendingClip === EO_CLIP) {
|
|
9007
|
-
ctx.clip("evenodd");
|
|
8951
|
+
ctx.clip(path, "evenodd");
|
|
9008
8952
|
} else {
|
|
9009
|
-
ctx.clip();
|
|
8953
|
+
ctx.clip(path);
|
|
9010
8954
|
}
|
|
9011
8955
|
}
|
|
9012
8956
|
this.pendingClip = null;
|
|
@@ -9072,13 +9016,15 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
9072
9016
|
}
|
|
9073
9017
|
// Rescale before stroking in order to have a final lineWidth
|
|
9074
9018
|
// with both thicknesses greater or equal to 1.
|
|
9075
|
-
rescaleAndStroke(saveRestore) {
|
|
9076
|
-
const {
|
|
9077
|
-
|
|
9019
|
+
rescaleAndStroke(path, saveRestore) {
|
|
9020
|
+
const {
|
|
9021
|
+
ctx,
|
|
9022
|
+
current: { lineWidth }
|
|
9023
|
+
} = this;
|
|
9078
9024
|
const [scaleX, scaleY] = this.getScaleForStroking();
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
ctx.stroke();
|
|
9025
|
+
if (scaleX === scaleY) {
|
|
9026
|
+
ctx.lineWidth = (lineWidth || 1) * scaleX;
|
|
9027
|
+
ctx.stroke(path);
|
|
9082
9028
|
return;
|
|
9083
9029
|
}
|
|
9084
9030
|
const dashes = ctx.getLineDash();
|
|
@@ -9086,12 +9032,17 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
9086
9032
|
ctx.save();
|
|
9087
9033
|
}
|
|
9088
9034
|
ctx.scale(scaleX, scaleY);
|
|
9035
|
+
SCALE_MATRIX.a = 1 / scaleX;
|
|
9036
|
+
SCALE_MATRIX.d = 1 / scaleY;
|
|
9037
|
+
const newPath = new SvgPath2D();
|
|
9038
|
+
newPath.addPath(path, SCALE_MATRIX);
|
|
9089
9039
|
if (dashes.length > 0) {
|
|
9090
9040
|
const scale = Math.max(scaleX, scaleY);
|
|
9091
9041
|
ctx.setLineDash(dashes.map((x) => x / scale));
|
|
9092
9042
|
ctx.lineDashOffset /= scale;
|
|
9093
9043
|
}
|
|
9094
|
-
ctx.
|
|
9044
|
+
ctx.lineWidth = lineWidth || 1;
|
|
9045
|
+
ctx.stroke(newPath);
|
|
9095
9046
|
if (saveRestore) {
|
|
9096
9047
|
ctx.restore();
|
|
9097
9048
|
}
|
|
@@ -11142,7 +11093,7 @@ var _TextLayer = class _TextLayer {
|
|
|
11142
11093
|
throw new Error('No "textContentSource" parameter specified.');
|
|
11143
11094
|
}
|
|
11144
11095
|
__privateSet(this, _container3, __privateSet(this, _rootContainer, container));
|
|
11145
|
-
__privateSet(this, _scale, viewport.scale *
|
|
11096
|
+
__privateSet(this, _scale, viewport.scale * OutputScale.pixelRatio);
|
|
11146
11097
|
__privateSet(this, _rotation, viewport.rotation);
|
|
11147
11098
|
__privateSet(this, _layoutTextParams, {
|
|
11148
11099
|
div: null,
|
|
@@ -11220,7 +11171,7 @@ var _TextLayer = class _TextLayer {
|
|
|
11220
11171
|
*/
|
|
11221
11172
|
update({ viewport, onBefore = null }) {
|
|
11222
11173
|
var _a2;
|
|
11223
|
-
const scale = viewport.scale *
|
|
11174
|
+
const scale = viewport.scale * OutputScale.pixelRatio;
|
|
11224
11175
|
const rotation = viewport.rotation;
|
|
11225
11176
|
if (rotation !== __privateGet(this, _rotation)) {
|
|
11226
11177
|
onBefore?.();
|
|
@@ -11600,6 +11551,7 @@ function getDocument(src = {}) {
|
|
|
11600
11551
|
const cMapUrl = getFactoryUrlProp(src.cMapUrl);
|
|
11601
11552
|
const cMapPacked = src.cMapPacked !== false;
|
|
11602
11553
|
const CMapReaderFactory = src.CMapReaderFactory || (isNodeJS ? NodeCMapReaderFactory : DOMCMapReaderFactory);
|
|
11554
|
+
const iccUrl = getFactoryUrlProp(src.iccUrl);
|
|
11603
11555
|
const standardFontDataUrl = getFactoryUrlProp(src.standardFontDataUrl);
|
|
11604
11556
|
const StandardFontDataFactory2 = src.StandardFontDataFactory || (isNodeJS ? NodeStandardFontDataFactory : DOMStandardFontDataFactory);
|
|
11605
11557
|
const wasmUrl = getFactoryUrlProp(src.wasmUrl);
|
|
@@ -11671,6 +11623,7 @@ function getDocument(src = {}) {
|
|
|
11671
11623
|
useWasm,
|
|
11672
11624
|
useWorkerFetch,
|
|
11673
11625
|
cMapUrl,
|
|
11626
|
+
iccUrl,
|
|
11674
11627
|
standardFontDataUrl,
|
|
11675
11628
|
wasmUrl
|
|
11676
11629
|
}
|
|
@@ -11804,19 +11757,54 @@ function getFactoryUrlProp(val) {
|
|
|
11804
11757
|
}
|
|
11805
11758
|
throw new Error(`Invalid factory url: "${val}" must include trailing slash.`);
|
|
11806
11759
|
}
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11760
|
+
var isRefProxy = (v) => typeof v === "object" && Number.isInteger(v?.num) && v.num >= 0 && Number.isInteger(v?.gen) && v.gen >= 0;
|
|
11761
|
+
var isNameProxy = (v) => typeof v === "object" && typeof v?.name === "string";
|
|
11762
|
+
var isValidExplicitDest = _isValidExplicitDest.bind(
|
|
11763
|
+
null,
|
|
11764
|
+
/* validRef = */
|
|
11765
|
+
isRefProxy,
|
|
11766
|
+
/* validName = */
|
|
11767
|
+
isNameProxy
|
|
11768
|
+
);
|
|
11810
11769
|
var _docId2;
|
|
11811
11770
|
var _PDFDocumentLoadingTask = class _PDFDocumentLoadingTask {
|
|
11812
11771
|
constructor() {
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
|
|
11816
|
-
this
|
|
11817
|
-
|
|
11818
|
-
|
|
11819
|
-
|
|
11772
|
+
/**
|
|
11773
|
+
* @private
|
|
11774
|
+
*/
|
|
11775
|
+
__publicField(this, "_capability", Promise.withResolvers());
|
|
11776
|
+
/**
|
|
11777
|
+
* @private
|
|
11778
|
+
*/
|
|
11779
|
+
__publicField(this, "_transport", null);
|
|
11780
|
+
/**
|
|
11781
|
+
* @private
|
|
11782
|
+
*/
|
|
11783
|
+
__publicField(this, "_worker", null);
|
|
11784
|
+
/**
|
|
11785
|
+
* Unique identifier for the document loading task.
|
|
11786
|
+
* @type {string}
|
|
11787
|
+
*/
|
|
11788
|
+
__publicField(this, "docId", `d${__privateWrapper(_PDFDocumentLoadingTask, _docId2)._++}`);
|
|
11789
|
+
/**
|
|
11790
|
+
* Whether the loading task is destroyed or not.
|
|
11791
|
+
* @type {boolean}
|
|
11792
|
+
*/
|
|
11793
|
+
__publicField(this, "destroyed", false);
|
|
11794
|
+
/**
|
|
11795
|
+
* Callback to request a password if a wrong or no password was provided.
|
|
11796
|
+
* The callback receives two parameters: a function that should be called
|
|
11797
|
+
* with the new password, and a reason (see {@link PasswordResponses}).
|
|
11798
|
+
* @type {function}
|
|
11799
|
+
*/
|
|
11800
|
+
__publicField(this, "onPassword", null);
|
|
11801
|
+
/**
|
|
11802
|
+
* Callback to be able to monitor the loading progress of the PDF file
|
|
11803
|
+
* (necessary to implement e.g. a loading bar).
|
|
11804
|
+
* The callback receives an {@link OnProgressParameters} argument.
|
|
11805
|
+
* @type {function}
|
|
11806
|
+
*/
|
|
11807
|
+
__publicField(this, "onProgress", null);
|
|
11820
11808
|
}
|
|
11821
11809
|
/**
|
|
11822
11810
|
* Promise for document loading task completion.
|
|
@@ -11851,6 +11839,15 @@ var _PDFDocumentLoadingTask = class _PDFDocumentLoadingTask {
|
|
|
11851
11839
|
this._worker?.destroy();
|
|
11852
11840
|
this._worker = null;
|
|
11853
11841
|
}
|
|
11842
|
+
/**
|
|
11843
|
+
* Attempt to fetch the raw data of the PDF document, when e.g.
|
|
11844
|
+
* - An exception was thrown during document initialization.
|
|
11845
|
+
* - An `onPassword` callback is delaying initialization.
|
|
11846
|
+
* @returns {Promise<Uint8Array>}
|
|
11847
|
+
*/
|
|
11848
|
+
async getData() {
|
|
11849
|
+
return this._transport.getData();
|
|
11850
|
+
}
|
|
11854
11851
|
};
|
|
11855
11852
|
_docId2 = new WeakMap();
|
|
11856
11853
|
__privateAdd(_PDFDocumentLoadingTask, _docId2, 0);
|
|
@@ -13027,6 +13024,7 @@ var _PDFWorker = class _PDFWorker {
|
|
|
13027
13024
|
}
|
|
13028
13025
|
/**
|
|
13029
13026
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
13027
|
+
* @returns {PDFWorker}
|
|
13030
13028
|
*/
|
|
13031
13029
|
static fromPort(params) {
|
|
13032
13030
|
if (false) {
|
|
@@ -13062,7 +13060,7 @@ var _PDFWorker = class _PDFWorker {
|
|
|
13062
13060
|
if (__privateGet(this, _PDFWorker_static, mainThreadWorkerMessageHandler_get)) {
|
|
13063
13061
|
return __privateGet(this, _PDFWorker_static, mainThreadWorkerMessageHandler_get);
|
|
13064
13062
|
}
|
|
13065
|
-
const worker = true ? await import("./worker.js") : await
|
|
13063
|
+
const worker = true ? await import("./worker.js") : await __raw_import__(this.workerSrc);
|
|
13066
13064
|
return worker.WorkerMessageHandler;
|
|
13067
13065
|
};
|
|
13068
13066
|
return shadow(this, "_setupFakeWorkerGlobal", loader());
|
|
@@ -17591,7 +17589,7 @@ var _FreeTextEditor = class _FreeTextEditor extends AnnotationEditor {
|
|
|
17591
17589
|
__privateSet(this, _content, `${bufferBefore.join("\n")}${paste}${bufferAfter.join("\n")}`);
|
|
17592
17590
|
__privateMethod(this, _FreeTextEditor_instances, setContent_fn).call(this);
|
|
17593
17591
|
const newRange = new Range();
|
|
17594
|
-
let beforeLength = bufferBefore.
|
|
17592
|
+
let beforeLength = Math.sumPrecise(bufferBefore.map((line) => line.length));
|
|
17595
17593
|
for (const { firstChild } of this.editorDiv.childNodes) {
|
|
17596
17594
|
if (firstChild.nodeType === Node.TEXT_NODE) {
|
|
17597
17595
|
const length = firstChild.nodeValue.length;
|
|
@@ -18441,35 +18439,24 @@ computeMinMax_fn = function(isLTR) {
|
|
|
18441
18439
|
const outline = __privateGet(this, _outline);
|
|
18442
18440
|
let lastX = outline[4];
|
|
18443
18441
|
let lastY = outline[5];
|
|
18444
|
-
|
|
18445
|
-
let minY = lastY;
|
|
18446
|
-
let maxX = lastX;
|
|
18447
|
-
let maxY = lastY;
|
|
18442
|
+
const minMax = [lastX, lastY, lastX, lastY];
|
|
18448
18443
|
let lastPointX = lastX;
|
|
18449
18444
|
let lastPointY = lastY;
|
|
18450
18445
|
const ltrCallback = isLTR ? Math.max : Math.min;
|
|
18451
18446
|
for (let i = 6, ii = outline.length; i < ii; i += 6) {
|
|
18447
|
+
const x = outline[i + 4], y = outline[i + 5];
|
|
18452
18448
|
if (isNaN(outline[i])) {
|
|
18453
|
-
|
|
18454
|
-
|
|
18455
|
-
|
|
18456
|
-
|
|
18457
|
-
if (lastPointY
|
|
18458
|
-
lastPointX =
|
|
18459
|
-
lastPointY = outline[i + 5];
|
|
18460
|
-
} else if (lastPointY === outline[i + 5]) {
|
|
18461
|
-
lastPointX = ltrCallback(lastPointX, outline[i + 4]);
|
|
18449
|
+
Util.pointBoundingBox(x, y, minMax);
|
|
18450
|
+
if (lastPointY < y) {
|
|
18451
|
+
lastPointX = x;
|
|
18452
|
+
lastPointY = y;
|
|
18453
|
+
} else if (lastPointY === y) {
|
|
18454
|
+
lastPointX = ltrCallback(lastPointX, x);
|
|
18462
18455
|
}
|
|
18463
18456
|
} else {
|
|
18464
|
-
const bbox2 =
|
|
18465
|
-
|
|
18466
|
-
|
|
18467
|
-
...outline.slice(i, i + 6)
|
|
18468
|
-
);
|
|
18469
|
-
minX = Math.min(minX, bbox2[0]);
|
|
18470
|
-
minY = Math.min(minY, bbox2[1]);
|
|
18471
|
-
maxX = Math.max(maxX, bbox2[2]);
|
|
18472
|
-
maxY = Math.max(maxY, bbox2[3]);
|
|
18457
|
+
const bbox2 = [Infinity, Infinity, -Infinity, -Infinity];
|
|
18458
|
+
Util.bezierBoundingBox(lastX, lastY, ...outline.slice(i, i + 6), bbox2);
|
|
18459
|
+
Util.rectBoundingBox(...bbox2, minMax);
|
|
18473
18460
|
if (lastPointY < bbox2[3]) {
|
|
18474
18461
|
lastPointX = bbox2[2];
|
|
18475
18462
|
lastPointY = bbox2[3];
|
|
@@ -18477,14 +18464,14 @@ computeMinMax_fn = function(isLTR) {
|
|
|
18477
18464
|
lastPointX = ltrCallback(lastPointX, bbox2[2]);
|
|
18478
18465
|
}
|
|
18479
18466
|
}
|
|
18480
|
-
lastX =
|
|
18481
|
-
lastY =
|
|
18467
|
+
lastX = x;
|
|
18468
|
+
lastY = y;
|
|
18482
18469
|
}
|
|
18483
18470
|
const bbox = __privateGet(this, _bbox);
|
|
18484
|
-
bbox[0] =
|
|
18485
|
-
bbox[1] =
|
|
18486
|
-
bbox[2] =
|
|
18487
|
-
bbox[3] =
|
|
18471
|
+
bbox[0] = minMax[0] - __privateGet(this, _innerMargin2);
|
|
18472
|
+
bbox[1] = minMax[1] - __privateGet(this, _innerMargin2);
|
|
18473
|
+
bbox[2] = minMax[2] - minMax[0] + 2 * __privateGet(this, _innerMargin2);
|
|
18474
|
+
bbox[3] = minMax[3] - minMax[1] + 2 * __privateGet(this, _innerMargin2);
|
|
18488
18475
|
this.lastPoint = [lastPointX, lastPointY];
|
|
18489
18476
|
};
|
|
18490
18477
|
|
|
@@ -18509,10 +18496,7 @@ var HighlightOutliner = class {
|
|
|
18509
18496
|
__privateAdd(this, _lastPoint);
|
|
18510
18497
|
__privateAdd(this, _verticalEdges, []);
|
|
18511
18498
|
__privateAdd(this, _intervals, []);
|
|
18512
|
-
|
|
18513
|
-
let maxX = -Infinity;
|
|
18514
|
-
let minY = Infinity;
|
|
18515
|
-
let maxY = -Infinity;
|
|
18499
|
+
const minMax = [Infinity, Infinity, -Infinity, -Infinity];
|
|
18516
18500
|
const NUMBER_OF_DIGITS = 4;
|
|
18517
18501
|
const EPSILON = 10 ** -NUMBER_OF_DIGITS;
|
|
18518
18502
|
for (const { x, y, width, height } of boxes) {
|
|
@@ -18523,15 +18507,12 @@ var HighlightOutliner = class {
|
|
|
18523
18507
|
const left = [x1, y1, y2, true];
|
|
18524
18508
|
const right = [x2, y1, y2, false];
|
|
18525
18509
|
__privateGet(this, _verticalEdges).push(left, right);
|
|
18526
|
-
|
|
18527
|
-
|
|
18528
|
-
|
|
18529
|
-
|
|
18530
|
-
|
|
18531
|
-
const
|
|
18532
|
-
const bboxHeight = maxY - minY + 2 * innerMargin;
|
|
18533
|
-
const shiftedMinX = minX - innerMargin;
|
|
18534
|
-
const shiftedMinY = minY - innerMargin;
|
|
18510
|
+
Util.rectBoundingBox(x1, y1, x2, y2, minMax);
|
|
18511
|
+
}
|
|
18512
|
+
const bboxWidth = minMax[2] - minMax[0] + 2 * innerMargin;
|
|
18513
|
+
const bboxHeight = minMax[3] - minMax[1] + 2 * innerMargin;
|
|
18514
|
+
const shiftedMinX = minMax[0] - innerMargin;
|
|
18515
|
+
const shiftedMinY = minMax[1] - innerMargin;
|
|
18535
18516
|
const lastEdge = __privateGet(this, _verticalEdges).at(isLTR ? -1 : -2);
|
|
18536
18517
|
const lastPoint = [lastEdge[0], lastEdge[2]];
|
|
18537
18518
|
for (const edge of __privateGet(this, _verticalEdges)) {
|
|
@@ -19060,6 +19041,7 @@ var _HighlightEditor = class _HighlightEditor extends AnnotationEditor {
|
|
|
19060
19041
|
__privateSet(this, _methodOfCreation, params.methodOfCreation || "");
|
|
19061
19042
|
__privateSet(this, _text, params.text || "");
|
|
19062
19043
|
this._isDraggable = false;
|
|
19044
|
+
this.defaultL10nId = "pdfjs-editor-highlight-editor";
|
|
19063
19045
|
if (params.highlightId > -1) {
|
|
19064
19046
|
__privateSet(this, _isFreeHighlight, true);
|
|
19065
19047
|
__privateMethod(this, _HighlightEditor_instances, createFreeOutlines_fn).call(this, params);
|
|
@@ -19574,6 +19556,7 @@ var _HighlightEditor = class _HighlightEditor extends AnnotationEditor {
|
|
|
19574
19556
|
clipPathId
|
|
19575
19557
|
});
|
|
19576
19558
|
__privateMethod(_d = editor, _HighlightEditor_instances, addToDrawLayer_fn).call(_d);
|
|
19559
|
+
editor.rotate(editor.parentRotation);
|
|
19577
19560
|
}
|
|
19578
19561
|
return editor;
|
|
19579
19562
|
}
|
|
@@ -21483,11 +21466,7 @@ computeBbox_fn = function() {
|
|
|
21483
21466
|
for (const { line } of __privateGet(this, _lines2)) {
|
|
21484
21467
|
if (line.length <= 12) {
|
|
21485
21468
|
for (let i = 4, ii = line.length; i < ii; i += 6) {
|
|
21486
|
-
|
|
21487
|
-
bbox[0] = Math.min(bbox[0], x);
|
|
21488
|
-
bbox[1] = Math.min(bbox[1], y);
|
|
21489
|
-
bbox[2] = Math.max(bbox[2], x);
|
|
21490
|
-
bbox[3] = Math.max(bbox[3], y);
|
|
21469
|
+
Util.pointBoundingBox(line[i], line[i + 1], bbox);
|
|
21491
21470
|
}
|
|
21492
21471
|
continue;
|
|
21493
21472
|
}
|
|
@@ -21500,10 +21479,10 @@ computeBbox_fn = function() {
|
|
|
21500
21479
|
}
|
|
21501
21480
|
}
|
|
21502
21481
|
const [marginX, marginY] = __privateMethod(this, _InkDrawOutline_instances, getMarginComponents_fn).call(this);
|
|
21503
|
-
bbox[0] =
|
|
21504
|
-
bbox[1] =
|
|
21505
|
-
bbox[2] =
|
|
21506
|
-
bbox[3] =
|
|
21482
|
+
bbox[0] = MathClamp(bbox[0] - marginX, 0, 1);
|
|
21483
|
+
bbox[1] = MathClamp(bbox[1] - marginY, 0, 1);
|
|
21484
|
+
bbox[2] = MathClamp(bbox[2] + marginX, 0, 1);
|
|
21485
|
+
bbox[3] = MathClamp(bbox[3] + marginY, 0, 1);
|
|
21507
21486
|
bbox[2] -= bbox[0];
|
|
21508
21487
|
bbox[3] -= bbox[1];
|
|
21509
21488
|
};
|
|
@@ -21557,6 +21536,7 @@ var _InkEditor = class _InkEditor extends DrawingEditor {
|
|
|
21557
21536
|
super({ ...params, name: "inkEditor" });
|
|
21558
21537
|
__privateAdd(this, _InkEditor_instances);
|
|
21559
21538
|
this._willKeepAspectRatio = true;
|
|
21539
|
+
this.defaultL10nId = "pdfjs-editor-ink-editor";
|
|
21560
21540
|
}
|
|
21561
21541
|
/** @inheritdoc */
|
|
21562
21542
|
static initialize(l10n, uiManager) {
|
|
@@ -22450,6 +22430,7 @@ var _SignatureEditor = class _SignatureEditor extends DrawingEditor {
|
|
|
22450
22430
|
this._willKeepAspectRatio = true;
|
|
22451
22431
|
__privateSet(this, _signatureData, params.signatureData || null);
|
|
22452
22432
|
__privateSet(this, _description, null);
|
|
22433
|
+
this.defaultL10nId = "pdfjs-editor-signature-editor1";
|
|
22453
22434
|
}
|
|
22454
22435
|
/** @inheritdoc */
|
|
22455
22436
|
static initialize(l10n, uiManager) {
|
|
@@ -22513,7 +22494,6 @@ var _SignatureEditor = class _SignatureEditor extends DrawingEditor {
|
|
|
22513
22494
|
baseY = this.y;
|
|
22514
22495
|
}
|
|
22515
22496
|
super.render();
|
|
22516
|
-
this.div.setAttribute("role", "figure");
|
|
22517
22497
|
if (this._drawId === null) {
|
|
22518
22498
|
if (__privateGet(this, _signatureData)) {
|
|
22519
22499
|
const {
|
|
@@ -22539,6 +22519,10 @@ var _SignatureEditor = class _SignatureEditor extends DrawingEditor {
|
|
|
22539
22519
|
});
|
|
22540
22520
|
this.addSignature(outline, heightInPage, description, uuid);
|
|
22541
22521
|
} else {
|
|
22522
|
+
this.div.setAttribute(
|
|
22523
|
+
"data-l10n-args",
|
|
22524
|
+
JSON.stringify({ description: "" })
|
|
22525
|
+
);
|
|
22542
22526
|
this.div.hidden = true;
|
|
22543
22527
|
this._uiManager.getSignature(this);
|
|
22544
22528
|
}
|
|
@@ -22605,6 +22589,7 @@ var _SignatureEditor = class _SignatureEditor extends DrawingEditor {
|
|
|
22605
22589
|
const { outline } = __privateSet(this, _signatureData, data);
|
|
22606
22590
|
__privateSet(this, _isExtracted, outline instanceof ContourDrawOutline);
|
|
22607
22591
|
__privateSet(this, _description, description);
|
|
22592
|
+
this.div.setAttribute("data-l10n-args", JSON.stringify({ description }));
|
|
22608
22593
|
let drawingOptions;
|
|
22609
22594
|
if (__privateGet(this, _isExtracted)) {
|
|
22610
22595
|
drawingOptions = _SignatureEditor.getDefaultDrawingOptions();
|
|
@@ -22785,6 +22770,7 @@ var StampEditor = class extends AnnotationEditor {
|
|
|
22785
22770
|
__privateAdd(this, _hasBeenAddedInUndoStack, false);
|
|
22786
22771
|
__privateSet(this, _bitmapUrl, params.bitmapUrl);
|
|
22787
22772
|
__privateSet(this, _bitmapFile, params.bitmapFile);
|
|
22773
|
+
this.defaultL10nId = "pdfjs-editor-stamp-editor";
|
|
22788
22774
|
}
|
|
22789
22775
|
/** @inheritdoc */
|
|
22790
22776
|
static initialize(l10n, uiManager) {
|
|
@@ -22926,7 +22912,6 @@ var StampEditor = class extends AnnotationEditor {
|
|
|
22926
22912
|
}
|
|
22927
22913
|
super.render();
|
|
22928
22914
|
this.div.hidden = true;
|
|
22929
|
-
this.div.setAttribute("role", "figure");
|
|
22930
22915
|
this.addAltTextButton();
|
|
22931
22916
|
if (!__privateGet(this, _missingCanvas)) {
|
|
22932
22917
|
if (__privateGet(this, _bitmap)) {
|
|
@@ -23074,10 +23059,6 @@ var StampEditor = class extends AnnotationEditor {
|
|
|
23074
23059
|
return { canvas, width, height, imageData };
|
|
23075
23060
|
}
|
|
23076
23061
|
/** @inheritdoc */
|
|
23077
|
-
getImageForAltText() {
|
|
23078
|
-
return __privateGet(this, _canvas);
|
|
23079
|
-
}
|
|
23080
|
-
/** @inheritdoc */
|
|
23081
23062
|
static async deserialize(data, parent, uiManager) {
|
|
23082
23063
|
let initialData = null;
|
|
23083
23064
|
let missingCanvas = false;
|
|
@@ -23393,7 +23374,7 @@ createCanvas_fn = function() {
|
|
|
23393
23374
|
action: "inserted_image"
|
|
23394
23375
|
});
|
|
23395
23376
|
if (__privateGet(this, _bitmapFileName)) {
|
|
23396
|
-
|
|
23377
|
+
this.div.setAttribute("aria-description", __privateGet(this, _bitmapFileName));
|
|
23397
23378
|
}
|
|
23398
23379
|
};
|
|
23399
23380
|
scaleBitmap_fn = function(width, height) {
|
|
@@ -24609,9 +24590,8 @@ PDFPageProxy.prototype.getAnnotations = async function(params) {
|
|
|
24609
24590
|
height * scale,
|
|
24610
24591
|
0,
|
|
24611
24592
|
0,
|
|
24612
|
-
|
|
24613
|
-
|
|
24614
|
-
isNodeJS ? viewport.height : height * scale
|
|
24593
|
+
width * scale,
|
|
24594
|
+
height * scale
|
|
24615
24595
|
);
|
|
24616
24596
|
annotation.graphics = await canvasToData(croppedCanvasContext.canvas);
|
|
24617
24597
|
} catch (e) {
|
|
@@ -26212,6 +26192,7 @@ export {
|
|
|
26212
26192
|
GlobalWorkerOptions,
|
|
26213
26193
|
ImageKind,
|
|
26214
26194
|
InvalidPDFException,
|
|
26195
|
+
MathClamp,
|
|
26215
26196
|
OPS,
|
|
26216
26197
|
OutputScale,
|
|
26217
26198
|
PDFDataRangeTransport,
|
|
@@ -26278,6 +26259,7 @@ export {
|
|
|
26278
26259
|
isThreeDAnnotation,
|
|
26279
26260
|
isTrapNetAnnotation,
|
|
26280
26261
|
isUnderlineAnnotation,
|
|
26262
|
+
isValidExplicitDest,
|
|
26281
26263
|
isWatermarkAnnotation,
|
|
26282
26264
|
isWidgetAnnotation,
|
|
26283
26265
|
loadDefaultFonts,
|