unpdf 1.0.6 → 1.2.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 +35 -2
- package/dist/index.cjs +28 -0
- package/dist/index.d.cts +7 -1
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.mjs +28 -1
- package/dist/pdfjs.mjs +1 -1
- package/dist/types/src/display/annotation_layer.d.ts +5 -2
- package/dist/types/src/display/api.d.ts +30 -74
- package/dist/types/src/display/api_utils.d.ts +13 -0
- package/dist/types/src/display/canvas.d.ts +2 -2
- package/dist/types/src/display/display_utils.d.ts +2 -1
- 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 +48 -5
- package/dist/types/src/display/editor/freetext.d.ts +9 -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 +2 -0
- package/dist/types/src/display/editor/toolbar.d.ts +3 -0
- package/dist/types/src/display/editor/tools.d.ts +14 -3
- 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 +2 -2
- 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 +0 -1
- package/dist/types/web/event_utils.d.ts +1 -1
- package/dist/types/web/genericl10n.d.ts +5 -5
- 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_page_view.d.ts +9 -7
- package/dist/types/web/pdf_thumbnail_view.d.ts +2 -10
- package/dist/types/web/pdf_viewer.d.ts +42 -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 +13 -13
|
@@ -19,14 +19,14 @@ export class HighlightEditor extends AnnotationEditor {
|
|
|
19
19
|
/** @inheritdoc */
|
|
20
20
|
static updateDefaultParams(type: any, value: any): void;
|
|
21
21
|
static get defaultPropertiesToUpdate(): (number | null)[][];
|
|
22
|
-
static "__#
|
|
22
|
+
static "__#25@#rotateBbox"([x, y, width, height]: [any, any, any, any], angle: any): any[];
|
|
23
23
|
static startHighlighting(parent: any, isLTR: any, { target: textLayer, x, y }: {
|
|
24
24
|
target: any;
|
|
25
25
|
x: any;
|
|
26
26
|
y: any;
|
|
27
27
|
}): void;
|
|
28
|
-
static "__#
|
|
29
|
-
static "__#
|
|
28
|
+
static "__#25@#highlightMove"(parent: any, event: any): void;
|
|
29
|
+
static "__#25@#endHighlight"(parent: any, event: any): void;
|
|
30
30
|
/** @inheritdoc */
|
|
31
31
|
static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
|
|
32
32
|
constructor(params: any);
|
|
@@ -45,6 +45,7 @@ export class HighlightEditor extends AnnotationEditor {
|
|
|
45
45
|
type: string;
|
|
46
46
|
color: any;
|
|
47
47
|
};
|
|
48
|
+
get commentColor(): any;
|
|
48
49
|
/** @inheritdoc */
|
|
49
50
|
translateInPage(x: any, y: any): void;
|
|
50
51
|
/** @inheritdoc */
|
|
@@ -52,6 +53,8 @@ export class HighlightEditor extends AnnotationEditor {
|
|
|
52
53
|
/** @inheritdoc */
|
|
53
54
|
get propertiesToUpdate(): any[][];
|
|
54
55
|
/** @inheritdoc */
|
|
56
|
+
get toolbarButtons(): any;
|
|
57
|
+
/** @inheritdoc */
|
|
55
58
|
fixAndSetPosition(): void;
|
|
56
59
|
/** @inheritdoc */
|
|
57
60
|
getRect(tx: any, ty: any): any[];
|
|
@@ -22,6 +22,10 @@ export class InkEditor extends DrawingEditor {
|
|
|
22
22
|
static deserializeDraw(pageX: any, pageY: any, pageWidth: any, pageHeight: any, innerMargin: any, data: any): any;
|
|
23
23
|
defaultL10nId: string;
|
|
24
24
|
/** @inheritdoc */
|
|
25
|
+
get toolbarButtons(): (string | null)[][];
|
|
26
|
+
get colorType(): number;
|
|
27
|
+
get colorValue(): any;
|
|
28
|
+
/** @inheritdoc */
|
|
25
29
|
createDrawingOptions({ color, thickness, opacity }: {
|
|
26
30
|
color: any;
|
|
27
31
|
thickness: any;
|
|
@@ -31,6 +31,8 @@ export class SignatureEditor extends DrawingEditor {
|
|
|
31
31
|
areContours: any;
|
|
32
32
|
outline: InkDrawOutline;
|
|
33
33
|
};
|
|
34
|
+
/** @inheritdoc */
|
|
35
|
+
get toolbarButtons(): any[][] | null;
|
|
34
36
|
addSignature(data: any, heightInPage: any, description: any, uuid: any): void;
|
|
35
37
|
getFromImage(bitmap: any): {
|
|
36
38
|
outline: InkDrawOutline;
|
|
@@ -26,6 +26,8 @@ export class StampEditor extends AnnotationEditor {
|
|
|
26
26
|
mlGuessAltText(imageData?: null, updateAltTextData?: boolean): Promise<any>;
|
|
27
27
|
/** @inheritdoc */
|
|
28
28
|
onceAdded(focus: any): void;
|
|
29
|
+
/** @inheritdoc */
|
|
30
|
+
get toolbarButtons(): (string | object)[][];
|
|
29
31
|
setCanvas(annotationElementId: any, canvas: any): void;
|
|
30
32
|
onScaleChanging(): void;
|
|
31
33
|
copyCanvas(maxDataDimension: any, maxPreviewDimension: any, createImageData?: boolean): {
|
|
@@ -6,9 +6,12 @@ export class EditorToolbar {
|
|
|
6
6
|
get div(): null;
|
|
7
7
|
hide(): void;
|
|
8
8
|
show(): void;
|
|
9
|
+
addDeleteButton(): void;
|
|
9
10
|
addAltText(altText: any): Promise<void>;
|
|
11
|
+
addComment(comment: any): void;
|
|
10
12
|
addColorPicker(colorPicker: any): void;
|
|
11
13
|
addEditSignatureButton(signatureManager: any): Promise<void>;
|
|
14
|
+
addButton(name: any, tool: any): Promise<void>;
|
|
12
15
|
updateEditSignatureButton(description: any): void;
|
|
13
16
|
remove(): void;
|
|
14
17
|
#private;
|
|
@@ -12,7 +12,7 @@ export class AnnotationEditorUIManager {
|
|
|
12
12
|
static TRANSLATE_SMALL: number;
|
|
13
13
|
static TRANSLATE_BIG: number;
|
|
14
14
|
static get _keyboardManager(): any;
|
|
15
|
-
constructor(container: any, viewer: any, altTextManager: any, signatureManager: any, eventBus: any, pdfDocument: any, pageColors: any, highlightColors: any, enableHighlightFloatingButton: any, enableUpdatedAddImage: any, enableNewAltTextWhenAddingImage: any, mlManager: any, editorUndoBar: any, supportsPinchToZoom: any);
|
|
15
|
+
constructor(container: any, viewer: any, viewerAlert: any, altTextManager: any, commentManager: any, signatureManager: any, eventBus: any, pdfDocument: any, pageColors: any, highlightColors: any, enableHighlightFloatingButton: any, enableUpdatedAddImage: any, enableNewAltTextWhenAddingImage: any, mlManager: any, editorUndoBar: any, supportsPinchToZoom: any);
|
|
16
16
|
_editorUndoBar: null;
|
|
17
17
|
_signal: AbortSignal;
|
|
18
18
|
_eventBus: any;
|
|
@@ -29,8 +29,11 @@ export class AnnotationEditorUIManager {
|
|
|
29
29
|
get useNewAltTextWhenAddingImage(): boolean;
|
|
30
30
|
get hcmFilter(): any;
|
|
31
31
|
get direction(): any;
|
|
32
|
+
get _highlightColors(): any;
|
|
32
33
|
get highlightColors(): any;
|
|
33
34
|
get highlightColorNames(): any;
|
|
35
|
+
getNonHCMColor(color: any): any;
|
|
36
|
+
getNonHCMColorName(color: any): any;
|
|
34
37
|
/**
|
|
35
38
|
* Set the current drawing session.
|
|
36
39
|
* @param {AnnotationEditorLayer} layer
|
|
@@ -38,6 +41,8 @@ export class AnnotationEditorUIManager {
|
|
|
38
41
|
setCurrentDrawingSession(layer: AnnotationEditorLayer): void;
|
|
39
42
|
setMainHighlightColorPicker(colorPicker: any): void;
|
|
40
43
|
editAltText(editor: any, firstTime?: boolean): void;
|
|
44
|
+
hasCommentManager(): boolean;
|
|
45
|
+
editComment(editor: any, position: any): void;
|
|
41
46
|
getSignature(editor: any): void;
|
|
42
47
|
get signatureManager(): null;
|
|
43
48
|
switchToMode(mode: any, callback: any): void;
|
|
@@ -66,6 +71,7 @@ export class AnnotationEditorUIManager {
|
|
|
66
71
|
* @param {AnnotationEditor} editor
|
|
67
72
|
*/
|
|
68
73
|
addToAnnotationStorage(editor: AnnotationEditor): void;
|
|
74
|
+
a11yAlert(messageId: any, args?: null): void;
|
|
69
75
|
blur(): void;
|
|
70
76
|
focus(): void;
|
|
71
77
|
addEditListeners(): void;
|
|
@@ -141,15 +147,20 @@ export class AnnotationEditorUIManager {
|
|
|
141
147
|
* @param {string|null} editId
|
|
142
148
|
* @param {boolean} [isFromKeyboard] - true if the mode change is due to a
|
|
143
149
|
* keyboard action.
|
|
150
|
+
* @param {boolean} [mustEnterInEditMode] - true if the editor must enter in
|
|
151
|
+
* edit mode.
|
|
152
|
+
* @param {boolean} [editComment] - true if the mode change is due to a
|
|
153
|
+
* comment edit.
|
|
144
154
|
*/
|
|
145
|
-
updateMode(mode: number, editId?: string | null, isFromKeyboard?: boolean): Promise<void>;
|
|
155
|
+
updateMode(mode: number, editId?: string | null, isFromKeyboard?: boolean, mustEnterInEditMode?: boolean, editComment?: boolean): Promise<void>;
|
|
146
156
|
addNewEditorFromKeyboard(): void;
|
|
147
157
|
/**
|
|
148
158
|
* Update the toolbar if it's required to reflect the tool currently used.
|
|
159
|
+
* @param {Object} options
|
|
149
160
|
* @param {number} mode
|
|
150
161
|
* @returns {undefined}
|
|
151
162
|
*/
|
|
152
|
-
updateToolbar(
|
|
163
|
+
updateToolbar(options: Object): undefined;
|
|
153
164
|
/**
|
|
154
165
|
* Update a parameter in the current editor or globally.
|
|
155
166
|
* @param {number} type
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A PDF document and page is built of many objects. E.g. there are objects for
|
|
3
|
+
* fonts, images, rendering code, etc. These objects may get processed inside of
|
|
4
|
+
* a worker. This class implements some basic methods to manage these objects.
|
|
5
|
+
*/
|
|
6
|
+
export class PDFObjects {
|
|
7
|
+
/**
|
|
8
|
+
* If called *without* callback, this returns the data of `objId` but the
|
|
9
|
+
* object needs to be resolved. If it isn't, this method throws.
|
|
10
|
+
*
|
|
11
|
+
* If called *with* a callback, the callback is called with the data of the
|
|
12
|
+
* object once the object is resolved. That means, if you call this method
|
|
13
|
+
* and the object is already resolved, the callback gets called right away.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} objId
|
|
16
|
+
* @param {function} [callback]
|
|
17
|
+
* @returns {any}
|
|
18
|
+
*/
|
|
19
|
+
get(objId: string, callback?: Function): any;
|
|
20
|
+
/**
|
|
21
|
+
* @param {string} objId
|
|
22
|
+
* @returns {boolean}
|
|
23
|
+
*/
|
|
24
|
+
has(objId: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* @param {string} objId
|
|
27
|
+
* @returns {boolean}
|
|
28
|
+
*/
|
|
29
|
+
delete(objId: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Resolves the object `objId` with optional `data`.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} objId
|
|
34
|
+
* @param {any} [data]
|
|
35
|
+
*/
|
|
36
|
+
resolve(objId: string, data?: any): void;
|
|
37
|
+
clear(): void;
|
|
38
|
+
[Symbol.iterator](): Generator<any[], void, unknown>;
|
|
39
|
+
#private;
|
|
40
|
+
}
|
|
@@ -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 "__#58@#ascentCache": Map<any, any>;
|
|
35
|
+
static "__#58@#canvasContexts": Map<any, any>;
|
|
36
|
+
static "__#58@#canvasCtxFonts": WeakMap<object, any>;
|
|
37
|
+
static "__#58@#minFontSize": null;
|
|
38
|
+
static "__#58@#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 "__#58@#getCtx"(lang?: null): any;
|
|
46
|
+
static "__#58@#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 "__#58@#ensureMinFontSizeComputed"(): void;
|
|
51
|
+
static "__#58@#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 "__#
|
|
3
|
-
static "__#
|
|
2
|
+
static "__#53@#port": null;
|
|
3
|
+
static "__#53@#src": string;
|
|
4
4
|
/**
|
|
5
5
|
* @param {Worker | null} workerPort - Defines global port for worker process.
|
|
6
6
|
* Overrides the `workerSrc` option.
|
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;
|
|
@@ -55,6 +54,7 @@ export namespace AnnotationEditorType {
|
|
|
55
54
|
let STAMP: number;
|
|
56
55
|
let INK: number;
|
|
57
56
|
let SIGNATURE: number;
|
|
57
|
+
let COMMENT: number;
|
|
58
58
|
}
|
|
59
59
|
export namespace AnnotationFieldFlag {
|
|
60
60
|
let READONLY: number;
|
|
@@ -350,7 +350,7 @@ export function setVerbosityLevel(level: any): void;
|
|
|
350
350
|
export function shadow(obj: any, prop: any, value: any, nonSerializable?: boolean): any;
|
|
351
351
|
export function string32(value: any): string;
|
|
352
352
|
export function stringToBytes(str: any): Uint8Array<any>;
|
|
353
|
-
export function stringToPDFString(str: any): string;
|
|
353
|
+
export function stringToPDFString(str: any, keepEscapeSequence?: boolean): string;
|
|
354
354
|
export function stringToUTF8String(str: any): string;
|
|
355
355
|
export namespace TextRenderingMode {
|
|
356
356
|
export let FILL: number;
|
|
@@ -14,7 +14,6 @@ export class BasePDFPageView {
|
|
|
14
14
|
_createCanvas(onShow: any, hideUntilComplete?: boolean): {
|
|
15
15
|
canvas: HTMLCanvasElement;
|
|
16
16
|
prevCanvas: null;
|
|
17
|
-
ctx: CanvasRenderingContext2D | null;
|
|
18
17
|
};
|
|
19
18
|
_resetCanvas(): void;
|
|
20
19
|
_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 "__#72@#generateBundles"(defaultLang: string, baseLang: string): AsyncGenerator<any, void, unknown>;
|
|
13
|
+
static "__#72@#createBundle"(lang: any, baseURL: any, paths: any): Promise<any>;
|
|
14
|
+
static "__#72@#getPaths"(): Promise<{
|
|
15
15
|
baseURL: any;
|
|
16
16
|
paths: any;
|
|
17
17
|
}>;
|
|
18
|
-
static "__#
|
|
19
|
-
static "__#
|
|
18
|
+
static "__#72@#generateBundlesFallback"(lang: any): AsyncGenerator<any, void, unknown>;
|
|
19
|
+
static "__#72@#createBundleFallback"(lang: any): Promise<any>;
|
|
20
20
|
constructor(lang: any);
|
|
21
21
|
}
|
|
22
22
|
import { L10n } from "./l10n.js";
|
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 "__#71@#fixupLangCode"(langCode: any): any;
|
|
11
|
+
static "__#71@#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.
|
|
@@ -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
|
|
@@ -89,11 +95,6 @@ export type PDFPageViewOptions = {
|
|
|
89
95
|
* the necessary layer-properties.
|
|
90
96
|
*/
|
|
91
97
|
layerProperties?: Object | undefined;
|
|
92
|
-
/**
|
|
93
|
-
* - Enables hardware acceleration for
|
|
94
|
-
* rendering. The default value is `false`.
|
|
95
|
-
*/
|
|
96
|
-
enableHWA?: boolean | undefined;
|
|
97
98
|
/**
|
|
98
99
|
* - Enable creation of hyperlinks from
|
|
99
100
|
* text that look like URLs. The default value is `true`.
|
|
@@ -120,6 +121,7 @@ export class PDFPageView extends BasePDFPageView implements IRenderableView {
|
|
|
120
121
|
enableDetailCanvas: boolean;
|
|
121
122
|
maxCanvasPixels: any;
|
|
122
123
|
maxCanvasDim: any;
|
|
124
|
+
capCanvasAreaFactor: any;
|
|
123
125
|
l10n: import("./interfaces").IL10n | GenericL10n | undefined;
|
|
124
126
|
_isStandalone: boolean | undefined;
|
|
125
127
|
_container: HTMLDivElement | undefined;
|
|
@@ -197,8 +199,8 @@ export class PDFPageView extends BasePDFPageView implements IRenderableView {
|
|
|
197
199
|
get height(): number;
|
|
198
200
|
getPagePoint(x: any, y: any): any[];
|
|
199
201
|
_ensureCanvasWrapper(): null;
|
|
200
|
-
_getRenderingContext(
|
|
201
|
-
|
|
202
|
+
_getRenderingContext(canvas: any, transform: any): {
|
|
203
|
+
canvas: any;
|
|
202
204
|
transform: any;
|
|
203
205
|
viewport: import("../src/display/display_utils").PageViewport;
|
|
204
206
|
annotationMode: number;
|
|
@@ -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 "__#85@#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
|
|
@@ -134,6 +140,11 @@ export type PDFViewerOptions = {
|
|
|
134
140
|
* text that look like URLs. The default value is `true`.
|
|
135
141
|
*/
|
|
136
142
|
enableAutoLinking?: boolean | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* - Minimum duration to wait
|
|
145
|
+
* before updating the canvas. The default value is `500`.
|
|
146
|
+
*/
|
|
147
|
+
minDurationToUpdateCanvas?: number | undefined;
|
|
137
148
|
};
|
|
138
149
|
export namespace PagesCountLimit {
|
|
139
150
|
let FORCE_SCROLL_MODE_PAGE: number;
|
|
@@ -178,6 +189,9 @@ export namespace PagesCountLimit {
|
|
|
178
189
|
* @property {number} [maxCanvasDim] - The maximum supported canvas dimension,
|
|
179
190
|
* in either width or height. Use `-1` for no limit.
|
|
180
191
|
* The default value is 32767.
|
|
192
|
+
* @property {number} [capCanvasAreaFactor] - Cap the canvas area to the
|
|
193
|
+
* viewport increased by the value in percent. Use `-1` for no limit.
|
|
194
|
+
* The default value is 200%.
|
|
181
195
|
* @property {boolean} [enableDetailCanvas] - When enabled, if the rendered
|
|
182
196
|
* pages would need a canvas that is larger than `maxCanvasPixels` or
|
|
183
197
|
* `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one,
|
|
@@ -195,6 +209,8 @@ export namespace PagesCountLimit {
|
|
|
195
209
|
* The default value is `true`.
|
|
196
210
|
* @property {boolean} [enableAutoLinking] - Enable creation of hyperlinks from
|
|
197
211
|
* text that look like URLs. The default value is `true`.
|
|
212
|
+
* @property {number} [minDurationToUpdateCanvas] - Minimum duration to wait
|
|
213
|
+
* before updating the canvas. The default value is `500`.
|
|
198
214
|
*/
|
|
199
215
|
export class PDFPageViewBuffer {
|
|
200
216
|
constructor(size: any);
|
|
@@ -231,6 +247,7 @@ export class PDFViewer {
|
|
|
231
247
|
removePageBorders: boolean | undefined;
|
|
232
248
|
maxCanvasPixels: number | undefined;
|
|
233
249
|
maxCanvasDim: number | undefined;
|
|
250
|
+
capCanvasAreaFactor: number | undefined;
|
|
234
251
|
enableDetailCanvas: boolean;
|
|
235
252
|
l10n: import("./interfaces").IL10n | GenericL10n | undefined;
|
|
236
253
|
pageColors: Object | null;
|
|
@@ -511,11 +528,15 @@ export class PDFViewer {
|
|
|
511
528
|
* @property {string|null} [editId] - ID of the existing annotation to edit.
|
|
512
529
|
* @property {boolean} [isFromKeyboard] - True if the mode change is due to a
|
|
513
530
|
* keyboard action.
|
|
531
|
+
* @property {boolean} [mustEnterInEditMode] - True if the editor must enter
|
|
532
|
+
* edit mode.
|
|
533
|
+
* @property {boolean} [editComment] - True if the editor must enter
|
|
534
|
+
* comment edit mode.
|
|
514
535
|
*/
|
|
515
536
|
/**
|
|
516
537
|
* @param {AnnotationEditorModeOptions} options
|
|
517
538
|
*/
|
|
518
|
-
set annotationEditorMode({ mode, editId, isFromKeyboard }: {
|
|
539
|
+
set annotationEditorMode({ mode, editId, isFromKeyboard, mustEnterInEditMode, editComment, }: {
|
|
519
540
|
/**
|
|
520
541
|
* - The editor mode (none, FreeText, ink, ...).
|
|
521
542
|
*/
|
|
@@ -529,6 +550,16 @@ export class PDFViewer {
|
|
|
529
550
|
* keyboard action.
|
|
530
551
|
*/
|
|
531
552
|
isFromKeyboard?: boolean | undefined;
|
|
553
|
+
/**
|
|
554
|
+
* - True if the editor must enter
|
|
555
|
+
* edit mode.
|
|
556
|
+
*/
|
|
557
|
+
mustEnterInEditMode?: boolean | undefined;
|
|
558
|
+
/**
|
|
559
|
+
* - True if the editor must enter
|
|
560
|
+
* comment edit mode.
|
|
561
|
+
*/
|
|
562
|
+
editComment?: boolean | undefined;
|
|
532
563
|
});
|
|
533
564
|
get annotationEditorMode(): {
|
|
534
565
|
/**
|
|
@@ -544,6 +575,16 @@ export class PDFViewer {
|
|
|
544
575
|
* keyboard action.
|
|
545
576
|
*/
|
|
546
577
|
isFromKeyboard?: boolean | undefined;
|
|
578
|
+
/**
|
|
579
|
+
* - True if the editor must enter
|
|
580
|
+
* edit mode.
|
|
581
|
+
*/
|
|
582
|
+
mustEnterInEditMode?: boolean | undefined;
|
|
583
|
+
/**
|
|
584
|
+
* - True if the editor must enter
|
|
585
|
+
* comment edit mode.
|
|
586
|
+
*/
|
|
587
|
+
editComment?: boolean | undefined;
|
|
547
588
|
};
|
|
548
589
|
refresh(noUpdate?: boolean, updateArgs?: any): void;
|
|
549
590
|
#private;
|
|
@@ -14,7 +14,7 @@ export class TextAccessibilityManager {
|
|
|
14
14
|
* @param {HTMLElement} e2
|
|
15
15
|
* @returns {number}
|
|
16
16
|
*/
|
|
17
|
-
static "__#
|
|
17
|
+
static "__#8@#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 "__#81@#textLayers": Map<any, any>;
|
|
41
|
+
static "__#81@#selectionChangeAbortController": null;
|
|
42
|
+
static "__#81@#removeGlobalSelectionListener"(textLayerDiv: any): void;
|
|
43
|
+
static "__#81@#enableGlobalSelectionListener"(): void;
|
|
44
44
|
/**
|
|
45
45
|
* @param {TextLayerBuilderOptions} options
|
|
46
46
|
*/
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unpdf",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0
|
|
5
|
-
"packageManager": "pnpm@10.
|
|
4
|
+
"version": "1.2.0",
|
|
5
|
+
"packageManager": "pnpm@10.15.0",
|
|
6
6
|
"description": "PDF extraction and rendering across all JavaScript runtimes",
|
|
7
7
|
"author": "Johann Schopplich <hello@johannschopplich.com>",
|
|
8
8
|
"license": "MIT",
|
|
@@ -70,23 +70,23 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@antfu/eslint-config": "^
|
|
74
|
-
"@napi-rs/canvas": "^0.1.
|
|
73
|
+
"@antfu/eslint-config": "^5.2.1",
|
|
74
|
+
"@napi-rs/canvas": "^0.1.77",
|
|
75
75
|
"@rollup/plugin-alias": "^5.1.1",
|
|
76
76
|
"@rollup/plugin-inject": "^5.0.5",
|
|
77
77
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
78
78
|
"@rollup/plugin-replace": "^6.0.2",
|
|
79
79
|
"@rollup/plugin-terser": "^0.4.4",
|
|
80
|
-
"@rollup/plugin-typescript": "^12.1.
|
|
81
|
-
"@types/node": "^
|
|
82
|
-
"bumpp": "^10.
|
|
83
|
-
"eslint": "^9.
|
|
80
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
81
|
+
"@types/node": "^24.3.0",
|
|
82
|
+
"bumpp": "^10.2.3",
|
|
83
|
+
"eslint": "^9.33.0",
|
|
84
84
|
"fast-glob": "^3.3.3",
|
|
85
|
-
"pdfjs-dist": "~5.
|
|
86
|
-
"rollup": "^4.
|
|
85
|
+
"pdfjs-dist": "~5.4.54",
|
|
86
|
+
"rollup": "^4.46.4",
|
|
87
87
|
"tslib": "^2.8.1",
|
|
88
|
-
"typescript": "^5.
|
|
89
|
-
"unbuild": "^3.
|
|
90
|
-
"vitest": "^3.
|
|
88
|
+
"typescript": "^5.9.2",
|
|
89
|
+
"unbuild": "^3.6.1",
|
|
90
|
+
"vitest": "^3.2.4"
|
|
91
91
|
}
|
|
92
92
|
}
|