pdfjs-serverless 0.4.1 → 0.5.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 -3
- package/dist/types/src/display/annotation_storage.d.ts +1 -0
- package/dist/types/src/display/api.d.ts +49 -22
- package/dist/types/src/display/base_factory.d.ts +3 -1
- package/dist/types/src/display/canvas.d.ts +2 -0
- package/dist/types/src/display/display_utils.d.ts +4 -3
- package/dist/types/src/display/draw_layer.d.ts +12 -14
- package/dist/types/src/display/editor/alt_text.d.ts +1 -0
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +13 -12
- package/dist/types/src/display/editor/color_picker.d.ts +2 -2
- package/dist/types/src/display/editor/editor.d.ts +50 -2
- package/dist/types/src/display/editor/freetext.d.ts +6 -1
- package/dist/types/src/display/editor/highlight.d.ts +38 -4
- package/dist/types/src/display/editor/ink.d.ts +4 -4
- package/dist/types/src/display/editor/outliner.d.ts +53 -9
- package/dist/types/src/display/editor/stamp.d.ts +1 -1
- package/dist/types/src/display/editor/toolbar.d.ts +7 -1
- package/dist/types/src/display/editor/tools.d.ts +37 -4
- package/dist/types/src/display/fetch_stream.d.ts +3 -4
- package/dist/types/src/display/font_loader.d.ts +1 -5
- package/dist/types/src/display/network.d.ts +2 -3
- package/dist/types/src/display/node_stream.d.ts +4 -5
- package/dist/types/src/display/node_utils.d.ts +6 -5
- package/dist/types/src/display/optional_content_config.d.ts +6 -1
- package/dist/types/src/display/text_layer.d.ts +40 -108
- package/dist/types/src/display/transport_stream.d.ts +3 -7
- package/dist/types/src/display/worker_options.d.ts +20 -22
- package/dist/types/src/pdf.d.ts +2 -3
- package/dist/types/src/shared/util.d.ts +19 -22
- package/dist/types/web/annotation_editor_layer_builder.d.ts +6 -13
- package/dist/types/web/annotation_layer_builder.d.ts +7 -4
- package/dist/types/web/app_options.d.ts +1 -2
- package/dist/types/web/genericl10n.d.ts +5 -3
- package/dist/types/web/interfaces.d.ts +8 -5
- package/dist/types/web/l10n.d.ts +3 -2
- package/dist/types/web/pdf_find_controller.d.ts +1 -2
- package/dist/types/web/pdf_history.d.ts +1 -53
- package/dist/types/web/pdf_link_service.d.ts +4 -107
- package/dist/types/web/pdf_page_view.d.ts +3 -15
- package/dist/types/web/pdf_scripting_manager.d.ts +0 -4
- package/dist/types/web/pdf_thumbnail_view.d.ts +1 -13
- package/dist/types/web/pdf_thumbnail_viewer.d.ts +0 -16
- package/dist/types/web/pdf_viewer.component.d.ts +1 -2
- package/dist/types/web/pdf_viewer.d.ts +38 -29
- package/dist/types/web/text_accessibility.d.ts +1 -1
- package/dist/types/web/text_highlighter.d.ts +1 -1
- package/dist/types/web/text_layer_builder.d.ts +17 -29
- package/package.json +14 -14
- package/dist/types/web/l10n_utils.d.ts +0 -9
|
@@ -8,7 +8,7 @@ export class InkEditor extends AnnotationEditor {
|
|
|
8
8
|
static _type: string;
|
|
9
9
|
static _editorType: number;
|
|
10
10
|
/** @inheritdoc */
|
|
11
|
-
static initialize(l10n: any): void;
|
|
11
|
+
static initialize(l10n: any, uiManager: any): void;
|
|
12
12
|
/** @inheritdoc */
|
|
13
13
|
static updateDefaultParams(type: any, value: any): void;
|
|
14
14
|
/** @inheritdoc */
|
|
@@ -18,9 +18,9 @@ export class InkEditor extends AnnotationEditor {
|
|
|
18
18
|
* @param {Array<Array<number>>} bezier
|
|
19
19
|
* @returns {Path2D}
|
|
20
20
|
*/
|
|
21
|
-
static "__#
|
|
22
|
-
static "__#
|
|
23
|
-
static "__#
|
|
21
|
+
static "__#24@#buildPath2D"(bezier: Array<Array<number>>): Path2D;
|
|
22
|
+
static "__#24@#toPDFCoordinates"(points: any, rect: any, rotation: any): any;
|
|
23
|
+
static "__#24@#fromPDFCoordinates"(points: any, rect: any, rotation: any): any;
|
|
24
24
|
/** @inheritdoc */
|
|
25
25
|
static deserialize(data: any, parent: any, uiManager: any): AnnotationEditor | null;
|
|
26
26
|
constructor(params: any);
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
export class FreeOutliner {
|
|
2
|
+
static "__#20@#MIN_DIST": number;
|
|
3
|
+
static "__#20@#MIN_DIFF": number;
|
|
4
|
+
static "__#20@#MIN": number;
|
|
5
|
+
constructor({ x, y }: {
|
|
6
|
+
x: any;
|
|
7
|
+
y: any;
|
|
8
|
+
}, box: any, scaleFactor: any, thickness: any, isLTR: any, innerMargin?: number);
|
|
9
|
+
get free(): boolean;
|
|
10
|
+
isEmpty(): boolean;
|
|
11
|
+
add({ x, y }: {
|
|
12
|
+
x: any;
|
|
13
|
+
y: any;
|
|
14
|
+
}): boolean;
|
|
15
|
+
toSVGPath(): string;
|
|
16
|
+
getOutlines(): FreeHighlightOutline;
|
|
17
|
+
#private;
|
|
18
|
+
}
|
|
1
19
|
export class Outliner {
|
|
2
20
|
/**
|
|
3
21
|
* Construct an outliner.
|
|
@@ -12,15 +30,41 @@ export class Outliner {
|
|
|
12
30
|
* the last point of the boxes.
|
|
13
31
|
*/
|
|
14
32
|
constructor(boxes: Array<Object>, borderWidth?: number, innerMargin?: number, isLTR?: boolean);
|
|
15
|
-
getOutlines():
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
33
|
+
getOutlines(): HighlightOutline;
|
|
34
|
+
#private;
|
|
35
|
+
}
|
|
36
|
+
declare class FreeHighlightOutline extends Outline {
|
|
37
|
+
constructor(outline: any, points: any, box: any, scaleFactor: any, innerMargin: any, isLTR: any);
|
|
38
|
+
serialize([blX, blY, trX, trY]: [any, any, any, any], rotation: any): {
|
|
39
|
+
outline: number[];
|
|
40
|
+
points: number[][];
|
|
24
41
|
};
|
|
42
|
+
get box(): null;
|
|
43
|
+
getNewOutline(thickness: any, innerMargin: any): FreeHighlightOutline;
|
|
25
44
|
#private;
|
|
26
45
|
}
|
|
46
|
+
declare class HighlightOutline extends Outline {
|
|
47
|
+
constructor(outlines: any, box: any);
|
|
48
|
+
/**
|
|
49
|
+
* Serialize the outlines into the PDF page coordinate system.
|
|
50
|
+
* @param {Array<number>} _bbox - the bounding box of the annotation.
|
|
51
|
+
* @param {number} _rotation - the rotation of the annotation.
|
|
52
|
+
* @returns {Array<Array<number>>}
|
|
53
|
+
*/
|
|
54
|
+
serialize([blX, blY, trX, trY]: Array<number>, _rotation: number): Array<Array<number>>;
|
|
55
|
+
get box(): any;
|
|
56
|
+
#private;
|
|
57
|
+
}
|
|
58
|
+
declare class Outline {
|
|
59
|
+
/**
|
|
60
|
+
* @returns {string} The SVG path of the outline.
|
|
61
|
+
*/
|
|
62
|
+
toSVGPath(): string;
|
|
63
|
+
/**
|
|
64
|
+
* @type {Object|null} The bounding box of the outline.
|
|
65
|
+
*/
|
|
66
|
+
get box(): Object | null;
|
|
67
|
+
serialize(_bbox: any, _rotation: any): void;
|
|
68
|
+
get free(): any;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
@@ -5,7 +5,7 @@ export class StampEditor extends AnnotationEditor {
|
|
|
5
5
|
static _type: string;
|
|
6
6
|
static _editorType: number;
|
|
7
7
|
/** @inheritdoc */
|
|
8
|
-
static initialize(l10n: any): void;
|
|
8
|
+
static initialize(l10n: any, uiManager: any): void;
|
|
9
9
|
static get supportedTypes(): any;
|
|
10
10
|
static get supportedTypesStr(): any;
|
|
11
11
|
/** @inheritdoc */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export class EditorToolbar {
|
|
2
|
-
static "__#
|
|
2
|
+
static "__#3@#pointerDown"(e: any): void;
|
|
3
3
|
constructor(editor: any);
|
|
4
4
|
render(): HTMLDivElement;
|
|
5
5
|
hide(): void;
|
|
@@ -9,3 +9,9 @@ export class EditorToolbar {
|
|
|
9
9
|
remove(): void;
|
|
10
10
|
#private;
|
|
11
11
|
}
|
|
12
|
+
export class HighlightToolbar {
|
|
13
|
+
constructor(uiManager: any);
|
|
14
|
+
show(parent: any, boxes: any, isLTR: any): void;
|
|
15
|
+
hide(): void;
|
|
16
|
+
#private;
|
|
17
|
+
}
|
|
@@ -12,16 +12,20 @@ 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, eventBus: any, pdfDocument: any, pageColors: any, highlightColors: any);
|
|
15
|
+
constructor(container: any, viewer: any, altTextManager: any, eventBus: any, pdfDocument: any, pageColors: any, highlightColors: any, enableHighlightFloatingButton: any, mlManager: any);
|
|
16
16
|
_eventBus: any;
|
|
17
17
|
viewParameters: {
|
|
18
18
|
realScale: number;
|
|
19
19
|
rotation: number;
|
|
20
20
|
};
|
|
21
|
+
isShiftKeyDown: boolean;
|
|
21
22
|
destroy(): void;
|
|
23
|
+
mlGuess(data: any): Promise<any>;
|
|
24
|
+
get hasMLManager(): boolean;
|
|
22
25
|
get hcmFilter(): any;
|
|
23
26
|
get direction(): any;
|
|
24
27
|
get highlightColors(): any;
|
|
28
|
+
get highlightColorNames(): any;
|
|
25
29
|
setMainHighlightColorPicker(colorPicker: any): void;
|
|
26
30
|
editAltText(editor: any): void;
|
|
27
31
|
onPageChanging({ pageNumber }: {
|
|
@@ -38,6 +42,7 @@ export class AnnotationEditorUIManager {
|
|
|
38
42
|
onRotationChanging({ pagesRotation }: {
|
|
39
43
|
pagesRotation: any;
|
|
40
44
|
}): void;
|
|
45
|
+
highlightSelection(methodOfCreation?: string): void;
|
|
41
46
|
/**
|
|
42
47
|
* Add an editor in the annotation storage.
|
|
43
48
|
* @param {AnnotationEditor} editor
|
|
@@ -67,13 +72,19 @@ export class AnnotationEditorUIManager {
|
|
|
67
72
|
* @param {KeyboardEvent} event
|
|
68
73
|
*/
|
|
69
74
|
keydown(event: KeyboardEvent): void;
|
|
75
|
+
/**
|
|
76
|
+
* Keyup callback.
|
|
77
|
+
* @param {KeyboardEvent} event
|
|
78
|
+
*/
|
|
79
|
+
keyup(event: KeyboardEvent): void;
|
|
70
80
|
/**
|
|
71
81
|
* Execute an action for a given name.
|
|
72
82
|
* For example, the user can click on the "Undo" entry in the context menu
|
|
73
83
|
* and it'll trigger the undo action.
|
|
74
|
-
* @param {Object} details
|
|
75
84
|
*/
|
|
76
|
-
onEditingAction(
|
|
85
|
+
onEditingAction({ name }: {
|
|
86
|
+
name: any;
|
|
87
|
+
}): void;
|
|
77
88
|
/**
|
|
78
89
|
* Set the editing state.
|
|
79
90
|
* It can be useful to temporarily disable it when the user is editing a
|
|
@@ -121,6 +132,7 @@ export class AnnotationEditorUIManager {
|
|
|
121
132
|
* @param {*} value
|
|
122
133
|
*/
|
|
123
134
|
updateParams(type: number, value: any): void;
|
|
135
|
+
showAllEditors(type: any, visible: any, updateButton?: boolean): void;
|
|
124
136
|
enableWaiting(mustWait?: boolean): void;
|
|
125
137
|
/**
|
|
126
138
|
* Get all the editors belonging to a given page.
|
|
@@ -165,6 +177,11 @@ export class AnnotationEditorUIManager {
|
|
|
165
177
|
* @param {AnnotationEditor} editor
|
|
166
178
|
*/
|
|
167
179
|
setActiveEditor(editor: AnnotationEditor): void;
|
|
180
|
+
/**
|
|
181
|
+
* Update the UI of the active editor.
|
|
182
|
+
* @param {AnnotationEditor} editor
|
|
183
|
+
*/
|
|
184
|
+
updateUI(editor: AnnotationEditor): void;
|
|
168
185
|
/**
|
|
169
186
|
* Add or remove an editor the current selection.
|
|
170
187
|
* @param {AnnotationEditor} editor
|
|
@@ -255,6 +272,20 @@ export class AnnotationEditorUIManager {
|
|
|
255
272
|
*/
|
|
256
273
|
getMode(): number;
|
|
257
274
|
get imageManager(): any;
|
|
275
|
+
getSelectionBoxes(textLayer: any): {
|
|
276
|
+
x: number;
|
|
277
|
+
y: number;
|
|
278
|
+
width: number;
|
|
279
|
+
height: number;
|
|
280
|
+
}[] | null;
|
|
281
|
+
addChangedExistingAnnotation({ annotationElementId, id }: {
|
|
282
|
+
annotationElementId: any;
|
|
283
|
+
id: any;
|
|
284
|
+
}): void;
|
|
285
|
+
removeChangedExistingAnnotation({ annotationElementId }: {
|
|
286
|
+
annotationElementId: any;
|
|
287
|
+
}): void;
|
|
288
|
+
renderAnnotationElement(annotation: any): void;
|
|
258
289
|
#private;
|
|
259
290
|
}
|
|
260
291
|
export function bindEvents(obj: any, element: any, names: any): void;
|
|
@@ -291,6 +322,7 @@ export class CommandManager {
|
|
|
291
322
|
* @typedef {Object} addOptions
|
|
292
323
|
* @property {function} cmd
|
|
293
324
|
* @property {function} undo
|
|
325
|
+
* @property {function} [post]
|
|
294
326
|
* @property {boolean} mustExec
|
|
295
327
|
* @property {number} type
|
|
296
328
|
* @property {boolean} overwriteIfSameType
|
|
@@ -300,9 +332,10 @@ export class CommandManager {
|
|
|
300
332
|
* Add a new couple of commands to be used in case of redo/undo.
|
|
301
333
|
* @param {addOptions} options
|
|
302
334
|
*/
|
|
303
|
-
add({ cmd, undo, mustExec, type, overwriteIfSameType, keepUndo, }: {
|
|
335
|
+
add({ cmd, undo, post, mustExec, type, overwriteIfSameType, keepUndo, }: {
|
|
304
336
|
cmd: Function;
|
|
305
337
|
undo: Function;
|
|
338
|
+
post?: Function | undefined;
|
|
306
339
|
mustExec: boolean;
|
|
307
340
|
type: number;
|
|
308
341
|
overwriteIfSameType: boolean;
|
|
@@ -20,7 +20,7 @@ declare class PDFFetchStreamReader implements IPDFStreamReader {
|
|
|
20
20
|
_filename: string | null;
|
|
21
21
|
_withCredentials: any;
|
|
22
22
|
_contentLength: any;
|
|
23
|
-
_headersCapability:
|
|
23
|
+
_headersCapability: any;
|
|
24
24
|
_disableRange: any;
|
|
25
25
|
_rangeChunkSize: any;
|
|
26
26
|
_abortController: AbortController;
|
|
@@ -28,7 +28,7 @@ declare class PDFFetchStreamReader implements IPDFStreamReader {
|
|
|
28
28
|
_isRangeSupported: boolean;
|
|
29
29
|
_headers: Headers;
|
|
30
30
|
onProgress: any;
|
|
31
|
-
get headersReady():
|
|
31
|
+
get headersReady(): any;
|
|
32
32
|
get filename(): string | null;
|
|
33
33
|
get contentLength(): any;
|
|
34
34
|
get isRangeSupported(): boolean;
|
|
@@ -49,7 +49,7 @@ declare class PDFFetchStreamRangeReader implements IPDFStreamRangeReader {
|
|
|
49
49
|
_reader: ReadableStreamDefaultReader<Uint8Array> | null;
|
|
50
50
|
_loaded: number;
|
|
51
51
|
_withCredentials: any;
|
|
52
|
-
_readCapability:
|
|
52
|
+
_readCapability: any;
|
|
53
53
|
_isStreamingSupported: boolean;
|
|
54
54
|
_abortController: AbortController;
|
|
55
55
|
_headers: Headers;
|
|
@@ -64,5 +64,4 @@ declare class PDFFetchStreamRangeReader implements IPDFStreamRangeReader {
|
|
|
64
64
|
}>;
|
|
65
65
|
cancel(reason: any): void;
|
|
66
66
|
}
|
|
67
|
-
import { PromiseCapability } from "../shared/util.js";
|
|
68
67
|
export {};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
export class FontFaceObject {
|
|
2
|
-
constructor(translatedData: any, {
|
|
3
|
-
isEvalSupported?: boolean | undefined;
|
|
2
|
+
constructor(translatedData: any, { disableFontFace, inspectFont }: {
|
|
4
3
|
disableFontFace?: boolean | undefined;
|
|
5
|
-
ignoreErrors?: boolean | undefined;
|
|
6
4
|
inspectFont?: null | undefined;
|
|
7
5
|
});
|
|
8
6
|
compiledGlyphs: any;
|
|
9
|
-
isEvalSupported: boolean;
|
|
10
7
|
disableFontFace: boolean;
|
|
11
|
-
ignoreErrors: boolean;
|
|
12
8
|
_inspectFont: any;
|
|
13
9
|
createNativeFontFace(): FontFace | null;
|
|
14
10
|
createFontFaceRule(): string | null;
|
|
@@ -34,7 +34,7 @@ declare class PDFNetworkStreamFullRequestReader implements IPDFStreamReader {
|
|
|
34
34
|
_manager: any;
|
|
35
35
|
_url: any;
|
|
36
36
|
_fullRequestId: any;
|
|
37
|
-
_headersReceivedCapability:
|
|
37
|
+
_headersReceivedCapability: any;
|
|
38
38
|
_disableRange: any;
|
|
39
39
|
_contentLength: any;
|
|
40
40
|
_rangeChunkSize: any;
|
|
@@ -54,7 +54,7 @@ declare class PDFNetworkStreamFullRequestReader implements IPDFStreamReader {
|
|
|
54
54
|
get isRangeSupported(): boolean;
|
|
55
55
|
get isStreamingSupported(): boolean;
|
|
56
56
|
get contentLength(): any;
|
|
57
|
-
get headersReady():
|
|
57
|
+
get headersReady(): any;
|
|
58
58
|
read(): Promise<any>;
|
|
59
59
|
cancel(reason: any): void;
|
|
60
60
|
_fullRequestReader: any;
|
|
@@ -79,5 +79,4 @@ declare class PDFNetworkStreamRangeRequestReader implements IPDFStreamRangeReade
|
|
|
79
79
|
read(): Promise<any>;
|
|
80
80
|
cancel(reason: any): void;
|
|
81
81
|
}
|
|
82
|
-
import { PromiseCapability } from "../shared/util.js";
|
|
83
82
|
export {};
|
|
@@ -39,9 +39,9 @@ declare class BaseFullReader {
|
|
|
39
39
|
_isStreamingSupported: boolean;
|
|
40
40
|
_isRangeSupported: boolean;
|
|
41
41
|
_readableStream: any;
|
|
42
|
-
_readCapability:
|
|
43
|
-
_headersCapability:
|
|
44
|
-
get headersReady():
|
|
42
|
+
_readCapability: any;
|
|
43
|
+
_headersCapability: any;
|
|
44
|
+
get headersReady(): any;
|
|
45
45
|
get filename(): any;
|
|
46
46
|
get contentLength(): any;
|
|
47
47
|
get isRangeSupported(): boolean;
|
|
@@ -59,7 +59,7 @@ declare class BaseRangeReader {
|
|
|
59
59
|
onProgress: any;
|
|
60
60
|
_loaded: number;
|
|
61
61
|
_readableStream: any;
|
|
62
|
-
_readCapability:
|
|
62
|
+
_readCapability: any;
|
|
63
63
|
_isStreamingSupported: boolean;
|
|
64
64
|
get isStreamingSupported(): boolean;
|
|
65
65
|
read(): any;
|
|
@@ -67,5 +67,4 @@ declare class BaseRangeReader {
|
|
|
67
67
|
_error(reason: any): void;
|
|
68
68
|
_setReadableStream(readableStream: any): void;
|
|
69
69
|
}
|
|
70
|
-
import { PromiseCapability } from "../shared/util.js";
|
|
71
70
|
export {};
|
|
@@ -8,18 +8,19 @@ export class NodeCMapReaderFactory extends BaseCMapReaderFactory {
|
|
|
8
8
|
/**
|
|
9
9
|
* @ignore
|
|
10
10
|
*/
|
|
11
|
-
_fetchData(url: any, compressionType: any):
|
|
12
|
-
cMapData: any;
|
|
13
|
-
compressionType: any;
|
|
14
|
-
}>;
|
|
11
|
+
_fetchData(url: any, compressionType: any): any;
|
|
15
12
|
}
|
|
16
13
|
export class NodeFilterFactory extends BaseFilterFactory {
|
|
17
14
|
}
|
|
15
|
+
export class NodePackages {
|
|
16
|
+
static get promise(): any;
|
|
17
|
+
static get(name: any): any;
|
|
18
|
+
}
|
|
18
19
|
export class NodeStandardFontDataFactory extends BaseStandardFontDataFactory {
|
|
19
20
|
/**
|
|
20
21
|
* @ignore
|
|
21
22
|
*/
|
|
22
|
-
_fetchData(url: any):
|
|
23
|
+
_fetchData(url: any): any;
|
|
23
24
|
}
|
|
24
25
|
import { BaseCanvasFactory } from "./base_factory.js";
|
|
25
26
|
import { BaseCMapReaderFactory } from "./base_factory.js";
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
export class OptionalContentConfig {
|
|
2
|
-
constructor(data: any);
|
|
2
|
+
constructor(data: any, renderingIntent?: number);
|
|
3
|
+
renderingIntent: number;
|
|
3
4
|
name: any;
|
|
4
5
|
creator: any;
|
|
5
6
|
isVisible(group: any): any;
|
|
6
7
|
setVisibility(id: any, visible?: boolean): void;
|
|
8
|
+
setOCGState({ state, preserveRB }: {
|
|
9
|
+
state: any;
|
|
10
|
+
preserveRB: any;
|
|
11
|
+
}): void;
|
|
7
12
|
get hasInitialVisibility(): boolean;
|
|
8
13
|
getOrder(): any;
|
|
9
14
|
getGroups(): any;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
export type PageViewport = import("./display_utils").PageViewport;
|
|
2
2
|
export type TextContent = import("./api").TextContent;
|
|
3
|
-
|
|
4
|
-
* Text layer render parameters.
|
|
5
|
-
*/
|
|
6
|
-
export type TextLayerRenderParameters = {
|
|
3
|
+
export type TextLayerParameters = {
|
|
7
4
|
/**
|
|
8
5
|
* - Text content to
|
|
9
6
|
* render, i.e. the value returned by the page's `streamTextContent` or
|
|
@@ -20,132 +17,67 @@ export type TextLayerRenderParameters = {
|
|
|
20
17
|
* the text runs.
|
|
21
18
|
*/
|
|
22
19
|
viewport: PageViewport;
|
|
23
|
-
/**
|
|
24
|
-
* - HTML elements that correspond to
|
|
25
|
-
* the text items of the textContent input.
|
|
26
|
-
* This is output and shall initially be set to an empty array.
|
|
27
|
-
*/
|
|
28
|
-
textDivs?: HTMLElement[] | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* - Some properties
|
|
31
|
-
* weakly mapped to the HTML elements used to render the text.
|
|
32
|
-
*/
|
|
33
|
-
textDivProperties?: WeakMap<HTMLElement, Object> | undefined;
|
|
34
|
-
/**
|
|
35
|
-
* - Strings that correspond to
|
|
36
|
-
* the `str` property of the text items of the textContent input.
|
|
37
|
-
* This is output and shall initially be set to an empty array.
|
|
38
|
-
*/
|
|
39
|
-
textContentItemsStr?: string[] | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* true if we can use
|
|
42
|
-
* OffscreenCanvas to measure string widths.
|
|
43
|
-
*/
|
|
44
|
-
isOffscreenCanvasSupported?: boolean | undefined;
|
|
45
20
|
};
|
|
46
|
-
/**
|
|
47
|
-
* Text layer update parameters.
|
|
48
|
-
*/
|
|
49
21
|
export type TextLayerUpdateParameters = {
|
|
50
|
-
/**
|
|
51
|
-
* - The DOM node that will contain the text
|
|
52
|
-
* runs.
|
|
53
|
-
*/
|
|
54
|
-
container: HTMLElement;
|
|
55
22
|
/**
|
|
56
23
|
* - The target viewport to properly layout
|
|
57
24
|
* the text runs.
|
|
58
25
|
*/
|
|
59
26
|
viewport: PageViewport;
|
|
60
27
|
/**
|
|
61
|
-
* -
|
|
62
|
-
*
|
|
63
|
-
* This is output and shall initially be set to an empty array.
|
|
64
|
-
*/
|
|
65
|
-
textDivs?: HTMLElement[] | undefined;
|
|
66
|
-
/**
|
|
67
|
-
* - Some properties
|
|
68
|
-
* weakly mapped to the HTML elements used to render the text.
|
|
28
|
+
* - Callback invoked before the textLayer is
|
|
29
|
+
* updated in the DOM.
|
|
69
30
|
*/
|
|
70
|
-
|
|
31
|
+
onBefore?: Function | undefined;
|
|
32
|
+
};
|
|
33
|
+
export function renderTextLayer(...args: any[]): {
|
|
34
|
+
promise: Promise<any>;
|
|
35
|
+
textDivs: HTMLElement[];
|
|
36
|
+
textContentItemsStr: string[];
|
|
37
|
+
} | undefined;
|
|
38
|
+
export class TextLayer {
|
|
39
|
+
static "__#44@#ascentCache": Map<any, any>;
|
|
40
|
+
static "__#44@#canvasContexts": Map<any, any>;
|
|
41
|
+
static "__#44@#pendingTextLayers": Set<any>;
|
|
71
42
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
43
|
+
* Clean-up global textLayer data.
|
|
44
|
+
* @returns {undefined}
|
|
74
45
|
*/
|
|
75
|
-
|
|
46
|
+
static cleanup(): undefined;
|
|
47
|
+
static "__#44@#getCtx"(lang?: null): any;
|
|
48
|
+
static "__#44@#getAscent"(fontFamily: any, lang: any): any;
|
|
76
49
|
/**
|
|
77
|
-
*
|
|
50
|
+
* @param {TextLayerParameters} options
|
|
78
51
|
*/
|
|
79
|
-
|
|
52
|
+
constructor({ textContentSource, container, viewport }: TextLayerParameters);
|
|
80
53
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
54
|
+
* Render the textLayer.
|
|
55
|
+
* @returns {Promise}
|
|
83
56
|
*/
|
|
84
|
-
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* @param {TextLayerRenderParameters} params
|
|
88
|
-
* @returns {TextLayerRenderTask}
|
|
89
|
-
*/
|
|
90
|
-
export function renderTextLayer(params: TextLayerRenderParameters): TextLayerRenderTask;
|
|
91
|
-
export class TextLayerRenderTask {
|
|
92
|
-
constructor({ textContentSource, container, viewport, textDivs, textDivProperties, textContentItemsStr, isOffscreenCanvasSupported, }: {
|
|
93
|
-
textContentSource: any;
|
|
94
|
-
container: any;
|
|
95
|
-
viewport: any;
|
|
96
|
-
textDivs: any;
|
|
97
|
-
textDivProperties: any;
|
|
98
|
-
textContentItemsStr: any;
|
|
99
|
-
isOffscreenCanvasSupported: any;
|
|
100
|
-
});
|
|
101
|
-
_textContentSource: any;
|
|
102
|
-
_isReadableStream: boolean;
|
|
103
|
-
_container: any;
|
|
104
|
-
_rootContainer: any;
|
|
105
|
-
_textDivs: any;
|
|
106
|
-
_textContentItemsStr: any;
|
|
107
|
-
_isOffscreenCanvasSupported: any;
|
|
108
|
-
_fontInspectorEnabled: boolean;
|
|
109
|
-
_reader: any;
|
|
110
|
-
_textDivProperties: any;
|
|
111
|
-
_canceled: boolean;
|
|
112
|
-
_capability: PromiseCapability;
|
|
113
|
-
_layoutTextParams: {
|
|
114
|
-
prevFontSize: null;
|
|
115
|
-
prevFontFamily: null;
|
|
116
|
-
div: null;
|
|
117
|
-
scale: number;
|
|
118
|
-
properties: null;
|
|
119
|
-
ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D | null;
|
|
120
|
-
};
|
|
121
|
-
_transform: any[];
|
|
122
|
-
_pageWidth: any;
|
|
123
|
-
_pageHeight: any;
|
|
57
|
+
render(): Promise<any>;
|
|
124
58
|
/**
|
|
125
|
-
*
|
|
126
|
-
* @
|
|
59
|
+
* Update a previously rendered textLayer, if necessary.
|
|
60
|
+
* @param {TextLayerUpdateParameters} options
|
|
61
|
+
* @returns {undefined}
|
|
127
62
|
*/
|
|
128
|
-
|
|
63
|
+
update({ viewport, onBefore }: TextLayerUpdateParameters): undefined;
|
|
129
64
|
/**
|
|
130
65
|
* Cancel rendering of the textLayer.
|
|
66
|
+
* @returns {undefined}
|
|
131
67
|
*/
|
|
132
|
-
cancel():
|
|
133
|
-
/**
|
|
134
|
-
* @private
|
|
135
|
-
*/
|
|
136
|
-
private _processItems;
|
|
68
|
+
cancel(): undefined;
|
|
137
69
|
/**
|
|
138
|
-
* @
|
|
70
|
+
* @type {Array<HTMLElement>} HTML elements that correspond to the text items
|
|
71
|
+
* of the textContent input.
|
|
72
|
+
* This is output and will initially be set to an empty array.
|
|
139
73
|
*/
|
|
140
|
-
|
|
74
|
+
get textDivs(): HTMLElement[];
|
|
141
75
|
/**
|
|
142
|
-
* @
|
|
76
|
+
* @type {Array<string>} Strings that correspond to the `str` property of
|
|
77
|
+
* the text items of the textContent input.
|
|
78
|
+
* This is output and will initially be set to an empty array
|
|
143
79
|
*/
|
|
144
|
-
|
|
80
|
+
get textContentItemsStr(): string[];
|
|
81
|
+
#private;
|
|
145
82
|
}
|
|
146
|
-
|
|
147
|
-
* @param {TextLayerUpdateParameters} params
|
|
148
|
-
* @returns {undefined}
|
|
149
|
-
*/
|
|
150
|
-
export function updateTextLayer({ container, viewport, textDivs, textDivProperties, isOffscreenCanvasSupported, mustRotate, mustRescale, }: TextLayerUpdateParameters): undefined;
|
|
151
|
-
import { PromiseCapability } from "../shared/util.js";
|
|
83
|
+
export function updateTextLayer(): void;
|
|
@@ -3,16 +3,12 @@ export type IPDFStreamReader = import("../interfaces").IPDFStreamReader;
|
|
|
3
3
|
export type IPDFStreamRangeReader = import("../interfaces").IPDFStreamRangeReader;
|
|
4
4
|
/** @implements {IPDFStream} */
|
|
5
5
|
export class PDFDataTransportStream implements IPDFStream {
|
|
6
|
-
constructor(
|
|
7
|
-
length: any;
|
|
8
|
-
initialData: any;
|
|
9
|
-
progressiveDone?: boolean | undefined;
|
|
10
|
-
contentDispositionFilename?: null | undefined;
|
|
6
|
+
constructor(pdfDataRangeTransport: any, { disableRange, disableStream }: {
|
|
11
7
|
disableRange?: boolean | undefined;
|
|
12
8
|
disableStream?: boolean | undefined;
|
|
13
|
-
}
|
|
9
|
+
});
|
|
14
10
|
_queuedChunks: ArrayBuffer[];
|
|
15
|
-
_progressiveDone:
|
|
11
|
+
_progressiveDone: any;
|
|
16
12
|
_contentDispositionFilename: any;
|
|
17
13
|
_pdfDataRangeTransport: any;
|
|
18
14
|
_isStreamingSupported: boolean;
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
export
|
|
1
|
+
export class GlobalWorkerOptions {
|
|
2
|
+
static "__#39@#port": null;
|
|
3
|
+
static "__#39@#src": string;
|
|
2
4
|
/**
|
|
3
|
-
* - Defines global port for worker
|
|
4
|
-
*
|
|
5
|
+
* @param {Worker | null} workerPort - Defines global port for worker process.
|
|
6
|
+
* Overrides the `workerSrc` option.
|
|
5
7
|
*/
|
|
6
|
-
workerPort: Worker | null;
|
|
8
|
+
static set workerPort(val: Worker | null);
|
|
7
9
|
/**
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
+
* @type {Worker | null}
|
|
11
|
+
*/
|
|
12
|
+
static get workerPort(): Worker | null;
|
|
13
|
+
/**
|
|
14
|
+
* @param {string} workerSrc - A string containing the path and filename of
|
|
15
|
+
* the worker file.
|
|
10
16
|
*
|
|
11
|
-
*
|
|
12
|
-
* issues when using the PDF.js library.
|
|
17
|
+
* NOTE: The `workerSrc` option should always be set, in order to prevent
|
|
18
|
+
* any issues when using the PDF.js library.
|
|
19
|
+
*/
|
|
20
|
+
static set workerSrc(val: string);
|
|
21
|
+
/**
|
|
22
|
+
* @type {string}
|
|
13
23
|
*/
|
|
14
|
-
workerSrc: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* @typedef {Object} GlobalWorkerOptionsType
|
|
18
|
-
* @property {Worker | null} workerPort - Defines global port for worker
|
|
19
|
-
* process. Overrides the `workerSrc` option.
|
|
20
|
-
* @property {string} workerSrc - A string containing the path and filename
|
|
21
|
-
* of the worker file.
|
|
22
|
-
*
|
|
23
|
-
* NOTE: The `workerSrc` option should always be set, in order to prevent any
|
|
24
|
-
* issues when using the PDF.js library.
|
|
25
|
-
*/
|
|
26
|
-
/** @type {GlobalWorkerOptionsType} */
|
|
27
|
-
export const GlobalWorkerOptions: GlobalWorkerOptionsType;
|
|
24
|
+
static get workerSrc(): string;
|
|
25
|
+
}
|
package/dist/types/src/pdf.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export type PDFDocumentProxy = import("./display/api").PDFDocumentProxy;
|
|
|
4
4
|
export type PDFPageProxy = import("./display/api").PDFPageProxy;
|
|
5
5
|
export type RenderTask = import("./display/api").RenderTask;
|
|
6
6
|
export type PageViewport = import("./display/display_utils").PageViewport;
|
|
7
|
-
export type TextLayerRenderTask = import("./display/text_layer").TextLayerRenderTask;
|
|
8
7
|
import { AbortException } from "./shared/util.js";
|
|
9
8
|
import { AnnotationEditorLayer } from "./display/editor/annotation_editor_layer.js";
|
|
10
9
|
import { AnnotationEditorParamsType } from "./shared/util.js";
|
|
@@ -40,15 +39,15 @@ import { PDFDateString } from "./display/display_utils.js";
|
|
|
40
39
|
import { PDFWorker } from "./display/api.js";
|
|
41
40
|
import { PermissionFlag } from "./shared/util.js";
|
|
42
41
|
import { PixelsPerInch } from "./display/display_utils.js";
|
|
43
|
-
import { PromiseCapability } from "./shared/util.js";
|
|
44
42
|
import { RenderingCancelledException } from "./display/display_utils.js";
|
|
45
43
|
import { renderTextLayer } from "./display/text_layer.js";
|
|
46
44
|
import { setLayerDimensions } from "./display/display_utils.js";
|
|
47
45
|
import { shadow } from "./shared/util.js";
|
|
46
|
+
import { TextLayer } from "./display/text_layer.js";
|
|
48
47
|
import { UnexpectedResponseException } from "./shared/util.js";
|
|
49
48
|
import { updateTextLayer } from "./display/text_layer.js";
|
|
50
49
|
import { Util } from "./shared/util.js";
|
|
51
50
|
import { VerbosityLevel } from "./shared/util.js";
|
|
52
51
|
import { version } from "./display/api.js";
|
|
53
52
|
import { XfaLayer } from "./display/xfa_layer.js";
|
|
54
|
-
export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, build, CMapCompressionType, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, MissingPDFException, noContextMenu, normalizeUnicode, OPS, Outliner, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch,
|
|
53
|
+
export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, build, CMapCompressionType, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, MissingPDFException, noContextMenu, normalizeUnicode, OPS, Outliner, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, renderTextLayer, setLayerDimensions, shadow, TextLayer, UnexpectedResponseException, updateTextLayer, Util, VerbosityLevel, version, XfaLayer };
|