@box/pdfjs-dist 6.4.299-box.1 → 6.4.299-box.2
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/CHANGELOG.md +16 -0
- package/README.md +10 -0
- package/build/pdf.min.mjs +4 -4
- package/build/pdf.mjs +137 -12
- package/build/pdf.mjs.map +1 -1
- package/build/pdf.sandbox.min.mjs +2 -2
- package/build/pdf.sandbox.mjs +2 -2
- package/build/pdf.worker.min.mjs +3 -3
- package/build/pdf.worker.mjs +3 -3
- package/image_decoders/pdf.image_decoders.min.mjs +2 -2
- package/image_decoders/pdf.image_decoders.mjs +2 -2
- package/legacy/build/pdf.min.mjs +4 -4
- package/legacy/build/pdf.mjs +145 -18
- package/legacy/build/pdf.mjs.map +1 -1
- package/legacy/build/pdf.sandbox.min.mjs +2 -2
- package/legacy/build/pdf.sandbox.mjs +2 -2
- package/legacy/build/pdf.worker.min.mjs +3 -3
- package/legacy/build/pdf.worker.mjs +3 -3
- package/legacy/image_decoders/pdf.image_decoders.min.mjs +2 -2
- package/legacy/image_decoders/pdf.image_decoders.mjs +2 -2
- package/legacy/web/pdf_viewer.mjs +4 -4
- package/package.json +4 -3
- package/types/src/display/display_utils.d.ts +43 -0
- package/web/pdf_viewer.mjs +4 -4
package/legacy/build/pdf.mjs
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* pdfjsVersion = 6.4.299-box.
|
|
24
|
-
* pdfjsBuild =
|
|
23
|
+
* pdfjsVersion = 6.4.299-box.2
|
|
24
|
+
* pdfjsBuild = 9c8224a
|
|
25
25
|
*/
|
|
26
26
|
/******/ var __webpack_modules__ = ({
|
|
27
27
|
|
|
@@ -6839,6 +6839,12 @@ if (typeof Iterator.prototype.join !== "function") {
|
|
|
6839
6839
|
;// ./node_modules/core-js/modules/es.iterator.map.js
|
|
6840
6840
|
es_iterator_map_namespaceFn();
|
|
6841
6841
|
|
|
6842
|
+
;// ./node_modules/core-js/modules/es.weak-map.get-or-insert.js
|
|
6843
|
+
es_weak_map_get_or_insert_namespaceFn();
|
|
6844
|
+
|
|
6845
|
+
;// ./node_modules/core-js/modules/es.weak-map.get-or-insert-computed.js
|
|
6846
|
+
es_weak_map_get_or_insert_computed_namespaceFn();
|
|
6847
|
+
|
|
6842
6848
|
;// ./src/shared/math_clamp.js
|
|
6843
6849
|
function MathClamp(v, min, max) {
|
|
6844
6850
|
return Math.min(Math.max(v, min), max);
|
|
@@ -7299,6 +7305,8 @@ class XfaLayer {
|
|
|
7299
7305
|
|
|
7300
7306
|
|
|
7301
7307
|
|
|
7308
|
+
|
|
7309
|
+
|
|
7302
7310
|
|
|
7303
7311
|
|
|
7304
7312
|
|
|
@@ -7830,6 +7838,125 @@ function renderRichText({
|
|
|
7830
7838
|
fragment.firstElementChild.classList.add("richText", className);
|
|
7831
7839
|
container.append(fragment);
|
|
7832
7840
|
}
|
|
7841
|
+
const axisAlignedClipPaths = new WeakMap();
|
|
7842
|
+
const NEAR_ZERO_TRANSFORM_RATIO = 1e-6;
|
|
7843
|
+
const MIN_SNAPPED_CLIP_SIZE = 2;
|
|
7844
|
+
function isNearZero(value, scale) {
|
|
7845
|
+
return Math.abs(value) <= NEAR_ZERO_TRANSFORM_RATIO * Math.abs(scale);
|
|
7846
|
+
}
|
|
7847
|
+
function isAxisAlignedScale([a, b, c, d]) {
|
|
7848
|
+
return isNearZero(b, a) && isNearZero(c, d);
|
|
7849
|
+
}
|
|
7850
|
+
function isQuarterTurn([a, b, c, d]) {
|
|
7851
|
+
return isNearZero(a, b) && isNearZero(d, c);
|
|
7852
|
+
}
|
|
7853
|
+
function isAxisAlignedEdge(x0, y0, x1, y1) {
|
|
7854
|
+
return x0 === x1 || y0 === y1;
|
|
7855
|
+
}
|
|
7856
|
+
function updateMinSubpathSize(minSubpathSize, [minX, minY, maxX, maxY]) {
|
|
7857
|
+
const hasEdges = minX !== Infinity;
|
|
7858
|
+
if (hasEdges) {
|
|
7859
|
+
minSubpathSize[0] = Math.min(minSubpathSize[0], maxX - minX);
|
|
7860
|
+
minSubpathSize[1] = Math.min(minSubpathSize[1], maxY - minY);
|
|
7861
|
+
}
|
|
7862
|
+
}
|
|
7863
|
+
function getAxisAlignedPath(data) {
|
|
7864
|
+
const minSubpathSize = [Infinity, Infinity];
|
|
7865
|
+
let subpathMinMax = BBOX_INIT.slice();
|
|
7866
|
+
let hasSubpath = false;
|
|
7867
|
+
let startX = 0;
|
|
7868
|
+
let startY = 0;
|
|
7869
|
+
let currentX = 0;
|
|
7870
|
+
let currentY = 0;
|
|
7871
|
+
for (let i = 0, ii = data.length; i < ii;) {
|
|
7872
|
+
switch (data[i++]) {
|
|
7873
|
+
case DrawOPS.moveTo:
|
|
7874
|
+
if (!isAxisAlignedEdge(currentX, currentY, startX, startY)) {
|
|
7875
|
+
return null;
|
|
7876
|
+
}
|
|
7877
|
+
updateMinSubpathSize(minSubpathSize, subpathMinMax);
|
|
7878
|
+
subpathMinMax = BBOX_INIT.slice();
|
|
7879
|
+
hasSubpath = true;
|
|
7880
|
+
startX = currentX = data[i++];
|
|
7881
|
+
startY = currentY = data[i++];
|
|
7882
|
+
break;
|
|
7883
|
+
case DrawOPS.lineTo:
|
|
7884
|
+
{
|
|
7885
|
+
const x = data[i++];
|
|
7886
|
+
const y = data[i++];
|
|
7887
|
+
if (!hasSubpath || !isAxisAlignedEdge(currentX, currentY, x, y)) {
|
|
7888
|
+
return null;
|
|
7889
|
+
}
|
|
7890
|
+
Util.rectBoundingBox(currentX, currentY, x, y, subpathMinMax);
|
|
7891
|
+
currentX = x;
|
|
7892
|
+
currentY = y;
|
|
7893
|
+
break;
|
|
7894
|
+
}
|
|
7895
|
+
case DrawOPS.closePath:
|
|
7896
|
+
if (!isAxisAlignedEdge(currentX, currentY, startX, startY)) {
|
|
7897
|
+
return null;
|
|
7898
|
+
}
|
|
7899
|
+
updateMinSubpathSize(minSubpathSize, subpathMinMax);
|
|
7900
|
+
subpathMinMax = BBOX_INIT.slice();
|
|
7901
|
+
currentX = startX;
|
|
7902
|
+
currentY = startY;
|
|
7903
|
+
break;
|
|
7904
|
+
default:
|
|
7905
|
+
return null;
|
|
7906
|
+
}
|
|
7907
|
+
}
|
|
7908
|
+
if (!isAxisAlignedEdge(currentX, currentY, startX, startY)) {
|
|
7909
|
+
return null;
|
|
7910
|
+
}
|
|
7911
|
+
updateMinSubpathSize(minSubpathSize, subpathMinMax);
|
|
7912
|
+
const [minSubpathWidth, minSubpathHeight] = minSubpathSize;
|
|
7913
|
+
return minSubpathWidth > 0 && minSubpathHeight > 0 && minSubpathWidth < Infinity ? {
|
|
7914
|
+
data,
|
|
7915
|
+
minSubpathWidth,
|
|
7916
|
+
minSubpathHeight
|
|
7917
|
+
} : null;
|
|
7918
|
+
}
|
|
7919
|
+
function snapToDevicePixel(coordinate, scale, offset) {
|
|
7920
|
+
return (Math.round(scale * coordinate + offset) - offset) / scale;
|
|
7921
|
+
}
|
|
7922
|
+
function snapAxisAlignedPath({
|
|
7923
|
+
data,
|
|
7924
|
+
minSubpathWidth,
|
|
7925
|
+
minSubpathHeight
|
|
7926
|
+
}, transform) {
|
|
7927
|
+
const [a, b, c, d, e, f] = transform;
|
|
7928
|
+
let scaleX, offsetX, scaleY, offsetY;
|
|
7929
|
+
if (isAxisAlignedScale(transform)) {
|
|
7930
|
+
[scaleX, offsetX, scaleY, offsetY] = [a, e, d, f];
|
|
7931
|
+
} else if (isQuarterTurn(transform)) {
|
|
7932
|
+
[scaleX, offsetX, scaleY, offsetY] = [b, f, c, e];
|
|
7933
|
+
} else {
|
|
7934
|
+
return null;
|
|
7935
|
+
}
|
|
7936
|
+
if (Math.abs(scaleX * minSubpathWidth) < MIN_SNAPPED_CLIP_SIZE || Math.abs(scaleY * minSubpathHeight) < MIN_SNAPPED_CLIP_SIZE) {
|
|
7937
|
+
return null;
|
|
7938
|
+
}
|
|
7939
|
+
const snappedDrawOPS = [];
|
|
7940
|
+
for (let i = 0, ii = data.length; i < ii;) {
|
|
7941
|
+
const op = data[i++];
|
|
7942
|
+
snappedDrawOPS.push(op);
|
|
7943
|
+
if (op === DrawOPS.moveTo || op === DrawOPS.lineTo) {
|
|
7944
|
+
snappedDrawOPS.push(snapToDevicePixel(data[i++], scaleX, offsetX), snapToDevicePixel(data[i++], scaleY, offsetY));
|
|
7945
|
+
}
|
|
7946
|
+
}
|
|
7947
|
+
return snappedDrawOPS;
|
|
7948
|
+
}
|
|
7949
|
+
function recordClipPath(path, data) {
|
|
7950
|
+
const axisAlignedPath = getAxisAlignedPath(data);
|
|
7951
|
+
if (axisAlignedPath) {
|
|
7952
|
+
axisAlignedClipPaths.set(path, axisAlignedPath);
|
|
7953
|
+
}
|
|
7954
|
+
}
|
|
7955
|
+
function getPixelSnappedClipPath(path, transform) {
|
|
7956
|
+
const axisAlignedPath = axisAlignedClipPaths.get(path);
|
|
7957
|
+
const snappedDrawOPS = axisAlignedPath && snapAxisAlignedPath(axisAlignedPath, transform);
|
|
7958
|
+
return snappedDrawOPS ? makePathFromDrawOPS(snappedDrawOPS) : path;
|
|
7959
|
+
}
|
|
7833
7960
|
function makePathFromDrawOPS(data) {
|
|
7834
7961
|
const path = new Path2D();
|
|
7835
7962
|
if (!data) {
|
|
@@ -7863,12 +7990,6 @@ function makePathFromDrawOPS(data) {
|
|
|
7863
7990
|
;// ./node_modules/core-js/modules/es.iterator.take.js
|
|
7864
7991
|
es_iterator_take_namespaceFn();
|
|
7865
7992
|
|
|
7866
|
-
;// ./node_modules/core-js/modules/es.weak-map.get-or-insert.js
|
|
7867
|
-
es_weak_map_get_or_insert_namespaceFn();
|
|
7868
|
-
|
|
7869
|
-
;// ./node_modules/core-js/modules/es.weak-map.get-or-insert-computed.js
|
|
7870
|
-
es_weak_map_get_or_insert_computed_namespaceFn();
|
|
7871
|
-
|
|
7872
7993
|
;// ./node_modules/core-js/modules/web.dom-exception.stack.js
|
|
7873
7994
|
web_dom_exception_stack_namespaceFn();
|
|
7874
7995
|
|
|
@@ -8195,7 +8316,7 @@ class FloatingToolbar {
|
|
|
8195
8316
|
}
|
|
8196
8317
|
|
|
8197
8318
|
;// ./src/shared/internal_evt.js
|
|
8198
|
-
const INTERNAL_EVT = "
|
|
8319
|
+
const INTERNAL_EVT = "b73885cd-1954-4723-8cc0-0364b7abb527";
|
|
8199
8320
|
const internalOpt = Object.freeze({
|
|
8200
8321
|
internal: INTERNAL_EVT
|
|
8201
8322
|
});
|
|
@@ -16846,8 +16967,9 @@ function mirrorContextOperations(ctx, destCtx) {
|
|
|
16846
16967
|
};
|
|
16847
16968
|
}
|
|
16848
16969
|
function drawImageAtIntegerCoords(ctx, srcImg, srcX, srcY, srcW, srcH, destX, destY, destW, destH) {
|
|
16849
|
-
const
|
|
16850
|
-
|
|
16970
|
+
const transform = getCurrentTransform(ctx);
|
|
16971
|
+
const [a, b, c, d, tx, ty] = transform;
|
|
16972
|
+
if (isAxisAlignedScale(transform)) {
|
|
16851
16973
|
const tlX = destX * a + tx;
|
|
16852
16974
|
const rTlX = Math.round(tlX);
|
|
16853
16975
|
const tlY = destY * d + ty;
|
|
@@ -16861,7 +16983,7 @@ function drawImageAtIntegerCoords(ctx, srcImg, srcX, srcY, srcW, srcH, destX, de
|
|
|
16861
16983
|
ctx.setTransform(a, b, c, d, tx, ty);
|
|
16862
16984
|
return [rWidth, rHeight];
|
|
16863
16985
|
}
|
|
16864
|
-
if (
|
|
16986
|
+
if (isQuarterTurn(transform)) {
|
|
16865
16987
|
const tlX = destY * c + tx;
|
|
16866
16988
|
const rTlX = Math.round(tlX);
|
|
16867
16989
|
const tlY = destX * b + ty;
|
|
@@ -18087,7 +18209,11 @@ class CanvasGraphics {
|
|
|
18087
18209
|
this.dependencyTracker.resetBBox(opIdx).recordBBox(opIdx, this.ctx, minMax[0] - outerExtraSize, minMax[2] + outerExtraSize, minMax[1] - outerExtraSize, minMax[3] + outerExtraSize).recordDependencies(opIdx, ["transform"]);
|
|
18088
18210
|
}
|
|
18089
18211
|
if (!(path instanceof Path2D)) {
|
|
18090
|
-
|
|
18212
|
+
const drawOPS = path;
|
|
18213
|
+
path = data[0] = makePathFromDrawOPS(drawOPS);
|
|
18214
|
+
if (this.pendingClip) {
|
|
18215
|
+
recordClipPath(path, drawOPS);
|
|
18216
|
+
}
|
|
18091
18217
|
}
|
|
18092
18218
|
Util.axialAlignedBoundingBox(minMax, getCurrentTransform(this.ctx), this.current.minMax);
|
|
18093
18219
|
const tilingDims = this.current.tilingPatternDims;
|
|
@@ -19417,10 +19543,11 @@ class CanvasGraphics {
|
|
|
19417
19543
|
const ctx = this.ctx;
|
|
19418
19544
|
if (this.pendingClip) {
|
|
19419
19545
|
if (!isEmpty) {
|
|
19546
|
+
const clipPath = getPixelSnappedClipPath(path, getCurrentTransform(ctx));
|
|
19420
19547
|
if (this.pendingClip === EO_CLIP) {
|
|
19421
|
-
ctx.clip(
|
|
19548
|
+
ctx.clip(clipPath, "evenodd");
|
|
19422
19549
|
} else {
|
|
19423
|
-
ctx.clip(
|
|
19550
|
+
ctx.clip(clipPath);
|
|
19424
19551
|
}
|
|
19425
19552
|
}
|
|
19426
19553
|
this.pendingClip = null;
|
|
@@ -21810,7 +21937,7 @@ function getDocument(src = {}) {
|
|
|
21810
21937
|
}
|
|
21811
21938
|
const docParams = {
|
|
21812
21939
|
docId,
|
|
21813
|
-
apiVersion: "6.4.299-box.
|
|
21940
|
+
apiVersion: "6.4.299-box.2",
|
|
21814
21941
|
data,
|
|
21815
21942
|
password,
|
|
21816
21943
|
disableAutoFetch,
|
|
@@ -23511,8 +23638,8 @@ class InternalRenderTask {
|
|
|
23511
23638
|
}
|
|
23512
23639
|
}
|
|
23513
23640
|
}
|
|
23514
|
-
const api_version = "6.4.299-box.
|
|
23515
|
-
const build = "
|
|
23641
|
+
const api_version = "6.4.299-box.2";
|
|
23642
|
+
const build = "9c8224a";
|
|
23516
23643
|
|
|
23517
23644
|
;// ./node_modules/core-js/modules/es.math.sum-precise.js
|
|
23518
23645
|
es_math_sum_precise_namespaceFn();
|