@box/pdfjs-dist 6.4.299-box.1 → 6.4.299-box.3

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/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@box/pdfjs-dist",
3
- "version": "6.4.299-box.1",
3
+ "version": "6.4.299-box.3",
4
+ "author": "Box",
4
5
  "main": "build/pdf.mjs",
5
6
  "types": "types/src/pdf.d.ts",
6
7
  "description": "Box build of Mozilla's PDF.js library.",
@@ -24,11 +25,11 @@
24
25
  },
25
26
  "repository": {
26
27
  "type": "git",
27
- "url": "git+https://github.com/mozilla/pdf.js.git"
28
+ "url": "git+https://git.dev.box.net/Preview/pdfjs.git"
28
29
  },
29
30
  "engines": {
30
31
  "node": ">=22.13.0 || >=24"
31
32
  },
32
33
  "scripts": {},
33
- "gitHead": "99c657fb138220d0ad7be7c11dbcaa044e2b8c45"
34
+ "gitHead": "acc20024a21d922ff9cde3e9e82676358df970a4"
34
35
  }
@@ -1,4 +1,10 @@
1
+ export type AxisAlignedPath = {
2
+ data: Float32Array | Array<number>;
3
+ minSubpathWidth: number;
4
+ minSubpathHeight: number;
5
+ };
1
6
  export function applyOpacity(color: any, opacity: any): any;
7
+ export function areBoxChangesEnabled(): boolean;
2
8
  export class ColorScheme {
3
9
  static get isDarkMode(): any;
4
10
  }
@@ -18,6 +24,12 @@ export function fetchData(url: any, type?: string): Promise<any>;
18
24
  * @returns {string}
19
25
  */
20
26
  export function findContrastColor(baseColor: Array<number>, fixedColor: Array<number>): string;
27
+ /**
28
+ * Returns the path's subpath sizes when every edge is horizontal or vertical.
29
+ * @param {Float32Array|Array<number>} data
30
+ * @returns {AxisAlignedPath|null}
31
+ */
32
+ export function getAxisAlignedPath(data: Float32Array | Array<number>): AxisAlignedPath | null;
21
33
  export function getColorValues(colors: any): void;
22
34
  export function getCurrentTransform(ctx: any): any[];
23
35
  export function getCurrentTransformInverse(ctx: any): any[];
@@ -35,10 +47,29 @@ export function getFilenameFromUrl(url: string): string;
35
47
  * @returns {string} Guessed PDF filename.
36
48
  */
37
49
  export function getPdfFilenameFromUrl(url: string, defaultFilename?: string): string;
50
+ /**
51
+ * Returns a pixel-snapped copy of a recorded clip path, or the path itself.
52
+ * @param {Path2D} path
53
+ * @param {Array<number>} transform
54
+ * @returns {Path2D}
55
+ */
56
+ export function getPixelSnappedClipPath(path: Path2D, transform: Array<number>): Path2D;
38
57
  export function getRGB(color: any): any[];
39
58
  export function getRGBA(color: any): any[] | null;
59
+ /**
60
+ * Checks whether a transform only scales, flips and translates.
61
+ * @param {Array<number>} transform
62
+ * @returns {boolean}
63
+ */
64
+ export function isAxisAlignedScale([a, b, c, d]: Array<number>): boolean;
40
65
  export function isDataScheme(url: any): boolean;
41
66
  export function isPdfFile(filename: any): boolean;
67
+ /**
68
+ * Checks whether a transform swaps the axes, as a quarter turn does.
69
+ * @param {Array<number>} transform
70
+ * @returns {boolean}
71
+ */
72
+ export function isQuarterTurn([a, b, c, d]: Array<number>): boolean;
42
73
  export function isValidFetchUrl(url: any, baseUrl: any): boolean;
43
74
  export function makePathFromDrawOPS(data: any): Path2D;
44
75
  /**
@@ -98,6 +129,12 @@ export class PixelsPerInch {
98
129
  static PDF: number;
99
130
  static PDF_TO_CSS_UNITS: number;
100
131
  }
132
+ /**
133
+ * Stores an axis-aligned clip path for getPixelSnappedClipPath.
134
+ * @param {Path2D} path
135
+ * @param {Float32Array|Array<number>} data
136
+ */
137
+ export function recordClipPath(path: Path2D, data: Float32Array | Array<number>): void;
101
138
  declare const RenderingCancelledException_base: any;
102
139
  export class RenderingCancelledException extends RenderingCancelledException_base {
103
140
  [x: string]: any;
@@ -109,6 +146,13 @@ export function renderRichText({ html, dir, className }: {
109
146
  dir: any;
110
147
  className: any;
111
148
  }, container: any): void;
149
+ /**
150
+ * Turns Box's runtime changes to PDF.js on or off for every document; call it
151
+ * between renders. They are on by default; with them off, pages render like
152
+ * the upstream release this build is based on.
153
+ * @param {boolean} enabled
154
+ */
155
+ export function setBoxChangesEnabled(enabled: boolean): void;
112
156
  /**
113
157
  * @param {HTMLDivElement} div
114
158
  * @param {PageViewport} viewport
@@ -116,6 +160,13 @@ export function renderRichText({ html, dir, className }: {
116
160
  * @param {boolean} mustRotate
117
161
  */
118
162
  export function setLayerDimensions(div: HTMLDivElement, viewport: PageViewport, mustFlip?: boolean, mustRotate?: boolean): void;
163
+ /**
164
+ * Rounds every point to a device pixel the way drawImageAtIntegerCoords does.
165
+ * @param {AxisAlignedPath} axisAlignedPath
166
+ * @param {Array<number>} transform
167
+ * @returns {Array<number>|null}
168
+ */
169
+ export function snapAxisAlignedPath({ data, minSubpathWidth, minSubpathHeight }: AxisAlignedPath, transform: Array<number>): Array<number> | null;
119
170
  export class StatTimer {
120
171
  times: any[];
121
172
  time(name: any): void;
@@ -53,6 +53,7 @@ import { PixelsPerInch } from "./display/display_utils.js";
53
53
  import { RenderingCancelledException } from "./display/display_utils.js";
54
54
  import { renderRichText } from "./display/display_utils.js";
55
55
  import { ResponseException } from "./shared/util.js";
56
+ import { setBoxChangesEnabled } from "./display/display_utils.js";
56
57
  import { setLayerDimensions } from "./display/display_utils.js";
57
58
  import { shadow } from "./shared/util.js";
58
59
  import { SignatureExtractor } from "./display/editor/drawers/signaturedraw.js";
@@ -66,4 +67,4 @@ import { Util } from "./shared/util.js";
66
67
  import { VerbosityLevel } from "./shared/util.js";
67
68
  import { version } from "./display/api.js";
68
69
  import { XfaLayer } from "./display/xfa_layer.js";
69
- export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, AnnotationType, applyOpacity, build, ColorPicker, createValidAbsoluteUrl, CSSConstants, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, findContrastColor, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getRGB, getRGBA, getUuid, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, isValidExplicitDest, makeArr, makeMap, makeObj, makeSet, MathClamp, noContextMenu, normalizeUnicode, OPS, OutputScale, PasswordException, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, renderRichText, ResponseException, setLayerDimensions, shadow, SignatureExtractor, stopEvent, SupportedImageMimeTypes, TextLayer, TextLayerImages, TouchManager, updateUrlHash, Util, VerbosityLevel, version, XfaLayer };
70
+ export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, AnnotationType, applyOpacity, build, ColorPicker, createValidAbsoluteUrl, CSSConstants, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, findContrastColor, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getRGB, getRGBA, getUuid, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, isValidExplicitDest, makeArr, makeMap, makeObj, makeSet, MathClamp, noContextMenu, normalizeUnicode, OPS, OutputScale, PasswordException, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, renderRichText, ResponseException, setBoxChangesEnabled, setLayerDimensions, shadow, SignatureExtractor, stopEvent, SupportedImageMimeTypes, TextLayer, TextLayerImages, TouchManager, updateUrlHash, Util, VerbosityLevel, version, XfaLayer };
@@ -20,8 +20,8 @@
20
20
  */
21
21
 
22
22
  /**
23
- * pdfjsVersion = 6.4.299-box.1
24
- * pdfjsBuild = 99c657f
23
+ * pdfjsVersion = 6.4.299-box.3
24
+ * pdfjsBuild = acc2002
25
25
  */
26
26
 
27
27
  ;// ./web/pdfjs.js
@@ -75,6 +75,7 @@ const {
75
75
  RenderingCancelledException,
76
76
  renderRichText,
77
77
  ResponseException,
78
+ setBoxChangesEnabled,
78
79
  setLayerDimensions,
79
80
  shadow,
80
81
  SignatureExtractor,
@@ -627,7 +628,7 @@ const calcRound = function () {
627
628
  }();
628
629
 
629
630
  ;// ./web/internal_evt.js
630
- const INTERNAL_EVT = "32533502-63d2-47b3-84b0-128ba9620ee0";
631
+ const INTERNAL_EVT = "1f166d3a-715c-4c7a-a062-1e0ddfefab93";
631
632
  const internalOpt = Object.freeze({
632
633
  internal: INTERNAL_EVT
633
634
  });
@@ -7985,7 +7986,7 @@ class PDFViewer {
7985
7986
  #savedPageViews = null;
7986
7987
  #deletedPageNumbers = null;
7987
7988
  constructor(options) {
7988
- const viewerVersion = "6.4.299-box.1";
7989
+ const viewerVersion = "6.4.299-box.3";
7989
7990
  if (version !== viewerVersion) {
7990
7991
  throw new Error(`The API version "${version}" does not match the Viewer version "${viewerVersion}".`);
7991
7992
  }