pdfjs-serverless 1.0.1 → 1.1.0

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.
Files changed (48) hide show
  1. package/README.md +1 -1
  2. package/dist/index.mjs +1 -1
  3. package/dist/types/src/display/annotation_layer.d.ts +10 -2
  4. package/dist/types/src/display/api.d.ts +53 -75
  5. package/dist/types/src/display/api_utils.d.ts +13 -0
  6. package/dist/types/src/display/canvas.d.ts +82 -80
  7. package/dist/types/src/display/canvas_dependency_tracker.d.ts +144 -0
  8. package/dist/types/src/display/display_utils.d.ts +3 -2
  9. package/dist/types/src/display/draw_layer.d.ts +2 -2
  10. package/dist/types/src/display/editor/alt_text.d.ts +1 -1
  11. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +6 -6
  12. package/dist/types/src/display/editor/color_picker.d.ts +20 -1
  13. package/dist/types/src/display/editor/comment.d.ts +32 -0
  14. package/dist/types/src/display/editor/draw.d.ts +8 -8
  15. package/dist/types/src/display/editor/drawers/freedraw.d.ts +3 -3
  16. package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +13 -13
  17. package/dist/types/src/display/editor/editor.d.ts +54 -5
  18. package/dist/types/src/display/editor/freetext.d.ts +11 -7
  19. package/dist/types/src/display/editor/highlight.d.ts +6 -3
  20. package/dist/types/src/display/editor/ink.d.ts +4 -0
  21. package/dist/types/src/display/editor/signature.d.ts +2 -0
  22. package/dist/types/src/display/editor/stamp.d.ts +3 -1
  23. package/dist/types/src/display/editor/toolbar.d.ts +6 -3
  24. package/dist/types/src/display/editor/tools.d.ts +16 -4
  25. package/dist/types/src/display/fetch_stream.d.ts +2 -2
  26. package/dist/types/src/display/pdf_objects.d.ts +40 -0
  27. package/dist/types/src/display/text_layer.d.ts +9 -9
  28. package/dist/types/src/display/worker_options.d.ts +2 -2
  29. package/dist/types/src/pdf.d.ts +3 -2
  30. package/dist/types/src/shared/scripting_utils.d.ts +2 -0
  31. package/dist/types/src/shared/util.d.ts +9 -5
  32. package/dist/types/web/annotation_layer_builder.d.ts +4 -1
  33. package/dist/types/web/app_options.d.ts +1 -1
  34. package/dist/types/web/autolinker.d.ts +2 -2
  35. package/dist/types/web/base_pdf_page_view.d.ts +2 -1
  36. package/dist/types/web/event_utils.d.ts +1 -1
  37. package/dist/types/web/genericl10n.d.ts +5 -5
  38. package/dist/types/web/interfaces.d.ts +7 -0
  39. package/dist/types/web/l10n.d.ts +2 -2
  40. package/dist/types/web/pdf_find_controller.d.ts +1 -1
  41. package/dist/types/web/pdf_link_service.d.ts +7 -0
  42. package/dist/types/web/pdf_page_detail_view.d.ts +1 -0
  43. package/dist/types/web/pdf_page_view.d.ts +18 -7
  44. package/dist/types/web/pdf_thumbnail_view.d.ts +2 -10
  45. package/dist/types/web/pdf_viewer.d.ts +55 -1
  46. package/dist/types/web/text_accessibility.d.ts +1 -1
  47. package/dist/types/web/text_layer_builder.d.ts +4 -4
  48. package/package.json +10 -10
@@ -31,24 +31,24 @@ export type TextLayerUpdateParameters = {
31
31
  onBefore?: Function | undefined;
32
32
  };
33
33
  export class TextLayer {
34
- static "__#54@#ascentCache": Map<any, any>;
35
- static "__#54@#canvasContexts": Map<any, any>;
36
- static "__#54@#canvasCtxFonts": WeakMap<object, any>;
37
- static "__#54@#minFontSize": null;
38
- static "__#54@#pendingTextLayers": Set<any>;
34
+ static #ascentCache: Map<any, any>;
35
+ static #canvasContexts: Map<any, any>;
36
+ static #canvasCtxFonts: WeakMap<object, any>;
37
+ static #minFontSize: null;
38
+ static #pendingTextLayers: Set<any>;
39
39
  static get fontFamilyMap(): any;
40
40
  /**
41
41
  * Clean-up global textLayer data.
42
42
  * @returns {undefined}
43
43
  */
44
44
  static cleanup(): undefined;
45
- static "__#54@#getCtx"(lang?: null): any;
46
- static "__#54@#ensureCtxFont"(ctx: any, size: any, family: any): void;
45
+ static #getCtx(lang?: null): any;
46
+ static #ensureCtxFont(ctx: any, size: any, family: any): void;
47
47
  /**
48
48
  * Compute the minimum font size enforced by the browser.
49
49
  */
50
- static "__#54@#ensureMinFontSizeComputed"(): void;
51
- static "__#54@#getAscent"(fontFamily: any, style: any, lang: any): any;
50
+ static #ensureMinFontSizeComputed(): void;
51
+ static #getAscent(fontFamily: any, style: any, lang: any): any;
52
52
  /**
53
53
  * @param {TextLayerParameters} options
54
54
  */
@@ -1,6 +1,6 @@
1
1
  export class GlobalWorkerOptions {
2
- static "__#50@#port": null;
3
- static "__#50@#src": string;
2
+ static #port: null;
3
+ static #src: string;
4
4
  /**
5
5
  * @param {Worker | null} workerPort - Defines global port for worker process.
6
6
  * Overrides the `workerSrc` option.
@@ -22,6 +22,7 @@ import { fetchData } from "./display/display_utils.js";
22
22
  import { getDocument } from "./display/api.js";
23
23
  import { getFilenameFromUrl } from "./display/display_utils.js";
24
24
  import { getPdfFilenameFromUrl } from "./display/display_utils.js";
25
+ import { getRGB } from "./display/display_utils.js";
25
26
  import { getUuid } from "./shared/util.js";
26
27
  import { getXfaPageViewport } from "./display/display_utils.js";
27
28
  import { GlobalWorkerOptions } from "./display/worker_options.js";
@@ -29,7 +30,7 @@ import { ImageKind } from "./shared/util.js";
29
30
  import { InvalidPDFException } from "./shared/util.js";
30
31
  import { isDataScheme } from "./display/display_utils.js";
31
32
  import { isPdfFile } from "./display/display_utils.js";
32
- import { isValidExplicitDest } from "./display/api.js";
33
+ import { isValidExplicitDest } from "./display/api_utils.js";
33
34
  import { MathClamp } from "./shared/util.js";
34
35
  import { noContextMenu } from "./display/display_utils.js";
35
36
  import { normalizeUnicode } from "./shared/util.js";
@@ -55,4 +56,4 @@ import { Util } from "./shared/util.js";
55
56
  import { VerbosityLevel } from "./shared/util.js";
56
57
  import { version } from "./display/api.js";
57
58
  import { XfaLayer } from "./display/xfa_layer.js";
58
- export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, AnnotationType, build, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getUuid, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, isValidExplicitDest, MathClamp, noContextMenu, normalizeUnicode, OPS, OutputScale, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, ResponseException, setLayerDimensions, shadow, SignatureExtractor, stopEvent, SupportedImageMimeTypes, TextLayer, TouchManager, updateUrlHash, Util, VerbosityLevel, version, XfaLayer };
59
+ export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, AnnotationType, build, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getRGB, getUuid, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, isValidExplicitDest, MathClamp, noContextMenu, normalizeUnicode, OPS, OutputScale, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, ResponseException, setLayerDimensions, shadow, SignatureExtractor, stopEvent, SupportedImageMimeTypes, TextLayer, TouchManager, updateUrlHash, Util, VerbosityLevel, version, XfaLayer };
@@ -14,3 +14,5 @@ export class ColorConverters {
14
14
  static CMYK_HTML(components: any): string;
15
15
  static RGB_CMYK([r, g, b]: [any, any, any]): (string | number)[];
16
16
  }
17
+ export const DateFormats: string[];
18
+ export const TimeFormats: string[];
@@ -40,7 +40,6 @@ export namespace AnnotationEditorParamsType {
40
40
  let INK_THICKNESS: number;
41
41
  let INK_OPACITY: number;
42
42
  let HIGHLIGHT_COLOR: number;
43
- let HIGHLIGHT_DEFAULT_COLOR: number;
44
43
  let HIGHLIGHT_THICKNESS: number;
45
44
  let HIGHLIGHT_FREE: number;
46
45
  let HIGHLIGHT_SHOW_ALL: number;
@@ -54,7 +53,9 @@ export namespace AnnotationEditorType {
54
53
  let HIGHLIGHT: number;
55
54
  let STAMP: number;
56
55
  let INK: number;
56
+ let POPUP: number;
57
57
  let SIGNATURE: number;
58
+ let COMMENT: number;
58
59
  }
59
60
  export namespace AnnotationFieldFlag {
60
61
  let READONLY: number;
@@ -123,7 +124,8 @@ export namespace AnnotationType {
123
124
  export let CARET: number;
124
125
  let INK_1: number;
125
126
  export { INK_1 as INK };
126
- export let POPUP: number;
127
+ let POPUP_1: number;
128
+ export { POPUP_1 as POPUP };
127
129
  export let FILEATTACHMENT: number;
128
130
  export let SOUND: number;
129
131
  export let MOVIE: number;
@@ -350,7 +352,7 @@ export function setVerbosityLevel(level: any): void;
350
352
  export function shadow(obj: any, prop: any, value: any, nonSerializable?: boolean): any;
351
353
  export function string32(value: any): string;
352
354
  export function stringToBytes(str: any): Uint8Array<any>;
353
- export function stringToPDFString(str: any): string;
355
+ export function stringToPDFString(str: any, keepEscapeSequence?: boolean): string;
354
356
  export function stringToUTF8String(str: any): string;
355
357
  export namespace TextRenderingMode {
356
358
  export let FILL: number;
@@ -386,8 +388,10 @@ export function updateUrlHash(url: URL | string, hash: string, allowRel?: boolea
386
388
  export function utf8StringToString(str: any): string;
387
389
  export class Util {
388
390
  static makeHexColor(r: any, g: any, b: any): string;
391
+ static domMatrixToTransform(dm: any): any[];
389
392
  static scaleMinMax(transform: any, minMax: any): void;
390
393
  static transform(m1: any, m2: any): any[];
394
+ static multiplyByDOMMatrix(m: any, md: any): any[];
391
395
  static applyTransform(p: any, m: any, pos?: number): void;
392
396
  static applyTransformToBezier(p: any, transform: any, pos?: number): void;
393
397
  static applyInverseTransform(p: any, m: any): void;
@@ -398,8 +402,8 @@ export class Util {
398
402
  static intersect(rect1: any, rect2: any): number[] | null;
399
403
  static pointBoundingBox(x: any, y: any, minMax: any): void;
400
404
  static rectBoundingBox(x0: any, y0: any, x1: any, y1: any, minMax: any): void;
401
- static "__#1@#getExtremumOnCurve"(x0: any, x1: any, x2: any, x3: any, y0: any, y1: any, y2: any, y3: any, t: any, minMax: any): void;
402
- static "__#1@#getExtremum"(x0: any, x1: any, x2: any, x3: any, y0: any, y1: any, y2: any, y3: any, a: any, b: any, c: any, minMax: any): void;
405
+ static #getExtremumOnCurve(x0: any, x1: any, x2: any, x3: any, y0: any, y1: any, y2: any, y3: any, t: any, minMax: any): void;
406
+ static #getExtremum(x0: any, x1: any, x2: any, x3: any, y0: any, y1: any, y2: any, y3: any, a: any, b: any, c: any, minMax: any): void;
403
407
  static bezierBoundingBox(x0: any, y0: any, x1: any, y1: any, x2: any, y2: any, x3: any, y3: any, minMax: any): void;
404
408
  }
405
409
  export namespace VerbosityLevel {
@@ -17,6 +17,7 @@ export type AnnotationLayerBuilderOptions = {
17
17
  renderForms: boolean;
18
18
  linkService: IPDFLinkService;
19
19
  downloadManager?: import("./interfaces").IDownloadManager | undefined;
20
+ enableComment?: boolean | undefined;
20
21
  enableScripting?: boolean | undefined;
21
22
  hasJSActionsPromise?: Promise<boolean> | undefined;
22
23
  fieldObjectsPromise?: Promise<{
@@ -49,6 +50,7 @@ export type InjectLinkAnnotationsOptions = {
49
50
  * @property {boolean} renderForms
50
51
  * @property {IPDFLinkService} linkService
51
52
  * @property {IDownloadManager} [downloadManager]
53
+ * @property {boolean} [enableComment]
52
54
  * @property {boolean} [enableScripting]
53
55
  * @property {Promise<boolean>} [hasJSActionsPromise]
54
56
  * @property {Promise<Object<string, Array<Object>> | null>}
@@ -74,13 +76,14 @@ export class AnnotationLayerBuilder {
74
76
  /**
75
77
  * @param {AnnotationLayerBuilderOptions} options
76
78
  */
77
- constructor({ pdfPage, linkService, downloadManager, annotationStorage, imageResourcesPath, renderForms, enableScripting, hasJSActionsPromise, fieldObjectsPromise, annotationCanvasMap, accessibilityManager, annotationEditorUIManager, onAppend, }: AnnotationLayerBuilderOptions);
79
+ constructor({ pdfPage, linkService, downloadManager, annotationStorage, imageResourcesPath, renderForms, enableComment, enableScripting, hasJSActionsPromise, fieldObjectsPromise, annotationCanvasMap, accessibilityManager, annotationEditorUIManager, onAppend, }: AnnotationLayerBuilderOptions);
78
80
  pdfPage: import("../src/display/api").PDFPageProxy;
79
81
  linkService: import("./interfaces").IPDFLinkService;
80
82
  downloadManager: import("./interfaces").IDownloadManager | undefined;
81
83
  imageResourcesPath: string;
82
84
  renderForms: boolean;
83
85
  annotationStorage: import("../src/display/annotation_storage").AnnotationStorage;
86
+ enableComment: boolean;
84
87
  enableScripting: boolean;
85
88
  _hasJSActionsPromise: Promise<boolean>;
86
89
  _fieldObjectsPromise: Promise<{
@@ -1,6 +1,6 @@
1
1
  export class AppOptions {
2
2
  static eventBus: any;
3
- static "__#72@#opts": Map<any, any>;
3
+ static #opts: Map<any, any>;
4
4
  static get(name: any): any;
5
5
  static getAll(kind?: null, defaultOnly?: boolean): any;
6
6
  static set(name: any, value: any): void;
@@ -1,6 +1,6 @@
1
1
  export class Autolinker {
2
- static "__#73@#index": number;
3
- static "__#73@#regex": any;
2
+ static #index: number;
3
+ static #regex: any;
4
4
  static findLinks(text: any): {
5
5
  url: string;
6
6
  index: any;
@@ -3,9 +3,11 @@ export class BasePDFPageView {
3
3
  canvas: null;
4
4
  /** @type {null | HTMLDivElement} */
5
5
  div: null | HTMLDivElement;
6
+ enableOptimizedPartialRendering: boolean;
6
7
  eventBus: null;
7
8
  id: null;
8
9
  pageColors: null;
10
+ recordedGroups: null;
9
11
  renderingQueue: null;
10
12
  renderTask: null;
11
13
  resume: null;
@@ -14,7 +16,6 @@ export class BasePDFPageView {
14
16
  _createCanvas(onShow: any, hideUntilComplete?: boolean): {
15
17
  canvas: HTMLCanvasElement;
16
18
  prevCanvas: null;
17
- ctx: CanvasRenderingContext2D | null;
18
19
  };
19
20
  _resetCanvas(): void;
20
21
  _drawCanvas(options: any, onCancel: any, onFinish: any): Promise<void>;
@@ -47,7 +47,7 @@ export class EventBus {
47
47
  #private;
48
48
  }
49
49
  /**
50
- * NOTE: Only used in the Firefox build-in pdf viewer.
50
+ * NOTE: Only used in the Firefox built-in pdf viewer.
51
51
  */
52
52
  export class FirefoxEventBus extends EventBus {
53
53
  constructor(globalEventNames: any, externalServices: any, isInAutomation: any);
@@ -9,14 +9,14 @@ export class GenericL10n extends L10n implements IL10n {
9
9
  * translations.
10
10
  * @param {String} baseLang - The base language to use for translations.
11
11
  */
12
- static "__#69@#generateBundles"(defaultLang: string, baseLang: string): AsyncGenerator<any, void, unknown>;
13
- static "__#69@#createBundle"(lang: any, baseURL: any, paths: any): Promise<any>;
14
- static "__#69@#getPaths"(): Promise<{
12
+ static #generateBundles(defaultLang: string, baseLang: string): AsyncGenerator<any, void, unknown>;
13
+ static #createBundle(lang: any, baseURL: any, paths: any): Promise<any>;
14
+ static #getPaths(): Promise<{
15
15
  baseURL: any;
16
16
  paths: any;
17
17
  }>;
18
- static "__#69@#generateBundlesFallback"(lang: any): AsyncGenerator<any, void, unknown>;
19
- static "__#69@#createBundleFallback"(lang: any): Promise<any>;
18
+ static #generateBundlesFallback(lang: any): AsyncGenerator<any, void, unknown>;
19
+ static #createBundleFallback(lang: any): Promise<any>;
20
20
  constructor(lang: any);
21
21
  }
22
22
  import { L10n } from "./l10n.js";
@@ -109,6 +109,13 @@ export class IPDFLinkService {
109
109
  * @param {number|string} val - The page number, or page label.
110
110
  */
111
111
  goToPage(val: number | string): void;
112
+ /**
113
+ * Scrolls to a specific location in the PDF document.
114
+ * @param {number} pageNumber - The page number to scroll to.
115
+ * @param {number} x - The x-coordinate to scroll to in page coordinates.
116
+ * @param {number} y - The y-coordinate to scroll to in page coordinates.
117
+ */
118
+ goToXY(pageNumber: number, x: number, y: number): void;
112
119
  /**
113
120
  * @param {HTMLAnchorElement} link
114
121
  * @param {string} url
@@ -7,8 +7,8 @@ export const GenericL10n: null;
7
7
  * @implements {IL10n}
8
8
  */
9
9
  export class L10n implements IL10n {
10
- static "__#68@#fixupLangCode"(langCode: any): any;
11
- static "__#68@#isRTL"(lang: any): boolean;
10
+ static #fixupLangCode(langCode: any): any;
11
+ static #isRTL(lang: any): boolean;
12
12
  constructor({ lang, isRTL }: {
13
13
  lang: any;
14
14
  isRTL: any;
@@ -24,7 +24,7 @@ export namespace FindState {
24
24
  let PENDING: number;
25
25
  }
26
26
  export function getOriginalIndex(diffs: any, pos: any, len: any): any[];
27
- export function normalize(text: any): any[];
27
+ export function normalize(text: any, options?: {}): any[];
28
28
  /**
29
29
  * @typedef {Object} PDFFindControllerOptions
30
30
  * @property {IPDFLinkService} linkService - The navigation/linking service.
@@ -100,6 +100,13 @@ export class PDFLinkService implements IPDFLinkService {
100
100
  * @param {number|string} val - The page number, or page label.
101
101
  */
102
102
  goToPage(val: number | string): void;
103
+ /**
104
+ * Scrolls to a specific location in the PDF document.
105
+ * @param {number} pageNumber - The page number to scroll to.
106
+ * @param {number} x - The x-coordinate to scroll to in page coordinates.
107
+ * @param {number} y - The y-coordinate to scroll to in page coordinates.
108
+ */
109
+ goToXY(pageNumber: number, x: number, y: number): void;
103
110
  /**
104
111
  * Adds various attributes (href, title, target, rel) to hyperlinks.
105
112
  * @param {HTMLAnchorElement} link
@@ -26,6 +26,7 @@ export class PDFPageDetailView extends BasePDFPageView implements IRenderableVie
26
26
  visibleArea?: null | undefined;
27
27
  underlyingViewUpdated?: boolean | undefined;
28
28
  }): void;
29
+ _getRenderingContext(canvas: any, transform: any): any;
29
30
  draw(): Promise<void>;
30
31
  #private;
31
32
  }
@@ -66,6 +66,12 @@ export type PDFPageViewOptions = {
66
66
  * The default value is 32767.
67
67
  */
68
68
  maxCanvasDim?: number | undefined;
69
+ /**
70
+ * - Cap the canvas area to the
71
+ * viewport increased by the value in percent. Use `-1` for no limit.
72
+ * The default value is 200%.
73
+ */
74
+ capCanvasAreaFactor?: number | undefined;
69
75
  /**
70
76
  * - When enabled, if the rendered
71
77
  * pages would need a canvas that is larger than `maxCanvasPixels` or
@@ -74,6 +80,14 @@ export type PDFPageViewOptions = {
74
80
  * The default value is `true`.
75
81
  */
76
82
  enableDetailCanvas?: boolean | undefined;
83
+ /**
84
+ * - When enabled, PDF
85
+ * rendering will keep track of which areas of the page each PDF operation
86
+ * affects. Then, when rendering a partial page (if `enableDetailCanvas` is
87
+ * enabled), it will only run through the operations that affect that portion.
88
+ * The default value is `false`.
89
+ */
90
+ enableOptimizedPartialRendering?: boolean | undefined;
77
91
  /**
78
92
  * - Overwrites background and foreground colors
79
93
  * with user defined ones in order to improve readability in high contrast
@@ -89,11 +103,6 @@ export type PDFPageViewOptions = {
89
103
  * the necessary layer-properties.
90
104
  */
91
105
  layerProperties?: Object | undefined;
92
- /**
93
- * - Enables hardware acceleration for
94
- * rendering. The default value is `false`.
95
- */
96
- enableHWA?: boolean | undefined;
97
106
  /**
98
107
  * - Enable creation of hyperlinks from
99
108
  * text that look like URLs. The default value is `true`.
@@ -120,6 +129,7 @@ export class PDFPageView extends BasePDFPageView implements IRenderableView {
120
129
  enableDetailCanvas: boolean;
121
130
  maxCanvasPixels: any;
122
131
  maxCanvasDim: any;
132
+ capCanvasAreaFactor: any;
123
133
  l10n: import("./interfaces").IL10n | GenericL10n | undefined;
124
134
  _isStandalone: boolean | undefined;
125
135
  _container: HTMLDivElement | undefined;
@@ -197,8 +207,8 @@ export class PDFPageView extends BasePDFPageView implements IRenderableView {
197
207
  get height(): number;
198
208
  getPagePoint(x: any, y: any): any[];
199
209
  _ensureCanvasWrapper(): null;
200
- _getRenderingContext(canvasContext: any, transform: any): {
201
- canvasContext: any;
210
+ _getRenderingContext(canvas: any, transform: any): {
211
+ canvas: any;
202
212
  transform: any;
203
213
  viewport: import("../src/display/display_utils").PageViewport;
204
214
  annotationMode: number;
@@ -206,6 +216,7 @@ export class PDFPageView extends BasePDFPageView implements IRenderableView {
206
216
  annotationCanvasMap: any;
207
217
  pageColors: null;
208
218
  isEditing: boolean;
219
+ recordOperations: boolean;
209
220
  };
210
221
  draw(): Promise<void>;
211
222
  /**
@@ -53,11 +53,6 @@ export type PDFThumbnailViewOptions = {
53
53
  * mode.
54
54
  */
55
55
  pageColors?: Object | undefined;
56
- /**
57
- * - Enables hardware acceleration for
58
- * rendering. The default value is `false`.
59
- */
60
- enableHWA?: boolean | undefined;
61
56
  };
62
57
  /**
63
58
  * @implements {IRenderableView}
@@ -66,7 +61,7 @@ export class PDFThumbnailView implements IRenderableView {
66
61
  /**
67
62
  * @param {PDFThumbnailViewOptions} options
68
63
  */
69
- constructor({ container, eventBus, id, defaultViewport, optionalContentConfigPromise, linkService, renderingQueue, maxCanvasPixels, maxCanvasDim, pageColors, enableHWA, }: PDFThumbnailViewOptions);
64
+ constructor({ container, eventBus, id, defaultViewport, optionalContentConfigPromise, linkService, renderingQueue, maxCanvasPixels, maxCanvasDim, pageColors, }: PDFThumbnailViewOptions);
70
65
  id: number;
71
66
  renderingId: string;
72
67
  pageLabel: string | null;
@@ -78,7 +73,6 @@ export class PDFThumbnailView implements IRenderableView {
78
73
  maxCanvasPixels: any;
79
74
  maxCanvasDim: any;
80
75
  pageColors: Object | null;
81
- enableHWA: boolean;
82
76
  eventBus: import("./event_utils").EventBus;
83
77
  linkService: import("./interfaces").IPDFLinkService;
84
78
  renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue;
@@ -130,11 +124,9 @@ export class PDFThumbnailView implements IRenderableView {
130
124
  * @property {Object} [pageColors] - Overwrites background and foreground colors
131
125
  * with user defined ones in order to improve readability in high contrast
132
126
  * mode.
133
- * @property {boolean} [enableHWA] - Enables hardware acceleration for
134
- * rendering. The default value is `false`.
135
127
  */
136
128
  export class TempImageFactory {
137
- static "__#82@#tempCanvas": null;
129
+ static #tempCanvas: null;
138
130
  static getCanvas(width: any, height: any): (HTMLCanvasElement | CanvasRenderingContext2D | null)[];
139
131
  static destroyCanvas(): void;
140
132
  }
@@ -96,6 +96,12 @@ export type PDFViewerOptions = {
96
96
  * The default value is 32767.
97
97
  */
98
98
  maxCanvasDim?: number | undefined;
99
+ /**
100
+ * - Cap the canvas area to the
101
+ * viewport increased by the value in percent. Use `-1` for no limit.
102
+ * The default value is 200%.
103
+ */
104
+ capCanvasAreaFactor?: number | undefined;
99
105
  /**
100
106
  * - When enabled, if the rendered
101
107
  * pages would need a canvas that is larger than `maxCanvasPixels` or
@@ -104,6 +110,13 @@ export type PDFViewerOptions = {
104
110
  * The default value is `true`.
105
111
  */
106
112
  enableDetailCanvas?: boolean | undefined;
113
+ /**
114
+ * - When enabled, PDF
115
+ * rendering will keep track of which areas of the page each PDF operation
116
+ * affects. Then, when rendering a partial page (if `enableDetailCanvas` is
117
+ * enabled), it will only run through the operations that affect that portion.
118
+ */
119
+ enableOptimizedPartialRendering?: boolean | undefined;
107
120
  /**
108
121
  * - Localization service.
109
122
  */
@@ -134,6 +147,11 @@ export type PDFViewerOptions = {
134
147
  * text that look like URLs. The default value is `true`.
135
148
  */
136
149
  enableAutoLinking?: boolean | undefined;
150
+ /**
151
+ * - Minimum duration to wait
152
+ * before updating the canvas. The default value is `500`.
153
+ */
154
+ minDurationToUpdateCanvas?: number | undefined;
137
155
  };
138
156
  export namespace PagesCountLimit {
139
157
  let FORCE_SCROLL_MODE_PAGE: number;
@@ -178,11 +196,18 @@ export namespace PagesCountLimit {
178
196
  * @property {number} [maxCanvasDim] - The maximum supported canvas dimension,
179
197
  * in either width or height. Use `-1` for no limit.
180
198
  * The default value is 32767.
199
+ * @property {number} [capCanvasAreaFactor] - Cap the canvas area to the
200
+ * viewport increased by the value in percent. Use `-1` for no limit.
201
+ * The default value is 200%.
181
202
  * @property {boolean} [enableDetailCanvas] - When enabled, if the rendered
182
203
  * pages would need a canvas that is larger than `maxCanvasPixels` or
183
204
  * `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one,
184
205
  * that only renders the part of the page that is close to the viewport.
185
206
  * The default value is `true`.
207
+ * @property {boolean} [enableOptimizedPartialRendering] - When enabled, PDF
208
+ * rendering will keep track of which areas of the page each PDF operation
209
+ * affects. Then, when rendering a partial page (if `enableDetailCanvas` is
210
+ * enabled), it will only run through the operations that affect that portion.
186
211
  * @property {IL10n} [l10n] - Localization service.
187
212
  * @property {boolean} [enablePermissions] - Enables PDF document permissions,
188
213
  * when they exist. The default value is `false`.
@@ -195,6 +220,8 @@ export namespace PagesCountLimit {
195
220
  * The default value is `true`.
196
221
  * @property {boolean} [enableAutoLinking] - Enable creation of hyperlinks from
197
222
  * text that look like URLs. The default value is `true`.
223
+ * @property {number} [minDurationToUpdateCanvas] - Minimum duration to wait
224
+ * before updating the canvas. The default value is `500`.
198
225
  */
199
226
  export class PDFPageViewBuffer {
200
227
  constructor(size: any);
@@ -231,7 +258,9 @@ export class PDFViewer {
231
258
  removePageBorders: boolean | undefined;
232
259
  maxCanvasPixels: number | undefined;
233
260
  maxCanvasDim: number | undefined;
261
+ capCanvasAreaFactor: number | undefined;
234
262
  enableDetailCanvas: boolean;
263
+ enableOptimizedPartialRendering: boolean;
235
264
  l10n: import("./interfaces").IL10n | GenericL10n | undefined;
236
265
  pageColors: Object | null;
237
266
  defaultRenderingQueue: boolean;
@@ -244,6 +273,7 @@ export class PDFViewer {
244
273
  _eventHandler: (evt: any) => void;
245
274
  };
246
275
  presentationModeState: number;
276
+ get printingAllowed(): boolean;
247
277
  get pagesCount(): number;
248
278
  getPageView(index: any): any;
249
279
  getCachedPageViews(): Set<any>;
@@ -511,11 +541,15 @@ export class PDFViewer {
511
541
  * @property {string|null} [editId] - ID of the existing annotation to edit.
512
542
  * @property {boolean} [isFromKeyboard] - True if the mode change is due to a
513
543
  * keyboard action.
544
+ * @property {boolean} [mustEnterInEditMode] - True if the editor must enter
545
+ * edit mode.
546
+ * @property {boolean} [editComment] - True if the editor must enter
547
+ * comment edit mode.
514
548
  */
515
549
  /**
516
550
  * @param {AnnotationEditorModeOptions} options
517
551
  */
518
- set annotationEditorMode({ mode, editId, isFromKeyboard }: {
552
+ set annotationEditorMode({ mode, editId, isFromKeyboard, mustEnterInEditMode, editComment, }: {
519
553
  /**
520
554
  * - The editor mode (none, FreeText, ink, ...).
521
555
  */
@@ -529,6 +563,16 @@ export class PDFViewer {
529
563
  * keyboard action.
530
564
  */
531
565
  isFromKeyboard?: boolean | undefined;
566
+ /**
567
+ * - True if the editor must enter
568
+ * edit mode.
569
+ */
570
+ mustEnterInEditMode?: boolean | undefined;
571
+ /**
572
+ * - True if the editor must enter
573
+ * comment edit mode.
574
+ */
575
+ editComment?: boolean | undefined;
532
576
  });
533
577
  get annotationEditorMode(): {
534
578
  /**
@@ -544,6 +588,16 @@ export class PDFViewer {
544
588
  * keyboard action.
545
589
  */
546
590
  isFromKeyboard?: boolean | undefined;
591
+ /**
592
+ * - True if the editor must enter
593
+ * edit mode.
594
+ */
595
+ mustEnterInEditMode?: boolean | undefined;
596
+ /**
597
+ * - True if the editor must enter
598
+ * comment edit mode.
599
+ */
600
+ editComment?: boolean | undefined;
547
601
  };
548
602
  refresh(noUpdate?: boolean, updateArgs?: any): void;
549
603
  #private;
@@ -14,7 +14,7 @@ export class TextAccessibilityManager {
14
14
  * @param {HTMLElement} e2
15
15
  * @returns {number}
16
16
  */
17
- static "__#6@#compareElementPositions"(e1: HTMLElement, e2: HTMLElement): number;
17
+ static #compareElementPositions(e1: HTMLElement, e2: HTMLElement): number;
18
18
  setTextMapping(textDivs: any): void;
19
19
  /**
20
20
  * Function called when the text layer has finished rendering.
@@ -37,10 +37,10 @@ export type TextLayerBuilderRenderOptions = {
37
37
  * contain text that matches the PDF text they are overlaying.
38
38
  */
39
39
  export class TextLayerBuilder {
40
- static "__#78@#textLayers": Map<any, any>;
41
- static "__#78@#selectionChangeAbortController": null;
42
- static "__#78@#removeGlobalSelectionListener"(textLayerDiv: any): void;
43
- static "__#78@#enableGlobalSelectionListener"(): void;
40
+ static #textLayers: Map<any, any>;
41
+ static #selectionChangeAbortController: null;
42
+ static #removeGlobalSelectionListener(textLayerDiv: any): void;
43
+ static #enableGlobalSelectionListener(): void;
44
44
  /**
45
45
  * @param {TextLayerBuilderOptions} options
46
46
  */
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "pdfjs-serverless",
3
3
  "type": "module",
4
- "version": "1.0.1",
5
- "packageManager": "pnpm@10.12.1",
4
+ "version": "1.1.0",
5
+ "packageManager": "pnpm@10.17.1",
6
6
  "description": "Serverless redistribution of PDF.js for edge environments",
7
7
  "author": "Johann Schopplich <hello@johannschopplich.com>",
8
8
  "license": "MIT",
@@ -42,18 +42,18 @@
42
42
  "release": "bumpp"
43
43
  },
44
44
  "devDependencies": {
45
- "@antfu/eslint-config": "^4.14.1",
45
+ "@antfu/eslint-config": "^5.4.1",
46
46
  "@rollup/plugin-inject": "^5.0.5",
47
47
  "@rollup/plugin-node-resolve": "^16.0.1",
48
48
  "@rollup/plugin-replace": "^6.0.2",
49
49
  "@rollup/plugin-terser": "^0.4.4",
50
- "@rollup/plugin-typescript": "^12.1.2",
51
- "@types/node": "^22.15.31",
52
- "bumpp": "^10.1.1",
53
- "eslint": "^9.28.0",
54
- "pdfjs-dist": "~5.2.133",
55
- "rollup": "^4.42.0",
50
+ "@rollup/plugin-typescript": "^12.1.4",
51
+ "@types/node": "^24.5.2",
52
+ "bumpp": "^10.2.3",
53
+ "eslint": "^9.36.0",
54
+ "pdfjs-dist": "~5.4.149",
55
+ "rollup": "^4.52.0",
56
56
  "tslib": "^2.8.1",
57
- "typescript": "^5.8.3"
57
+ "typescript": "^5.9.2"
58
58
  }
59
59
  }