pdfjs-serverless 1.3.0 → 2.0.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 +52 -38
- package/dist/image-decoders.d.mts +1 -0
- package/dist/image-decoders.mjs +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +41 -40
- package/dist/licenses/LICENSE_JBIG2 +196 -0
- package/dist/licenses/LICENSE_OPENJPEG +39 -0
- package/dist/licenses/LICENSE_PDFJS +177 -0
- package/dist/licenses/LICENSE_PDFJS_JBIG2 +13 -0
- package/dist/licenses/LICENSE_PDFJS_OPENJPEG +22 -0
- package/dist/pdfjs-decoders-workerd.mjs +1 -0
- package/dist/pdfjs-decoders.mjs +1 -0
- package/dist/pdfjs-jbig2.mjs +1 -0
- package/dist/pdfjs-jbig2_nowasm_fallback.mjs +1 -0
- package/dist/pdfjs-loader.mjs +1 -0
- package/dist/pdfjs-openjpeg.mjs +1 -0
- package/dist/pdfjs-openjpeg_nowasm_fallback.mjs +2 -0
- package/dist/pdfjs-rolldown-runtime.mjs +1 -0
- package/dist/types/external/qcms/qcms.d.ts +11 -7
- package/dist/types/external/qcms/qcms_utils.d.ts +1 -6
- package/dist/types/src/core/base_stream.d.ts +8 -1
- package/dist/types/src/core/catalog.d.ts +12 -12
- package/dist/types/src/core/colorspace.d.ts +6 -15
- package/dist/types/src/core/core_utils.d.ts +18 -14
- package/dist/types/src/core/crypto.d.ts +0 -1
- package/dist/types/src/core/file_spec.d.ts +4 -9
- package/dist/types/src/core/icc_colorspace.d.ts +0 -1
- package/dist/types/src/core/image_resizer.d.ts +24 -0
- package/dist/types/src/core/image_utils.d.ts +4 -4
- package/dist/types/src/core/jpeg_stream.d.ts +1 -1
- package/dist/types/src/core/jpg.d.ts +9 -13
- package/dist/types/src/core/parser.d.ts +0 -2
- package/dist/types/src/core/pattern.d.ts +0 -2
- package/dist/types/src/core/primitives.d.ts +30 -16
- package/dist/types/src/core/sasl_prep.d.ts +1 -0
- package/dist/types/src/core/sound.d.ts +39 -0
- package/dist/types/src/core/string_utils.d.ts +1 -1
- package/dist/types/src/core/struct_tree.d.ts +3 -3
- package/dist/types/src/core/xml_parser.d.ts +1 -2
- package/dist/types/src/core/xref.d.ts +2 -15
- package/dist/types/src/display/annotation_layer.d.ts +11 -22
- package/dist/types/src/display/annotation_storage.d.ts +7 -7
- package/dist/types/src/display/api.d.ts +155 -108
- package/dist/types/src/display/canvas.d.ts +2 -1
- package/dist/types/src/display/canvas_dependency_tracker.d.ts +8 -3
- package/dist/types/src/display/content_disposition.d.ts +0 -1
- package/dist/types/src/display/display_utils.d.ts +2 -2
- package/dist/types/src/display/draw_layer.d.ts +2 -6
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +18 -19
- package/dist/types/src/display/editor/color_picker.d.ts +1 -1
- package/dist/types/src/display/editor/comment.d.ts +1 -1
- package/dist/types/src/display/editor/draw.d.ts +78 -27
- package/dist/types/src/display/editor/drawers/freedraw.d.ts +11 -9
- package/dist/types/src/display/editor/drawers/highlight.d.ts +99 -15
- package/dist/types/src/display/editor/drawers/inkdraw.d.ts +7 -2
- package/dist/types/src/display/editor/drawers/outline.d.ts +65 -2
- package/dist/types/src/display/editor/editor.d.ts +24 -22
- package/dist/types/src/display/editor/freetext.d.ts +1 -1
- package/dist/types/src/display/editor/highlight.d.ts +44 -35
- package/dist/types/src/display/editor/ink.d.ts +7 -2
- package/dist/types/src/display/editor/stamp.d.ts +1 -1
- package/dist/types/src/display/editor/tools.d.ts +21 -19
- package/dist/types/src/display/filter_factory.d.ts +1 -3
- package/dist/types/src/display/font_loader.d.ts +1 -15
- package/dist/types/src/display/network_utils.d.ts +1 -0
- package/dist/types/src/display/obj_bin_transform_display.d.ts +25 -38
- package/dist/types/src/display/page_viewport.d.ts +5 -5
- package/dist/types/src/display/pages_mapper.d.ts +10 -4
- package/dist/types/src/display/pattern_helper.d.ts +4 -3
- package/dist/types/src/display/pdf_objects.d.ts +1 -3
- package/dist/types/src/display/text_layer.d.ts +6 -4
- package/dist/types/src/display/touch_manager.d.ts +46 -9
- package/dist/types/src/display/worker_options.d.ts +2 -2
- package/dist/types/src/display/xfa_layer.d.ts +9 -14
- package/dist/types/src/display/xfa_text.d.ts +4 -7
- package/dist/types/src/pdf.d.ts +8 -7
- package/dist/types/src/shared/base_pdf_stream.d.ts +6 -7
- package/dist/types/src/shared/css_utils.d.ts +8 -0
- package/dist/types/src/shared/message_handler.d.ts +2 -11
- package/dist/types/src/shared/obj_bin_transform_utils.d.ts +4 -3
- package/dist/types/src/shared/util.d.ts +4 -6
- package/dist/types/web/annotation_editor_layer_builder.d.ts +10 -8
- package/dist/types/web/annotation_layer_builder.d.ts +17 -21
- package/dist/types/web/draw_layer_builder.d.ts +7 -9
- package/dist/types/web/event_utils.d.ts +12 -13
- package/dist/types/web/genericl10n.d.ts +2 -2
- package/dist/types/web/l10n.d.ts +1 -1
- package/dist/types/web/pdf_find_controller.d.ts +9 -10
- package/dist/types/web/pdf_find_utils.d.ts +8 -14
- package/dist/types/web/pdf_history.d.ts +2 -2
- package/dist/types/web/pdf_link_service.d.ts +7 -9
- package/dist/types/web/pdf_page_view.d.ts +15 -15
- package/dist/types/web/pdf_rendering_queue.d.ts +7 -8
- package/dist/types/web/pdf_scripting_manager.d.ts +5 -5
- package/dist/types/web/pdf_thumbnail_view.d.ts +11 -11
- package/dist/types/web/pdf_thumbnail_viewer.d.ts +21 -22
- package/dist/types/web/pdf_viewer.d.ts +49 -29
- package/dist/types/web/renderable_view.d.ts +3 -3
- package/dist/types/web/sidebar.d.ts +3 -3
- package/dist/types/web/struct_tree_layer_builder.d.ts +21 -7
- package/dist/types/web/text_accessibility.d.ts +4 -2
- package/dist/types/web/text_highlighter.d.ts +7 -8
- package/dist/types/web/text_layer_builder.d.ts +11 -11
- package/dist/types/web/ui_utils.d.ts +8 -13
- package/dist/types/web/xfa_layer_builder.d.ts +13 -13
- package/package.json +27 -16
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export type PDFDocumentProxy = import("../src/display/api").PDFDocumentProxy;
|
|
2
|
-
export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
|
|
3
|
-
export type PageViewport = import("../src/display/page_viewport").PageViewport;
|
|
4
|
-
export type OptionalContentConfig = import("../src/display/optional_content_config").OptionalContentConfig;
|
|
5
|
-
export type EventBus = import("./event_utils").EventBus;
|
|
6
|
-
export type PDFFindController = import("./pdf_find_controller").PDFFindController;
|
|
7
|
-
export type PDFScriptingManager = import("./pdf_scripting_manager").PDFScriptingManager;
|
|
1
|
+
export type PDFDocumentProxy = import("../src/display/api.js").PDFDocumentProxy;
|
|
2
|
+
export type PDFPageProxy = import("../src/display/api.js").PDFPageProxy;
|
|
3
|
+
export type PageViewport = import("../src/display/page_viewport.js").PageViewport;
|
|
4
|
+
export type OptionalContentConfig = import("../src/display/optional_content_config.js").OptionalContentConfig;
|
|
5
|
+
export type EventBus = import("./event_utils.js").EventBus;
|
|
6
|
+
export type PDFFindController = import("./pdf_find_controller.js").PDFFindController;
|
|
7
|
+
export type PDFScriptingManager = import("./pdf_scripting_manager.js").PDFScriptingManager;
|
|
8
8
|
export type PDFLinkService = import("./pdf_link_service.js").PDFLinkService;
|
|
9
9
|
export type BaseDownloadManager = import("./base_download_manager.js").BaseDownloadManager;
|
|
10
10
|
export type L10n = import("./l10n.js").L10n;
|
|
@@ -34,12 +34,12 @@ export type PDFViewerOptions = {
|
|
|
34
34
|
* - The find controller
|
|
35
35
|
* component.
|
|
36
36
|
*/
|
|
37
|
-
findController?: import("./pdf_find_controller").PDFFindController | undefined;
|
|
37
|
+
findController?: import("./pdf_find_controller.js").PDFFindController | undefined;
|
|
38
38
|
/**
|
|
39
39
|
* - The scripting manager
|
|
40
40
|
* component.
|
|
41
41
|
*/
|
|
42
|
-
scriptingManager?: import("./pdf_scripting_manager").PDFScriptingManager | undefined;
|
|
42
|
+
scriptingManager?: import("./pdf_scripting_manager.js").PDFScriptingManager | undefined;
|
|
43
43
|
/**
|
|
44
44
|
* - The rendering queue object.
|
|
45
45
|
*/
|
|
@@ -143,7 +143,7 @@ export type PDFViewerOptions = {
|
|
|
143
143
|
* with user defined ones in order to improve readability in high contrast
|
|
144
144
|
* mode.
|
|
145
145
|
*/
|
|
146
|
-
pageColors?:
|
|
146
|
+
pageColors?: object | undefined;
|
|
147
147
|
/**
|
|
148
148
|
* - Enable zooming on pinch gesture.
|
|
149
149
|
* The default value is `true`.
|
|
@@ -166,7 +166,7 @@ export namespace PagesCountLimit {
|
|
|
166
166
|
let PAUSE_EAGER_PAGE_INIT: number;
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
169
|
-
* @typedef {
|
|
169
|
+
* @typedef {object} PDFViewerOptions
|
|
170
170
|
* @property {HTMLDivElement} container - The container for the viewer element.
|
|
171
171
|
* @property {HTMLDivElement} [viewer] - The viewer element.
|
|
172
172
|
* @property {EventBus} eventBus - The application event bus.
|
|
@@ -224,7 +224,7 @@ export namespace PagesCountLimit {
|
|
|
224
224
|
* @property {L10n} [l10n] - Localization service.
|
|
225
225
|
* @property {boolean} [enablePermissions] - Enables PDF document permissions,
|
|
226
226
|
* when they exist. The default value is `false`.
|
|
227
|
-
* @property {
|
|
227
|
+
* @property {object} [pageColors] - Overwrites background and foreground colors
|
|
228
228
|
* with user defined ones in order to improve readability in high contrast
|
|
229
229
|
* mode.
|
|
230
230
|
* @property {boolean} [supportsPinchToZoom] - Enable zooming on pinch gesture.
|
|
@@ -259,11 +259,11 @@ export class PDFViewer {
|
|
|
259
259
|
constructor(options: PDFViewerOptions);
|
|
260
260
|
container: HTMLDivElement;
|
|
261
261
|
viewer: Element | null;
|
|
262
|
-
eventBus: import("./event_utils").EventBus;
|
|
262
|
+
eventBus: import("./event_utils.js").EventBus;
|
|
263
263
|
linkService: import("./pdf_link_service.js").PDFLinkService;
|
|
264
264
|
downloadManager: import("./base_download_manager.js").BaseDownloadManager | null;
|
|
265
|
-
findController: import("./pdf_find_controller").PDFFindController | null;
|
|
266
|
-
_scriptingManager: import("./pdf_scripting_manager").PDFScriptingManager | null;
|
|
265
|
+
findController: import("./pdf_find_controller.js").PDFFindController | null;
|
|
266
|
+
_scriptingManager: import("./pdf_scripting_manager.js").PDFScriptingManager | null;
|
|
267
267
|
imageResourcesPath: string;
|
|
268
268
|
enablePrintAutoRotate: boolean;
|
|
269
269
|
removePageBorders: boolean | undefined;
|
|
@@ -275,7 +275,7 @@ export class PDFViewer {
|
|
|
275
275
|
enableSelectionRendering: boolean;
|
|
276
276
|
imagesRightClickMinSize: number;
|
|
277
277
|
l10n: import("./l10n.js").L10n | undefined;
|
|
278
|
-
pageColors:
|
|
278
|
+
pageColors: object | null;
|
|
279
279
|
defaultRenderingQueue: boolean;
|
|
280
280
|
renderingQueue: PDFRenderingQueue | undefined;
|
|
281
281
|
scroll: {
|
|
@@ -283,7 +283,6 @@ export class PDFViewer {
|
|
|
283
283
|
down: boolean;
|
|
284
284
|
lastX: any;
|
|
285
285
|
lastY: any;
|
|
286
|
-
_eventHandler: (evt: any) => void;
|
|
287
286
|
};
|
|
288
287
|
presentationModeState: number;
|
|
289
288
|
get printingAllowed(): boolean;
|
|
@@ -338,7 +337,8 @@ export class PDFViewer {
|
|
|
338
337
|
*/
|
|
339
338
|
get currentScale(): number;
|
|
340
339
|
/**
|
|
341
|
-
* @param val - The scale of the pages (in percent or predefined
|
|
340
|
+
* @param {string} val - The scale of the pages (in percent or predefined
|
|
341
|
+
* value).
|
|
342
342
|
*/
|
|
343
343
|
set currentScaleValue(val: string);
|
|
344
344
|
/**
|
|
@@ -360,12 +360,12 @@ export class PDFViewer {
|
|
|
360
360
|
get _layerProperties(): any;
|
|
361
361
|
getAllText(interruptSignal?: null): Promise<string | null>;
|
|
362
362
|
/**
|
|
363
|
-
* @param {PDFDocumentProxy} pdfDocument
|
|
363
|
+
* @param {PDFDocumentProxy|null} pdfDocument
|
|
364
364
|
*/
|
|
365
|
-
setDocument(pdfDocument: PDFDocumentProxy): void;
|
|
366
|
-
pdfDocument: import("../src/display/api").PDFDocumentProxy | undefined;
|
|
365
|
+
setDocument(pdfDocument: PDFDocumentProxy | null): void;
|
|
366
|
+
pdfDocument: import("../src/display/api.js").PDFDocumentProxy | null | undefined;
|
|
367
367
|
_scrollMode: any;
|
|
368
|
-
_optionalContentConfigPromise: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | null | undefined;
|
|
368
|
+
_optionalContentConfigPromise: Promise<import("../src/display/optional_content_config.js").OptionalContentConfig> | null | undefined;
|
|
369
369
|
onPagesEdited({ pagesMapper, type, hasBeenCut, pageNumbers }: {
|
|
370
370
|
pagesMapper: any;
|
|
371
371
|
type: any;
|
|
@@ -384,8 +384,8 @@ export class PDFViewer {
|
|
|
384
384
|
_location: {
|
|
385
385
|
pageNumber: any;
|
|
386
386
|
scale: any;
|
|
387
|
-
top:
|
|
388
|
-
left:
|
|
387
|
+
top: any;
|
|
388
|
+
left: any;
|
|
389
389
|
rotation: any;
|
|
390
390
|
pdfOpenParams: string;
|
|
391
391
|
} | null | undefined;
|
|
@@ -395,6 +395,13 @@ export class PDFViewer {
|
|
|
395
395
|
_previousScrollMode: any;
|
|
396
396
|
_spreadMode: any;
|
|
397
397
|
_scrollUpdate(): void;
|
|
398
|
+
/**
|
|
399
|
+
* Scroll the viewer by the given gesture deltas: like `GrabToPan` does, the
|
|
400
|
+
* content follows the gesture.
|
|
401
|
+
* @param {number} dx - Horizontal delta.
|
|
402
|
+
* @param {number} dy - Vertical delta.
|
|
403
|
+
*/
|
|
404
|
+
panBy(dx: number, dy: number): void;
|
|
398
405
|
/**
|
|
399
406
|
* @param {string} label - The page label.
|
|
400
407
|
* @returns {number|null} The page number corresponding to the page label,
|
|
@@ -402,7 +409,7 @@ export class PDFViewer {
|
|
|
402
409
|
*/
|
|
403
410
|
pageLabelToPageNumber(label: string): number | null;
|
|
404
411
|
/**
|
|
405
|
-
* @typedef {
|
|
412
|
+
* @typedef {object} ScrollPageIntoViewParameters
|
|
406
413
|
* @property {number} pageNumber - The page number.
|
|
407
414
|
* @property {Array} [destArray] - The original PDF destination array, in the
|
|
408
415
|
* format: <page-ref> </XYZ|/FitXXX> <args..>
|
|
@@ -454,7 +461,7 @@ export class PDFViewer {
|
|
|
454
461
|
get isChangingPresentationMode(): boolean;
|
|
455
462
|
get isHorizontalScrollbarEnabled(): boolean;
|
|
456
463
|
get isVerticalScrollbarEnabled(): boolean;
|
|
457
|
-
_getVisiblePages():
|
|
464
|
+
_getVisiblePages(): object;
|
|
458
465
|
cleanup(): void;
|
|
459
466
|
/**
|
|
460
467
|
* @private
|
|
@@ -513,18 +520,19 @@ export class PDFViewer {
|
|
|
513
520
|
*/
|
|
514
521
|
previousPage(): boolean;
|
|
515
522
|
/**
|
|
516
|
-
* @typedef {
|
|
523
|
+
* @typedef {object} ChangeScaleOptions
|
|
517
524
|
* @property {number} [drawingDelay]
|
|
518
525
|
* @property {number} [scaleFactor]
|
|
519
526
|
* @property {number} [steps]
|
|
520
527
|
* @property {Array} [origin] x and y coordinates of the scale
|
|
521
528
|
* transformation origin.
|
|
529
|
+
* @property {Array<number>} [pan] - Horizontal and vertical gesture deltas.
|
|
522
530
|
*/
|
|
523
531
|
/**
|
|
524
532
|
* Changes the current zoom level by the specified amount.
|
|
525
533
|
* @param {ChangeScaleOptions} [options]
|
|
526
534
|
*/
|
|
527
|
-
updateScale({ drawingDelay, scaleFactor, steps, origin }?: {
|
|
535
|
+
updateScale({ drawingDelay, scaleFactor, steps, origin, pan, }?: {
|
|
528
536
|
drawingDelay?: number | undefined;
|
|
529
537
|
scaleFactor?: number | undefined;
|
|
530
538
|
steps?: number | undefined;
|
|
@@ -533,6 +541,10 @@ export class PDFViewer {
|
|
|
533
541
|
* transformation origin.
|
|
534
542
|
*/
|
|
535
543
|
origin?: any[] | undefined;
|
|
544
|
+
/**
|
|
545
|
+
* - Horizontal and vertical gesture deltas.
|
|
546
|
+
*/
|
|
547
|
+
pan?: number[] | undefined;
|
|
536
548
|
}): void;
|
|
537
549
|
/**
|
|
538
550
|
* Increase the current zoom level one, or more, times.
|
|
@@ -547,6 +559,10 @@ export class PDFViewer {
|
|
|
547
559
|
* transformation origin.
|
|
548
560
|
*/
|
|
549
561
|
origin?: any[] | undefined;
|
|
562
|
+
/**
|
|
563
|
+
* - Horizontal and vertical gesture deltas.
|
|
564
|
+
*/
|
|
565
|
+
pan?: number[] | undefined;
|
|
550
566
|
}): void;
|
|
551
567
|
/**
|
|
552
568
|
* Decrease the current zoom level one, or more, times.
|
|
@@ -561,10 +577,14 @@ export class PDFViewer {
|
|
|
561
577
|
* transformation origin.
|
|
562
578
|
*/
|
|
563
579
|
origin?: any[] | undefined;
|
|
580
|
+
/**
|
|
581
|
+
* - Horizontal and vertical gesture deltas.
|
|
582
|
+
*/
|
|
583
|
+
pan?: number[] | undefined;
|
|
564
584
|
}): void;
|
|
565
585
|
get containerTopLeft(): number[];
|
|
566
586
|
/**
|
|
567
|
-
* @typedef {
|
|
587
|
+
* @typedef {object} AnnotationEditorModeOptions
|
|
568
588
|
* @property {number} mode - The editor mode (none, FreeText, ink, ...).
|
|
569
589
|
* @property {string|null} [editId] - ID of the existing annotation to edit.
|
|
570
590
|
* @property {boolean} [isFromKeyboard] - True if the mode change is due to a
|
|
@@ -5,11 +5,11 @@ export class RenderableView {
|
|
|
5
5
|
*/
|
|
6
6
|
renderingId: string;
|
|
7
7
|
/**
|
|
8
|
-
* @type {import("../src/display/api").RenderTask | null}
|
|
8
|
+
* @type {import("../src/display/api.js").RenderTask | null}
|
|
9
9
|
*/
|
|
10
|
-
renderTask: import("../src/display/api").RenderTask | null;
|
|
10
|
+
renderTask: import("../src/display/api.js").RenderTask | null;
|
|
11
11
|
/**
|
|
12
|
-
* @type {
|
|
12
|
+
* @type {Function | null}
|
|
13
13
|
*/
|
|
14
14
|
resume: Function | null;
|
|
15
15
|
/**
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export class Sidebar {
|
|
5
5
|
/**
|
|
6
|
-
* @typedef {
|
|
6
|
+
* @typedef {object} SidebarElements
|
|
7
7
|
* @property {HTMLElement} sidebar - The sidebar element.
|
|
8
8
|
* @property {HTMLElement} resizer - The sidebar resizer element.
|
|
9
9
|
* @property {HTMLElement} toggleButton - The button used to toggle the
|
|
@@ -52,9 +52,9 @@ export class Sidebar {
|
|
|
52
52
|
onStopResizing(): void;
|
|
53
53
|
/**
|
|
54
54
|
* Callback to be executed when the sidebar is being resized.
|
|
55
|
-
* @param {number}
|
|
55
|
+
* @param {number} _newWidth - The new width of the sidebar in pixels.
|
|
56
56
|
*/
|
|
57
|
-
onResizing(_newWidth:
|
|
57
|
+
onResizing(_newWidth: number): void;
|
|
58
58
|
/**
|
|
59
59
|
* Toggle the sidebar's visibility.
|
|
60
60
|
* @param {boolean} [visibility] - The visibility state to set.
|
|
@@ -1,23 +1,37 @@
|
|
|
1
|
-
export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
|
|
1
|
+
export type PDFPageProxy = import("../src/display/api.js").PDFPageProxy;
|
|
2
2
|
export type StructTreeLayerBuilderOptions = {
|
|
3
3
|
pdfPage: PDFPageProxy;
|
|
4
|
-
rawDims:
|
|
4
|
+
rawDims: object;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
|
-
* @typedef {
|
|
7
|
+
* @typedef {object} StructTreeLayerBuilderOptions
|
|
8
8
|
* @property {PDFPageProxy} pdfPage
|
|
9
|
-
* @property {
|
|
9
|
+
* @property {object} rawDims
|
|
10
10
|
*/
|
|
11
11
|
export class StructTreeLayerBuilder {
|
|
12
12
|
/**
|
|
13
|
-
* @param {
|
|
13
|
+
* @param {PDFPageProxy} pdfPage
|
|
14
|
+
* @param {object} rawDims
|
|
14
15
|
*/
|
|
15
|
-
constructor(pdfPage:
|
|
16
|
+
constructor(pdfPage: PDFPageProxy, rawDims: object);
|
|
16
17
|
/**
|
|
17
18
|
* @returns {Promise<void>}
|
|
18
19
|
*/
|
|
19
20
|
render(): Promise<void>;
|
|
20
|
-
|
|
21
|
+
/**
|
|
22
|
+
* @param {string} annotationId
|
|
23
|
+
* @param {object} [options]
|
|
24
|
+
* @param {boolean} [options.enableLinkOwnership]
|
|
25
|
+
* @returns {Promise<Map<string, string>|null|undefined>}
|
|
26
|
+
*/
|
|
27
|
+
getAriaAttributes(annotationId: string, { enableLinkOwnership }?: {
|
|
28
|
+
enableLinkOwnership?: boolean | undefined;
|
|
29
|
+
}): Promise<Map<string, string> | null | undefined>;
|
|
30
|
+
/**
|
|
31
|
+
* Get the ids of annotations owned by the structure tree.
|
|
32
|
+
* @returns {Promise<Set<string>|null>}
|
|
33
|
+
*/
|
|
34
|
+
getAnnotationIds(): Promise<Set<string> | null>;
|
|
21
35
|
hide(): void;
|
|
22
36
|
show(): void;
|
|
23
37
|
updateTextLayer(): void;
|
|
@@ -9,7 +9,6 @@ export class TextAccessibilityManager {
|
|
|
9
9
|
/**
|
|
10
10
|
* Compare the positions of two elements, it must correspond to
|
|
11
11
|
* the visual ordering.
|
|
12
|
-
*
|
|
13
12
|
* @param {HTMLElement} e1
|
|
14
13
|
* @param {HTMLElement} e2
|
|
15
14
|
* @returns {number}
|
|
@@ -36,9 +35,12 @@ export class TextAccessibilityManager {
|
|
|
36
35
|
addPointerInTextLayer(element: HTMLElement, isRemovable: boolean): string | null;
|
|
37
36
|
/**
|
|
38
37
|
* Move a div in the DOM in order to respect the visual order.
|
|
38
|
+
* @param {HTMLElement} container
|
|
39
39
|
* @param {HTMLDivElement} element
|
|
40
|
+
* @param {HTMLElement} contentElement
|
|
41
|
+
* @param {boolean} isRemovable
|
|
40
42
|
* @returns {string|null} The id in the struct tree if any.
|
|
41
43
|
*/
|
|
42
|
-
moveElementInDOM(container:
|
|
44
|
+
moveElementInDOM(container: HTMLElement, element: HTMLDivElement, contentElement: HTMLElement, isRemovable: boolean): string | null;
|
|
43
45
|
#private;
|
|
44
46
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type EventBus = import("./event_utils").EventBus;
|
|
2
|
-
export type PDFFindController = import("./pdf_find_controller").PDFFindController;
|
|
1
|
+
export type EventBus = import("./event_utils.js").EventBus;
|
|
2
|
+
export type PDFFindController = import("./pdf_find_controller.js").PDFFindController;
|
|
3
3
|
export type TextHighlighterOptions = {
|
|
4
4
|
findController: PDFFindController;
|
|
5
5
|
/**
|
|
@@ -11,10 +11,10 @@ export type TextHighlighterOptions = {
|
|
|
11
11
|
*/
|
|
12
12
|
pageIndex: number;
|
|
13
13
|
};
|
|
14
|
-
/** @typedef {import("./event_utils").EventBus} EventBus */
|
|
15
|
-
/** @typedef {import("./pdf_find_controller").PDFFindController} PDFFindController */
|
|
14
|
+
/** @typedef {import("./event_utils.js").EventBus} EventBus */
|
|
15
|
+
/** @typedef {import("./pdf_find_controller.js").PDFFindController} PDFFindController */
|
|
16
16
|
/**
|
|
17
|
-
* @typedef {
|
|
17
|
+
* @typedef {object} TextHighlighterOptions
|
|
18
18
|
* @property {PDFFindController} findController
|
|
19
19
|
* @property {EventBus} eventBus - The application event bus.
|
|
20
20
|
* @property {number} pageIndex - The page index.
|
|
@@ -28,9 +28,9 @@ export class TextHighlighter {
|
|
|
28
28
|
* @param {TextHighlighterOptions} options
|
|
29
29
|
*/
|
|
30
30
|
constructor({ findController, eventBus, pageIndex }: TextHighlighterOptions);
|
|
31
|
-
findController: import("./pdf_find_controller").PDFFindController;
|
|
31
|
+
findController: import("./pdf_find_controller.js").PDFFindController;
|
|
32
32
|
matches: any[];
|
|
33
|
-
eventBus: import("./event_utils").EventBus;
|
|
33
|
+
eventBus: import("./event_utils.js").EventBus;
|
|
34
34
|
pageIdx: number;
|
|
35
35
|
textDivs: Node[] | null;
|
|
36
36
|
textContentItemsStr: string[] | null;
|
|
@@ -40,7 +40,6 @@ export class TextHighlighter {
|
|
|
40
40
|
* The arrays should be of equal length and the array element at each index
|
|
41
41
|
* should correspond to the other. e.g.
|
|
42
42
|
* `items[0] = "<span>Item 0</span>" and texts[0] = "Item 0";
|
|
43
|
-
*
|
|
44
43
|
* @param {Array<Node>} divs
|
|
45
44
|
* @param {Array<string>} texts
|
|
46
45
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
|
|
2
|
-
export type PageViewport = import("../src/display/page_viewport").PageViewport;
|
|
1
|
+
export type PDFPageProxy = import("../src/display/api.js").PDFPageProxy;
|
|
2
|
+
export type PageViewport = import("../src/display/page_viewport.js").PageViewport;
|
|
3
3
|
export type TextLayerImages = import("../src/display/text_layer_images.js").TextLayerImages;
|
|
4
|
-
export type TextHighlighter = import("./text_highlighter").TextHighlighter;
|
|
4
|
+
export type TextHighlighter = import("./text_highlighter.js").TextHighlighter;
|
|
5
5
|
export type TextAccessibilityManager = import("./text_accessibility.js").TextAccessibilityManager;
|
|
6
6
|
export type TextLayerBuilderOptions = {
|
|
7
7
|
pdfPage: PDFPageProxy;
|
|
@@ -9,7 +9,7 @@ export type TextLayerBuilderOptions = {
|
|
|
9
9
|
* - Optional object that will handle
|
|
10
10
|
* highlighting text from the find controller.
|
|
11
11
|
*/
|
|
12
|
-
highlighter?: import("./text_highlighter").TextHighlighter | undefined;
|
|
12
|
+
highlighter?: import("./text_highlighter.js").TextHighlighter | undefined;
|
|
13
13
|
accessibilityManager?: import("./text_accessibility.js").TextAccessibilityManager | undefined;
|
|
14
14
|
enablePermissions?: boolean | undefined;
|
|
15
15
|
onAppend?: Function | undefined;
|
|
@@ -18,23 +18,23 @@ export type TextLayerBuilderOptions = {
|
|
|
18
18
|
export type TextLayerBuilderRenderOptions = {
|
|
19
19
|
viewport: PageViewport;
|
|
20
20
|
images: TextLayerImages;
|
|
21
|
-
textContentParams?:
|
|
21
|
+
textContentParams?: object | undefined;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
|
-
* @typedef {
|
|
24
|
+
* @typedef {object} TextLayerBuilderOptions
|
|
25
25
|
* @property {PDFPageProxy} pdfPage
|
|
26
26
|
* @property {TextHighlighter} [highlighter] - Optional object that will handle
|
|
27
27
|
* highlighting text from the find controller.
|
|
28
28
|
* @property {TextAccessibilityManager} [accessibilityManager]
|
|
29
29
|
* @property {boolean} [enablePermissions]
|
|
30
|
-
* @property {
|
|
30
|
+
* @property {Function} [onAppend]
|
|
31
31
|
* @property {AbortSignal} [abortSignal]
|
|
32
32
|
*/
|
|
33
33
|
/**
|
|
34
|
-
* @typedef {
|
|
34
|
+
* @typedef {object} TextLayerBuilderRenderOptions
|
|
35
35
|
* @property {PageViewport} viewport
|
|
36
36
|
* @property {TextLayerImages} images
|
|
37
|
-
* @property {
|
|
37
|
+
* @property {object} [textContentParams]
|
|
38
38
|
*/
|
|
39
39
|
/**
|
|
40
40
|
* The text layer builder provides text selection functionality for the PDF.
|
|
@@ -50,8 +50,8 @@ export class TextLayerBuilder {
|
|
|
50
50
|
* @param {TextLayerBuilderOptions} options
|
|
51
51
|
*/
|
|
52
52
|
constructor({ pdfPage, highlighter, accessibilityManager, enablePermissions, onAppend, abortSignal, }: TextLayerBuilderOptions);
|
|
53
|
-
pdfPage: import("../src/display/api").PDFPageProxy;
|
|
54
|
-
highlighter: import("./text_highlighter").TextHighlighter;
|
|
53
|
+
pdfPage: import("../src/display/api.js").PDFPageProxy;
|
|
54
|
+
highlighter: import("./text_highlighter.js").TextHighlighter;
|
|
55
55
|
accessibilityManager: import("./text_accessibility.js").TextAccessibilityManager;
|
|
56
56
|
div: HTMLDivElement;
|
|
57
57
|
/**
|
|
@@ -48,9 +48,9 @@ export const animationStarted: Promise<any>;
|
|
|
48
48
|
/**
|
|
49
49
|
* Converts API PageLayout values to the format used by `BaseViewer`.
|
|
50
50
|
* @param {string} layout - The API PageLayout value.
|
|
51
|
-
* @returns {
|
|
51
|
+
* @returns {object}
|
|
52
52
|
*/
|
|
53
|
-
export function apiPageLayoutToViewerModes(layout: string):
|
|
53
|
+
export function apiPageLayoutToViewerModes(layout: string): object;
|
|
54
54
|
/**
|
|
55
55
|
* Converts API PageMode values to the format used by `PDFSidebar`.
|
|
56
56
|
* NOTE: There's also a "FullScreen" parameter which is not possible to support,
|
|
@@ -72,7 +72,6 @@ export function approximateFraction(x: number): any[];
|
|
|
72
72
|
export const AutoPrintRegExp: RegExp;
|
|
73
73
|
/**
|
|
74
74
|
* Helper function for getVisibleElements.
|
|
75
|
-
*
|
|
76
75
|
* @param {number} index - initial guess at the first visible element
|
|
77
76
|
* @param {Array} views - array of pages, into which `index` is an index
|
|
78
77
|
* @param {number} top - the top of the scroll pane
|
|
@@ -87,7 +86,6 @@ export function backtrackBeforeAllVisibleElements(index: number, views: any[], t
|
|
|
87
86
|
* passes a given condition. The items are expected to be sorted in the sense
|
|
88
87
|
* that if the condition is true for one item in the array, then it is also true
|
|
89
88
|
* for all following items.
|
|
90
|
-
*
|
|
91
89
|
* @returns {number} Index of the first array element to pass the test,
|
|
92
90
|
* or |items.length| if no such element exists.
|
|
93
91
|
*/
|
|
@@ -112,18 +110,17 @@ export function floorToDivide(x: number, div: number): number;
|
|
|
112
110
|
*
|
|
113
111
|
* Recursively search for the truly active or focused element in case there are
|
|
114
112
|
* shadow DOMs.
|
|
115
|
-
*
|
|
116
113
|
* @returns {Element} the truly active or focused element.
|
|
117
114
|
*/
|
|
118
115
|
export function getActiveOrFocusedElement(): Element;
|
|
119
116
|
/**
|
|
120
|
-
* @typedef {
|
|
117
|
+
* @typedef {object} GetPageSizeInchesParameters
|
|
121
118
|
* @property {number[]} view
|
|
122
119
|
* @property {number} userUnit
|
|
123
120
|
* @property {number} rotate
|
|
124
121
|
*/
|
|
125
122
|
/**
|
|
126
|
-
* @typedef {
|
|
123
|
+
* @typedef {object} PageSize
|
|
127
124
|
* @property {number} width - In inches.
|
|
128
125
|
* @property {number} height - In inches.
|
|
129
126
|
*/
|
|
@@ -134,7 +131,7 @@ export function getActiveOrFocusedElement(): Element;
|
|
|
134
131
|
*/
|
|
135
132
|
export function getPageSizeInches({ view, userUnit, rotate }: GetPageSizeInchesParameters): PageSize;
|
|
136
133
|
/**
|
|
137
|
-
* @typedef {
|
|
134
|
+
* @typedef {object} GetVisibleElementsParameters
|
|
138
135
|
* @property {HTMLElement} scrollEl - A container that can possibly scroll.
|
|
139
136
|
* @property {Array} views - Objects with a `div` property that contains an
|
|
140
137
|
* HTMLElement, which should all be descendants of `scrollEl` satisfying the
|
|
@@ -163,11 +160,10 @@ export function getPageSizeInches({ view, userUnit, rotate }: GetPageSizeInchesP
|
|
|
163
160
|
* question. For pages, that ends up being equivalent to the bounding box of the
|
|
164
161
|
* rendering canvas. Earlier and later refer to index in `views`, not page
|
|
165
162
|
* layout.)
|
|
166
|
-
*
|
|
167
163
|
* @param {GetVisibleElementsParameters} params
|
|
168
|
-
* @returns {
|
|
164
|
+
* @returns {object} `{ first, last, views: [{ id, x, y, view, percent }] }`
|
|
169
165
|
*/
|
|
170
|
-
export function getVisibleElements({ scrollEl, views, sortByVisibility, horizontal, rtl, }: GetVisibleElementsParameters):
|
|
166
|
+
export function getVisibleElements({ scrollEl, views, sortByVisibility, horizontal, rtl, }: GetVisibleElementsParameters): object;
|
|
171
167
|
export function isPortraitOrientation(size: any): boolean;
|
|
172
168
|
export function isValidRotation(angle: any): boolean;
|
|
173
169
|
export function isValidScrollMode(mode: any): boolean;
|
|
@@ -208,7 +204,7 @@ export const SCROLLBAR_PADDING: 40;
|
|
|
208
204
|
/**
|
|
209
205
|
* Scrolls specified element into view of its parent.
|
|
210
206
|
* @param {HTMLElement} element - The element to be visible.
|
|
211
|
-
* @param {
|
|
207
|
+
* @param {object} [spot] - An object with optional top and left properties,
|
|
212
208
|
* specifying the offset from the top left edge.
|
|
213
209
|
* @param {number} [spot.left]
|
|
214
210
|
* @param {number} [spot.top]
|
|
@@ -261,5 +257,4 @@ export function watchScroll(viewAreaElement: any, callback: any, abortSignal?: u
|
|
|
261
257
|
down: boolean;
|
|
262
258
|
lastX: any;
|
|
263
259
|
lastY: any;
|
|
264
|
-
_eventHandler: (evt: any) => void;
|
|
265
260
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
|
|
2
|
-
export type AnnotationStorage = import("../src/display/annotation_storage").AnnotationStorage;
|
|
3
|
-
export type PageViewport = import("../src/display/page_viewport").PageViewport;
|
|
1
|
+
export type PDFPageProxy = import("../src/display/api.js").PDFPageProxy;
|
|
2
|
+
export type AnnotationStorage = import("../src/display/annotation_storage.js").AnnotationStorage;
|
|
3
|
+
export type PageViewport = import("../src/display/page_viewport.js").PageViewport;
|
|
4
4
|
export type PDFLinkService = import("./pdf_link_service.js").PDFLinkService;
|
|
5
5
|
export type XfaLayerBuilderOptions = {
|
|
6
6
|
pdfPage: PDFPageProxy;
|
|
7
|
-
annotationStorage?: import("../src/display/annotation_storage").AnnotationStorage | undefined;
|
|
7
|
+
annotationStorage?: import("../src/display/annotation_storage.js").AnnotationStorage | undefined;
|
|
8
8
|
linkService: PDFLinkService;
|
|
9
|
-
xfaHtml?:
|
|
9
|
+
xfaHtml?: object | undefined;
|
|
10
10
|
};
|
|
11
11
|
export type XfaLayerBuilderRenderOptions = {
|
|
12
12
|
viewport: PageViewport;
|
|
@@ -16,14 +16,14 @@ export type XfaLayerBuilderRenderOptions = {
|
|
|
16
16
|
intent?: string | undefined;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
|
-
* @typedef {
|
|
19
|
+
* @typedef {object} XfaLayerBuilderOptions
|
|
20
20
|
* @property {PDFPageProxy} pdfPage
|
|
21
21
|
* @property {AnnotationStorage} [annotationStorage]
|
|
22
22
|
* @property {PDFLinkService} linkService
|
|
23
|
-
* @property {
|
|
23
|
+
* @property {object} [xfaHtml]
|
|
24
24
|
*/
|
|
25
25
|
/**
|
|
26
|
-
* @typedef {
|
|
26
|
+
* @typedef {object} XfaLayerBuilderRenderOptions
|
|
27
27
|
* @property {PageViewport} viewport
|
|
28
28
|
* @property {string} [intent] - The default value is "display".
|
|
29
29
|
*/
|
|
@@ -33,17 +33,17 @@ export class XfaLayerBuilder {
|
|
|
33
33
|
*/
|
|
34
34
|
constructor({ pdfPage, annotationStorage, linkService, xfaHtml, }: XfaLayerBuilderOptions);
|
|
35
35
|
div: null;
|
|
36
|
-
pdfPage: import("../src/display/api").PDFPageProxy;
|
|
37
|
-
annotationStorage: import("../src/display/annotation_storage").AnnotationStorage;
|
|
36
|
+
pdfPage: import("../src/display/api.js").PDFPageProxy;
|
|
37
|
+
annotationStorage: import("../src/display/annotation_storage.js").AnnotationStorage;
|
|
38
38
|
linkService: import("./pdf_link_service.js").PDFLinkService;
|
|
39
|
-
xfaHtml:
|
|
39
|
+
xfaHtml: object;
|
|
40
40
|
/**
|
|
41
41
|
* @param {XfaLayerBuilderRenderOptions} viewport
|
|
42
|
-
* @returns {Promise<
|
|
42
|
+
* @returns {Promise<object | void>} A promise that is resolved when rendering
|
|
43
43
|
* of the XFA layer is complete. The first rendering will return an object
|
|
44
44
|
* with a `textDivs` property that can be used with the TextHighlighter.
|
|
45
45
|
*/
|
|
46
|
-
render({ viewport, intent }: XfaLayerBuilderRenderOptions): Promise<
|
|
46
|
+
render({ viewport, intent }: XfaLayerBuilderRenderOptions): Promise<object | void>;
|
|
47
47
|
cancel(): void;
|
|
48
48
|
hide(): void;
|
|
49
49
|
#private;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdfjs-serverless",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
5
|
-
"packageManager": "pnpm@
|
|
6
|
-
"description": "PDF.js redistributed as a
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"packageManager": "pnpm@12.14.0",
|
|
6
|
+
"description": "PDF.js redistributed as a bundle for edge and serverless runtimes",
|
|
7
7
|
"author": "Johann Schopplich <hello@johannschopplich.com>",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"homepage": "https://github.com/johannschopplich/pdfjs-serverless#readme",
|
|
@@ -26,11 +26,23 @@
|
|
|
26
26
|
"text-extraction",
|
|
27
27
|
"workers"
|
|
28
28
|
],
|
|
29
|
-
"sideEffects":
|
|
29
|
+
"sideEffects": [
|
|
30
|
+
"./dist/image-decoders.mjs"
|
|
31
|
+
],
|
|
32
|
+
"imports": {
|
|
33
|
+
"#pdfjs-decoders": {
|
|
34
|
+
"workerd": "./dist/pdfjs-decoders-workerd.mjs",
|
|
35
|
+
"default": "./dist/pdfjs-decoders.mjs"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
30
38
|
"exports": {
|
|
31
39
|
".": {
|
|
32
40
|
"types": "./dist/index.d.mts",
|
|
33
41
|
"default": "./dist/index.mjs"
|
|
42
|
+
},
|
|
43
|
+
"./image-decoders": {
|
|
44
|
+
"types": "./dist/image-decoders.d.mts",
|
|
45
|
+
"default": "./dist/image-decoders.mjs"
|
|
34
46
|
}
|
|
35
47
|
},
|
|
36
48
|
"types": "./dist/index.d.mts",
|
|
@@ -38,26 +50,25 @@
|
|
|
38
50
|
"dist"
|
|
39
51
|
],
|
|
40
52
|
"engines": {
|
|
41
|
-
"node": ">=
|
|
53
|
+
"node": ">=24"
|
|
42
54
|
},
|
|
43
55
|
"scripts": {
|
|
44
|
-
"build
|
|
45
|
-
"build:post": "cp -R node_modules/pdfjs-dist/types dist",
|
|
46
|
-
"build": "pnpm run build:pre && pnpm run build:post",
|
|
56
|
+
"build": "rolldown --config rolldown.config.ts && mkdir -p dist/licenses && cp node_modules/pdfjs-dist/LICENSE dist/licenses/LICENSE_PDFJS && cp node_modules/pdfjs-dist/wasm/LICENSE_*JBIG2 node_modules/pdfjs-dist/wasm/LICENSE_*OPENJPEG dist/licenses",
|
|
47
57
|
"test": "vitest",
|
|
58
|
+
"test:types:dist": "tsc -p test/types/tsconfig.json",
|
|
48
59
|
"lint": "eslint .",
|
|
49
60
|
"lint:fix": "eslint . --fix",
|
|
50
61
|
"release": "bumpp"
|
|
51
62
|
},
|
|
52
63
|
"devDependencies": {
|
|
53
|
-
"@antfu/eslint-config": "^9.
|
|
54
|
-
"@cloudflare/vitest-
|
|
55
|
-
"@types/node": "^26.
|
|
56
|
-
"bumpp": "^12.
|
|
57
|
-
"eslint": "^10.
|
|
58
|
-
"pdfjs-dist": "~6.
|
|
59
|
-
"rolldown": "^1.2.
|
|
64
|
+
"@antfu/eslint-config": "^9.5.1",
|
|
65
|
+
"@cloudflare/vitest-plugin": "^1.4.3",
|
|
66
|
+
"@types/node": "^26.6.5",
|
|
67
|
+
"bumpp": "^12.3.0",
|
|
68
|
+
"eslint": "^10.12.0",
|
|
69
|
+
"pdfjs-dist": "~6.4.299",
|
|
70
|
+
"rolldown": "^1.2.14",
|
|
60
71
|
"typescript": "^6.0.3",
|
|
61
|
-
"vitest": "^
|
|
72
|
+
"vitest": "^5.0.4"
|
|
62
73
|
}
|
|
63
74
|
}
|