pdfjs-serverless 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -35
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -79752
- package/dist/types/src/display/api.d.ts +2 -8
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +22 -8
- package/dist/types/src/display/editor/editor.d.ts +26 -9
- package/dist/types/src/display/editor/stamp.d.ts +6 -0
- package/dist/types/src/display/editor/tools.d.ts +29 -4
- package/dist/types/src/shared/scripting_utils.d.ts +5 -1
- package/dist/types/src/shared/util.d.ts +2 -0
- package/dist/types/web/pdf_scripting_manager.d.ts +1 -1
- package/package.json +6 -5
|
@@ -874,16 +874,10 @@ export class PDFDocumentProxy {
|
|
|
874
874
|
* for mapping named attachments to their content.
|
|
875
875
|
*/
|
|
876
876
|
getAttachments(): Promise<any>;
|
|
877
|
-
/**
|
|
878
|
-
* @returns {Promise<Array<string> | null>} A promise that is resolved with
|
|
879
|
-
* an {Array} of all the JavaScript strings in the name tree, or `null`
|
|
880
|
-
* if no JavaScript exists.
|
|
881
|
-
*/
|
|
882
|
-
getJavaScript(): Promise<Array<string> | null>;
|
|
883
877
|
/**
|
|
884
878
|
* @returns {Promise<Object | null>} A promise that is resolved with
|
|
885
879
|
* an {Object} with the JavaScript actions:
|
|
886
|
-
* - from the name tree
|
|
880
|
+
* - from the name tree.
|
|
887
881
|
* - from A or AA entries in the catalog dictionary.
|
|
888
882
|
* , or `null` if no JavaScript exists.
|
|
889
883
|
*/
|
|
@@ -1340,7 +1334,7 @@ export class PDFPageProxy {
|
|
|
1340
1334
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
1341
1335
|
*/
|
|
1342
1336
|
export class PDFWorker {
|
|
1343
|
-
static "__#35@#workerPorts":
|
|
1337
|
+
static "__#35@#workerPorts": any;
|
|
1344
1338
|
/**
|
|
1345
1339
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
1346
1340
|
*/
|
|
@@ -91,6 +91,12 @@ export class AnnotationEditorLayer {
|
|
|
91
91
|
* @param {AnnotationEditor} editor
|
|
92
92
|
*/
|
|
93
93
|
remove(editor: AnnotationEditor): void;
|
|
94
|
+
/**
|
|
95
|
+
* An editor can have a different parent, for example after having
|
|
96
|
+
* being dragged and droped from a page to another.
|
|
97
|
+
* @param {AnnotationEditor} editor
|
|
98
|
+
*/
|
|
99
|
+
changeParent(editor: AnnotationEditor): void;
|
|
94
100
|
/**
|
|
95
101
|
* Add a new editor in the current view.
|
|
96
102
|
* @param {AnnotationEditor} editor
|
|
@@ -112,12 +118,22 @@ export class AnnotationEditorLayer {
|
|
|
112
118
|
* @returns {string}
|
|
113
119
|
*/
|
|
114
120
|
getNextId(): string;
|
|
121
|
+
/**
|
|
122
|
+
* Paste some content into a new editor.
|
|
123
|
+
* @param {number} mode
|
|
124
|
+
* @param {Object} params
|
|
125
|
+
*/
|
|
126
|
+
pasteEditor(mode: number, params: Object): void;
|
|
115
127
|
/**
|
|
116
128
|
* Create a new editor
|
|
117
129
|
* @param {Object} data
|
|
118
130
|
* @returns {AnnotationEditor}
|
|
119
131
|
*/
|
|
120
132
|
deserialize(data: Object): AnnotationEditor;
|
|
133
|
+
/**
|
|
134
|
+
* Create and add a new editor.
|
|
135
|
+
*/
|
|
136
|
+
addNewEditor(): void;
|
|
121
137
|
/**
|
|
122
138
|
* Set the last selected editor.
|
|
123
139
|
* @param {AnnotationEditor} editor
|
|
@@ -149,15 +165,13 @@ export class AnnotationEditorLayer {
|
|
|
149
165
|
*/
|
|
150
166
|
pointerdown(event: PointerEvent): void;
|
|
151
167
|
/**
|
|
152
|
-
*
|
|
153
|
-
* @param {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
* Dragover callback.
|
|
158
|
-
* @param {DragEvent} event
|
|
168
|
+
*
|
|
169
|
+
* @param {AnnotationEditor} editor
|
|
170
|
+
* @param {number} x
|
|
171
|
+
* @param {number} y
|
|
172
|
+
* @returns
|
|
159
173
|
*/
|
|
160
|
-
|
|
174
|
+
findNewParent(editor: AnnotationEditor, x: number, y: number): boolean;
|
|
161
175
|
/**
|
|
162
176
|
* Destroy the main editor.
|
|
163
177
|
*/
|
|
@@ -54,6 +54,22 @@ export class AnnotationEditor {
|
|
|
54
54
|
* @returns {Array}
|
|
55
55
|
*/
|
|
56
56
|
static get defaultPropertiesToUpdate(): any[];
|
|
57
|
+
/**
|
|
58
|
+
* Check if this kind of editor is able to handle the given mime type for
|
|
59
|
+
* pasting.
|
|
60
|
+
* @param {string} mime
|
|
61
|
+
* @returns {boolean}
|
|
62
|
+
*/
|
|
63
|
+
static isHandlingMimeForPasting(_mime: any): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Extract the data from the clipboard item and delegate the creation of the
|
|
66
|
+
* editor to the parent.
|
|
67
|
+
* @param {DataTransferItem} item
|
|
68
|
+
* @param {AnnotationEditorLayer} parent
|
|
69
|
+
*/
|
|
70
|
+
static paste(item: DataTransferItem, parent: AnnotationEditorLayer): void;
|
|
71
|
+
static "__#23@#rotatePoint"(x: any, y: any, angle: any): any[];
|
|
72
|
+
static "__#23@#noContextMenu"(e: any): void;
|
|
57
73
|
/**
|
|
58
74
|
* Deserialize the editor.
|
|
59
75
|
* The result of the deserialization is a new editor.
|
|
@@ -69,7 +85,9 @@ export class AnnotationEditor {
|
|
|
69
85
|
* @param {AnnotationEditorParameters} parameters
|
|
70
86
|
*/
|
|
71
87
|
constructor(parameters: AnnotationEditorParameters);
|
|
88
|
+
_initialOptions: any;
|
|
72
89
|
_uiManager: null;
|
|
90
|
+
_focusEventsAllowed: boolean;
|
|
73
91
|
parent: import("./annotation_editor_layer.js").AnnotationEditorLayer;
|
|
74
92
|
id: string;
|
|
75
93
|
width: any;
|
|
@@ -92,6 +110,9 @@ export class AnnotationEditor {
|
|
|
92
110
|
* @returns {Array}
|
|
93
111
|
*/
|
|
94
112
|
get propertiesToUpdate(): any[];
|
|
113
|
+
set _isDraggable(arg: boolean);
|
|
114
|
+
get _isDraggable(): boolean;
|
|
115
|
+
center(): void;
|
|
95
116
|
/**
|
|
96
117
|
* Add some commands into the CommandManager (undo/redo stuff).
|
|
97
118
|
* @param {Object} params
|
|
@@ -122,13 +143,6 @@ export class AnnotationEditor {
|
|
|
122
143
|
*/
|
|
123
144
|
commit(): void;
|
|
124
145
|
addToAnnotationStorage(): void;
|
|
125
|
-
/**
|
|
126
|
-
* We use drag-and-drop in order to move an editor on a page.
|
|
127
|
-
* @param {DragEvent} event
|
|
128
|
-
*/
|
|
129
|
-
dragstart(event: DragEvent): void;
|
|
130
|
-
startX: number | undefined;
|
|
131
|
-
startY: number | undefined;
|
|
132
146
|
/**
|
|
133
147
|
* Set the editor position within its parent.
|
|
134
148
|
* @param {number} x
|
|
@@ -150,19 +164,20 @@ export class AnnotationEditor {
|
|
|
150
164
|
* @param {number} y - y-translation in page coordinates.
|
|
151
165
|
*/
|
|
152
166
|
translateInPage(x: number, y: number): void;
|
|
167
|
+
drag(tx: any, ty: any): void;
|
|
153
168
|
fixAndSetPosition(): void;
|
|
154
169
|
/**
|
|
155
170
|
* Convert a screen translation into a page one.
|
|
156
171
|
* @param {number} x
|
|
157
172
|
* @param {number} y
|
|
158
173
|
*/
|
|
159
|
-
screenToPageTranslation(x: number, y: number):
|
|
174
|
+
screenToPageTranslation(x: number, y: number): any[];
|
|
160
175
|
/**
|
|
161
176
|
* Convert a page translation into a screen one.
|
|
162
177
|
* @param {number} x
|
|
163
178
|
* @param {number} y
|
|
164
179
|
*/
|
|
165
|
-
pageTranslationToScreen(x: number, y: number):
|
|
180
|
+
pageTranslationToScreen(x: number, y: number): any[];
|
|
166
181
|
get parentScale(): any;
|
|
167
182
|
get parentRotation(): number;
|
|
168
183
|
get parentDimensions(): number[];
|
|
@@ -188,6 +203,8 @@ export class AnnotationEditor {
|
|
|
188
203
|
* @param {PointerEvent} event
|
|
189
204
|
*/
|
|
190
205
|
pointerdown(event: PointerEvent): void;
|
|
206
|
+
moveInDOM(): void;
|
|
207
|
+
_setParentAndPosition(parent: any, x: any, y: any): void;
|
|
191
208
|
/**
|
|
192
209
|
* Convert the current rect into a page one.
|
|
193
210
|
*/
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export class StampEditor extends AnnotationEditor {
|
|
5
5
|
static _type: string;
|
|
6
|
+
static get supportedTypes(): any;
|
|
7
|
+
static get supportedTypesStr(): any;
|
|
8
|
+
/** @inheritdoc */
|
|
9
|
+
static isHandlingMimeForPasting(mime: any): any;
|
|
10
|
+
/** @inheritdoc */
|
|
11
|
+
static paste(item: any, parent: any): void;
|
|
6
12
|
/** @inheritdoc */
|
|
7
13
|
static deserialize(data: any, parent: any, uiManager: any): AnnotationEditor | null;
|
|
8
14
|
constructor(params: any);
|
|
@@ -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, eventBus: any, pdfDocument: any, pageColors: any);
|
|
15
|
+
constructor(container: any, viewer: any, eventBus: any, pdfDocument: any, pageColors: any);
|
|
16
16
|
viewParameters: {
|
|
17
17
|
realScale: number;
|
|
18
18
|
rotation: number;
|
|
@@ -23,6 +23,8 @@ export class AnnotationEditorUIManager {
|
|
|
23
23
|
pageNumber: any;
|
|
24
24
|
}): void;
|
|
25
25
|
focusMainContainer(): void;
|
|
26
|
+
findParent(x: any, y: any): any;
|
|
27
|
+
disableUserSelect(value?: boolean): void;
|
|
26
28
|
addShouldRescale(editor: any): void;
|
|
27
29
|
removeShouldRescale(editor: any): void;
|
|
28
30
|
onScaleChanging({ scale }: {
|
|
@@ -36,6 +38,8 @@ export class AnnotationEditorUIManager {
|
|
|
36
38
|
* @param {AnnotationEditor} editor
|
|
37
39
|
*/
|
|
38
40
|
addToAnnotationStorage(editor: AnnotationEditor): void;
|
|
41
|
+
blur(): void;
|
|
42
|
+
focus(): void;
|
|
39
43
|
/**
|
|
40
44
|
* Copy callback.
|
|
41
45
|
* @param {ClipboardEvent} event
|
|
@@ -77,6 +81,7 @@ export class AnnotationEditorUIManager {
|
|
|
77
81
|
*/
|
|
78
82
|
getId(): string;
|
|
79
83
|
get currentLayer(): any;
|
|
84
|
+
getLayer(pageIndex: any): any;
|
|
80
85
|
get currentPageIndex(): number;
|
|
81
86
|
/**
|
|
82
87
|
* Add a new layer for a page which will contains the editors.
|
|
@@ -106,8 +111,9 @@ export class AnnotationEditorUIManager {
|
|
|
106
111
|
* @param {*} value
|
|
107
112
|
*/
|
|
108
113
|
updateParams(type: number, value: any): void;
|
|
114
|
+
enableWaiting(mustWait?: boolean): void;
|
|
109
115
|
/**
|
|
110
|
-
* Get all the editors belonging to a
|
|
116
|
+
* Get all the editors belonging to a given page.
|
|
111
117
|
* @param {number} pageIndex
|
|
112
118
|
* @returns {Array<AnnotationEditor>}
|
|
113
119
|
*/
|
|
@@ -170,7 +176,6 @@ export class AnnotationEditorUIManager {
|
|
|
170
176
|
*/
|
|
171
177
|
unselect(editor: AnnotationEditor): void;
|
|
172
178
|
get hasSelection(): boolean;
|
|
173
|
-
stopUndoAccumulation(): void;
|
|
174
179
|
/**
|
|
175
180
|
* Undo the last command.
|
|
176
181
|
*/
|
|
@@ -199,6 +204,27 @@ export class AnnotationEditorUIManager {
|
|
|
199
204
|
*/
|
|
200
205
|
unselectAll(): void;
|
|
201
206
|
translateSelectedEditors(x: any, y: any, noCommit?: boolean): void;
|
|
207
|
+
/**
|
|
208
|
+
* Set up the drag session for moving the selected editors.
|
|
209
|
+
*/
|
|
210
|
+
setUpDragSession(): void;
|
|
211
|
+
/**
|
|
212
|
+
* Ends the drag session.
|
|
213
|
+
* @returns {boolean} true if at least one editor has been moved.
|
|
214
|
+
*/
|
|
215
|
+
endDragSession(): boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Drag the set of selected editors.
|
|
218
|
+
* @param {number} tx
|
|
219
|
+
* @param {number} ty
|
|
220
|
+
*/
|
|
221
|
+
dragSelectedEditors(tx: number, ty: number): void;
|
|
222
|
+
/**
|
|
223
|
+
* Rebuild the editor (usually on undo/redo actions) on a potentially
|
|
224
|
+
* non-rendered page.
|
|
225
|
+
* @param {AnnotationEditor} editor
|
|
226
|
+
*/
|
|
227
|
+
rebuild(editor: AnnotationEditor): void;
|
|
202
228
|
/**
|
|
203
229
|
* Is the current editor the one passed as argument?
|
|
204
230
|
* @param {AnnotationEditor} editor
|
|
@@ -269,7 +295,6 @@ export class CommandManager {
|
|
|
269
295
|
overwriteIfSameType: boolean;
|
|
270
296
|
keepUndo: boolean;
|
|
271
297
|
}): void;
|
|
272
|
-
stopUndoAccumulation(): void;
|
|
273
298
|
/**
|
|
274
299
|
* Undo the last command.
|
|
275
300
|
*/
|
|
@@ -2,11 +2,15 @@ export class ColorConverters {
|
|
|
2
2
|
static CMYK_G([c, y, m, k]: [any, any, any, any]): (string | number)[];
|
|
3
3
|
static G_CMYK([g]: [any]): (string | number)[];
|
|
4
4
|
static G_RGB([g]: [any]): any[];
|
|
5
|
+
static G_rgb([g]: [any]): any[];
|
|
5
6
|
static G_HTML([g]: [any]): string;
|
|
6
7
|
static RGB_G([r, g, b]: [any, any, any]): (string | number)[];
|
|
7
|
-
static
|
|
8
|
+
static RGB_rgb(color: any): any;
|
|
9
|
+
static RGB_HTML(color: any): string;
|
|
8
10
|
static T_HTML(): string;
|
|
11
|
+
static T_rgb(): null[];
|
|
9
12
|
static CMYK_RGB([c, y, m, k]: [any, any, any, any]): (string | number)[];
|
|
13
|
+
static CMYK_rgb([c, y, m, k]: [any, any, any, any]): number[];
|
|
10
14
|
static CMYK_HTML(components: any): string;
|
|
11
15
|
static RGB_CMYK([r, g, b]: [any, any, any]): (string | number)[];
|
|
12
16
|
}
|
|
@@ -31,6 +31,7 @@ export namespace AnnotationBorderStyleType {
|
|
|
31
31
|
}
|
|
32
32
|
export namespace AnnotationEditorParamsType {
|
|
33
33
|
let RESIZE: number;
|
|
34
|
+
let CREATE: number;
|
|
34
35
|
let FREETEXT_SIZE: number;
|
|
35
36
|
let FREETEXT_COLOR: number;
|
|
36
37
|
let FREETEXT_OPACITY: number;
|
|
@@ -156,6 +157,7 @@ export class FeatureTest {
|
|
|
156
157
|
static get isEvalSupported(): any;
|
|
157
158
|
static get isOffscreenCanvasSupported(): any;
|
|
158
159
|
static get platform(): any;
|
|
160
|
+
static get isCSSRoundSupported(): any;
|
|
159
161
|
}
|
|
160
162
|
export const FONT_IDENTITY_MATRIX: number[];
|
|
161
163
|
declare const FormatError_base: any;
|
|
@@ -41,7 +41,7 @@ export class PDFScriptingManager {
|
|
|
41
41
|
setDocument(pdfDocument: any): Promise<void>;
|
|
42
42
|
dispatchWillSave(): Promise<any>;
|
|
43
43
|
dispatchDidSave(): Promise<any>;
|
|
44
|
-
dispatchWillPrint(): Promise<
|
|
44
|
+
dispatchWillPrint(): Promise<void>;
|
|
45
45
|
dispatchDidPrint(): Promise<any>;
|
|
46
46
|
get destroyPromise(): any;
|
|
47
47
|
get ready(): boolean;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdfjs-serverless",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
5
|
-
"packageManager": "pnpm@8.
|
|
6
|
-
"description": "Serverless build of PDF.js",
|
|
4
|
+
"version": "0.2.3",
|
|
5
|
+
"packageManager": "pnpm@8.7.0",
|
|
6
|
+
"description": "Serverless build of PDF.js for Deno, workers, and other nodeless environments",
|
|
7
7
|
"author": "Johann Schopplich <pkg@johannschopplich.com>",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"homepage": "https://github.com/johannschopplich/pdfjs-serverless#readme",
|
|
@@ -48,11 +48,12 @@
|
|
|
48
48
|
"@rollup/plugin-inject": "^5.0.3",
|
|
49
49
|
"@rollup/plugin-node-resolve": "^15.2.1",
|
|
50
50
|
"@rollup/plugin-replace": "^5.0.2",
|
|
51
|
+
"@rollup/plugin-terser": "^0.4.3",
|
|
51
52
|
"@rollup/plugin-typescript": "^11.1.3",
|
|
52
|
-
"@types/node": "^20.5.
|
|
53
|
+
"@types/node": "^20.5.7",
|
|
53
54
|
"bumpp": "^9.2.0",
|
|
54
55
|
"eslint": "^8.48.0",
|
|
55
|
-
"pdfjs-dist": "^3.
|
|
56
|
+
"pdfjs-dist": "^3.10.111",
|
|
56
57
|
"rollup": "^3.28.1",
|
|
57
58
|
"typescript": "5.1.6",
|
|
58
59
|
"unenv": "^1.7.4"
|