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.
- package/README.md +1 -1
- package/dist/index.mjs +1 -1
- package/dist/types/src/display/annotation_layer.d.ts +10 -2
- package/dist/types/src/display/api.d.ts +53 -75
- package/dist/types/src/display/api_utils.d.ts +13 -0
- package/dist/types/src/display/canvas.d.ts +82 -80
- package/dist/types/src/display/canvas_dependency_tracker.d.ts +144 -0
- package/dist/types/src/display/display_utils.d.ts +3 -2
- package/dist/types/src/display/draw_layer.d.ts +2 -2
- package/dist/types/src/display/editor/alt_text.d.ts +1 -1
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +6 -6
- package/dist/types/src/display/editor/color_picker.d.ts +20 -1
- package/dist/types/src/display/editor/comment.d.ts +32 -0
- package/dist/types/src/display/editor/draw.d.ts +8 -8
- package/dist/types/src/display/editor/drawers/freedraw.d.ts +3 -3
- package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +13 -13
- package/dist/types/src/display/editor/editor.d.ts +54 -5
- package/dist/types/src/display/editor/freetext.d.ts +11 -7
- package/dist/types/src/display/editor/highlight.d.ts +6 -3
- package/dist/types/src/display/editor/ink.d.ts +4 -0
- package/dist/types/src/display/editor/signature.d.ts +2 -0
- package/dist/types/src/display/editor/stamp.d.ts +3 -1
- package/dist/types/src/display/editor/toolbar.d.ts +6 -3
- package/dist/types/src/display/editor/tools.d.ts +16 -4
- package/dist/types/src/display/fetch_stream.d.ts +2 -2
- package/dist/types/src/display/pdf_objects.d.ts +40 -0
- package/dist/types/src/display/text_layer.d.ts +9 -9
- package/dist/types/src/display/worker_options.d.ts +2 -2
- package/dist/types/src/pdf.d.ts +3 -2
- package/dist/types/src/shared/scripting_utils.d.ts +2 -0
- package/dist/types/src/shared/util.d.ts +9 -5
- package/dist/types/web/annotation_layer_builder.d.ts +4 -1
- package/dist/types/web/app_options.d.ts +1 -1
- package/dist/types/web/autolinker.d.ts +2 -2
- package/dist/types/web/base_pdf_page_view.d.ts +2 -1
- package/dist/types/web/event_utils.d.ts +1 -1
- package/dist/types/web/genericl10n.d.ts +5 -5
- package/dist/types/web/interfaces.d.ts +7 -0
- package/dist/types/web/l10n.d.ts +2 -2
- package/dist/types/web/pdf_find_controller.d.ts +1 -1
- package/dist/types/web/pdf_link_service.d.ts +7 -0
- package/dist/types/web/pdf_page_detail_view.d.ts +1 -0
- package/dist/types/web/pdf_page_view.d.ts +18 -7
- package/dist/types/web/pdf_thumbnail_view.d.ts +2 -10
- package/dist/types/web/pdf_viewer.d.ts +55 -1
- package/dist/types/web/text_accessibility.d.ts +1 -1
- package/dist/types/web/text_layer_builder.d.ts +4 -4
- 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
|
|
35
|
-
static
|
|
36
|
-
static
|
|
37
|
-
static
|
|
38
|
-
static
|
|
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
|
|
46
|
-
static
|
|
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
|
|
51
|
-
static
|
|
50
|
+
static #ensureMinFontSizeComputed(): void;
|
|
51
|
+
static #getAscent(fontFamily: any, style: any, lang: any): any;
|
|
52
52
|
/**
|
|
53
53
|
* @param {TextLayerParameters} options
|
|
54
54
|
*/
|
package/dist/types/src/pdf.d.ts
CHANGED
|
@@ -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/
|
|
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 };
|
|
@@ -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
|
-
|
|
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
|
|
402
|
-
static
|
|
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<{
|
|
@@ -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
|
|
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
|
|
13
|
-
static
|
|
14
|
-
static
|
|
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
|
|
19
|
-
static
|
|
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
|
package/dist/types/web/l10n.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export const GenericL10n: null;
|
|
|
7
7
|
* @implements {IL10n}
|
|
8
8
|
*/
|
|
9
9
|
export class L10n implements IL10n {
|
|
10
|
-
static
|
|
11
|
-
static
|
|
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(
|
|
201
|
-
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
41
|
-
static
|
|
42
|
-
static
|
|
43
|
-
static
|
|
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
|
|
5
|
-
"packageManager": "pnpm@10.
|
|
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.
|
|
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.
|
|
51
|
-
"@types/node": "^
|
|
52
|
-
"bumpp": "^10.
|
|
53
|
-
"eslint": "^9.
|
|
54
|
-
"pdfjs-dist": "~5.
|
|
55
|
-
"rollup": "^4.
|
|
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.
|
|
57
|
+
"typescript": "^5.9.2"
|
|
58
58
|
}
|
|
59
59
|
}
|