unpdf 1.8.0 → 1.9.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.cjs +1 -1
- package/dist/index.d.cts +15 -15
- package/dist/index.d.mts +15 -15
- package/dist/index.mjs +1 -1
- package/dist/pdfjs.mjs +37 -37
- 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 +9 -20
- 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 +2 -0
- 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 +7 -12
- package/dist/types/src/display/xfa_text.d.ts +2 -5
- package/dist/types/src/pdf.d.ts +2 -1
- 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 +5 -3
- package/dist/types/web/annotation_layer_builder.d.ts +8 -12
- 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 +5 -6
- package/dist/types/web/pdf_find_utils.d.ts +8 -14
- package/dist/types/web/pdf_history.d.ts +1 -1
- package/dist/types/web/pdf_link_service.d.ts +5 -7
- package/dist/types/web/pdf_page_view.d.ts +3 -3
- package/dist/types/web/pdf_rendering_queue.d.ts +4 -5
- package/dist/types/web/pdf_scripting_manager.d.ts +4 -4
- package/dist/types/web/pdf_thumbnail_view.d.ts +2 -2
- package/dist/types/web/pdf_thumbnail_viewer.d.ts +14 -15
- package/dist/types/web/pdf_viewer.d.ts +36 -16
- package/dist/types/web/renderable_view.d.ts +1 -1
- package/dist/types/web/sidebar.d.ts +3 -3
- package/dist/types/web/struct_tree_layer_builder.d.ts +20 -6
- package/dist/types/web/text_accessibility.d.ts +4 -2
- package/dist/types/web/text_highlighter.d.ts +1 -2
- package/dist/types/web/text_layer_builder.d.ts +5 -5
- package/dist/types/web/ui_utils.d.ts +8 -13
- package/dist/types/web/xfa_layer_builder.d.ts +7 -7
- package/package.json +11 -11
|
@@ -10,7 +10,6 @@ export class PagesMapper {
|
|
|
10
10
|
get pagesNumber(): number;
|
|
11
11
|
/**
|
|
12
12
|
* Move a set of pages to a new position.
|
|
13
|
-
*
|
|
14
13
|
* @param {Set<number>} selectedPages - Page numbers being moved (1-indexed).
|
|
15
14
|
* @param {number[]} pagesToMove - Ordered list of page numbers to move.
|
|
16
15
|
* @param {number} index - Zero-based insertion index in the page-number list.
|
|
@@ -43,10 +42,17 @@ export class PagesMapper {
|
|
|
43
42
|
/**
|
|
44
43
|
* Gets the current page mapping suitable for saving.
|
|
45
44
|
* @param {Map<number, Array<number>>} [idToPageNumber]
|
|
46
|
-
* @
|
|
45
|
+
* @param {Int32Array} [copyLevels]
|
|
46
|
+
* @returns {{pageInfos: Array<object>, copyLevels: Int32Array | null}}
|
|
47
47
|
*/
|
|
48
|
-
getPageMappingForSaving(idToPageNumber?: Map<number, Array<number
|
|
49
|
-
|
|
48
|
+
getPageMappingForSaving(idToPageNumber?: Map<number, Array<number>>, copyLevels?: Int32Array): {
|
|
49
|
+
pageInfos: Array<object>;
|
|
50
|
+
copyLevels: Int32Array | null;
|
|
51
|
+
};
|
|
52
|
+
extractPages(extractedPageNumbers: any): {
|
|
53
|
+
pageInfos: Array<object>;
|
|
54
|
+
copyLevels: Int32Array | null;
|
|
55
|
+
};
|
|
50
56
|
/**
|
|
51
57
|
* Gets the previous page number for a given page number.
|
|
52
58
|
* Negative values indicate a copied page (the absolute value is the source).
|
|
@@ -51,12 +51,13 @@ declare class RadialAxialShadingPattern extends BaseShadingPattern {
|
|
|
51
51
|
_p1: any;
|
|
52
52
|
_r0: any;
|
|
53
53
|
_r1: any;
|
|
54
|
-
matrix: any;
|
|
55
54
|
isOriginBased(): boolean;
|
|
56
55
|
isRadial(): boolean;
|
|
57
56
|
areConic(): boolean;
|
|
58
57
|
_createGradient(ctx: any, transform?: null): any;
|
|
59
58
|
_createReversedGradient(ctx: any, transform?: null): any;
|
|
59
|
+
/** Rasterize a shading within its device-space bounding box. */
|
|
60
|
+
_createRasterPattern(ctx: any, owner: any, inverse: any, bbox: any, transform: any, transferMaps: any): any;
|
|
60
61
|
getPattern(ctx: any, owner: any, inverse: any, pathType: any): any;
|
|
61
62
|
}
|
|
62
63
|
declare class MeshShadingPattern extends BaseShadingPattern {
|
|
@@ -67,8 +68,7 @@ declare class MeshShadingPattern extends BaseShadingPattern {
|
|
|
67
68
|
_bounds: any;
|
|
68
69
|
_bbox: any;
|
|
69
70
|
_background: any;
|
|
70
|
-
|
|
71
|
-
_createMeshCanvas(combinedScale: any, backgroundColor: any, canvasFactory: any): {
|
|
71
|
+
_createMeshCanvas(combinedScale: any, backgroundColor: any, canvasFactory: any, transferMaps?: null): {
|
|
72
72
|
canvas: any;
|
|
73
73
|
offsetX: number;
|
|
74
74
|
offsetY: number;
|
|
@@ -81,6 +81,7 @@ declare class DummyShadingPattern extends BaseShadingPattern {
|
|
|
81
81
|
getPattern(): string;
|
|
82
82
|
}
|
|
83
83
|
declare class BaseShadingPattern {
|
|
84
|
+
matrix: null;
|
|
84
85
|
isModifyingCurrentTransform(): boolean;
|
|
85
86
|
getPattern(): void;
|
|
86
87
|
}
|
|
@@ -11,9 +11,8 @@ export class PDFObjects {
|
|
|
11
11
|
* If called *with* a callback, the callback is called with the data of the
|
|
12
12
|
* object once the object is resolved. That means, if you call this method
|
|
13
13
|
* and the object is already resolved, the callback gets called right away.
|
|
14
|
-
*
|
|
15
14
|
* @param {string} objId
|
|
16
|
-
* @param {
|
|
15
|
+
* @param {Function} [callback]
|
|
17
16
|
* @returns {any}
|
|
18
17
|
*/
|
|
19
18
|
get(objId: string, callback?: Function): any;
|
|
@@ -29,7 +28,6 @@ export class PDFObjects {
|
|
|
29
28
|
delete(objId: string): boolean;
|
|
30
29
|
/**
|
|
31
30
|
* Resolves the object `objId` with optional `data`.
|
|
32
|
-
*
|
|
33
31
|
* @param {string} objId
|
|
34
32
|
* @param {any} [data]
|
|
35
33
|
*/
|
|
@@ -36,6 +36,7 @@ export type TextLayerUpdateParameters = {
|
|
|
36
36
|
*/
|
|
37
37
|
onBefore?: Function | undefined;
|
|
38
38
|
};
|
|
39
|
+
export const DEFAULT_FONT_SIZE: 30;
|
|
39
40
|
export class TextLayer {
|
|
40
41
|
static #ascentCache: Map<any, any>;
|
|
41
42
|
static #canvasContexts: Map<any, any>;
|
|
@@ -49,6 +50,7 @@ export class TextLayer {
|
|
|
49
50
|
*/
|
|
50
51
|
static cleanup(): undefined;
|
|
51
52
|
static #getCtx(lang?: null): any;
|
|
53
|
+
static #quantizeFontSize(size: any): number;
|
|
52
54
|
static #ensureCtxFont(ctx: any, size: any, family: any): void;
|
|
53
55
|
/**
|
|
54
56
|
* Compute the minimum font size enforced by the browser.
|
|
@@ -1,18 +1,55 @@
|
|
|
1
|
+
export type TouchManagerOptions = {
|
|
2
|
+
container: HTMLElement | Window;
|
|
3
|
+
isPinchingDisabled?: Function | undefined;
|
|
4
|
+
isPinchingStopped?: Function | undefined;
|
|
5
|
+
onPinchStart?: Function | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* - Called with the previous client
|
|
8
|
+
* midpoint, the previous/current screen distance, and the client midpoint
|
|
9
|
+
* delta.
|
|
10
|
+
*/
|
|
11
|
+
onPinching?: Function | undefined;
|
|
12
|
+
onPinchEnd?: Function | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* - Called with the client midpoint delta
|
|
15
|
+
* when no scale update is emitted.
|
|
16
|
+
*/
|
|
17
|
+
onPanning?: Function | undefined;
|
|
18
|
+
signal: AbortSignal;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {object} TouchManagerOptions
|
|
22
|
+
* @property {HTMLElement | Window} container
|
|
23
|
+
* @property {Function} [isPinchingDisabled]
|
|
24
|
+
* @property {Function} [isPinchingStopped]
|
|
25
|
+
* @property {Function} [onPinchStart]
|
|
26
|
+
* @property {Function} [onPinching] - Called with the previous client
|
|
27
|
+
* midpoint, the previous/current screen distance, and the client midpoint
|
|
28
|
+
* delta.
|
|
29
|
+
* @property {Function} [onPinchEnd]
|
|
30
|
+
* @property {Function} [onPanning] - Called with the client midpoint delta
|
|
31
|
+
* when no scale update is emitted.
|
|
32
|
+
* @property {AbortSignal} signal
|
|
33
|
+
*/
|
|
1
34
|
export class TouchManager {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
onPinchStart?: null | undefined;
|
|
7
|
-
onPinching?: null | undefined;
|
|
8
|
-
onPinchEnd?: null | undefined;
|
|
9
|
-
signal: any;
|
|
10
|
-
});
|
|
35
|
+
/**
|
|
36
|
+
* @param {TouchManagerOptions} options
|
|
37
|
+
*/
|
|
38
|
+
constructor({ container, isPinchingDisabled, isPinchingStopped, onPinchStart, onPinching, onPinchEnd, onPanning, signal, }: TouchManagerOptions);
|
|
11
39
|
/**
|
|
12
40
|
* NOTE: Don't shadow this value since `devicePixelRatio` may change if the
|
|
13
41
|
* window resolution changes, e.g. if the viewer is moved to another monitor.
|
|
14
42
|
*/
|
|
15
43
|
get MIN_TOUCH_DISTANCE_TO_PINCH(): number;
|
|
44
|
+
/**
|
|
45
|
+
* Once pinching, the span must change by at least 4 device pixels to update
|
|
46
|
+
* the scale: below that it's contact jitter (a moving finger is reported
|
|
47
|
+
* with a slight lag and its position is quantized), not an intentional
|
|
48
|
+
* pinch, hence a two-finger pan doesn't make the zoom drift.
|
|
49
|
+
*
|
|
50
|
+
* NOTE: Don't shadow this value since `devicePixelRatio` may change.
|
|
51
|
+
*/
|
|
52
|
+
get MIN_TOUCH_DISTANCE_TO_SCALE(): number;
|
|
16
53
|
destroy(): void;
|
|
17
54
|
#private;
|
|
18
55
|
}
|
|
@@ -2,7 +2,7 @@ export class GlobalWorkerOptions {
|
|
|
2
2
|
static #port: null;
|
|
3
3
|
static #src: string;
|
|
4
4
|
/**
|
|
5
|
-
* @param {Worker | null}
|
|
5
|
+
* @param {Worker | null} val - Defines global port for worker process.
|
|
6
6
|
* Overrides the `workerSrc` option.
|
|
7
7
|
*/
|
|
8
8
|
static set workerPort(val: Worker | null);
|
|
@@ -11,7 +11,7 @@ export class GlobalWorkerOptions {
|
|
|
11
11
|
*/
|
|
12
12
|
static get workerPort(): Worker | null;
|
|
13
13
|
/**
|
|
14
|
-
* @param {string}
|
|
14
|
+
* @param {string} val - A string containing the path and filename of
|
|
15
15
|
* the worker file.
|
|
16
16
|
*
|
|
17
17
|
* NOTE: The `workerSrc` option should always be set, in order to prevent
|
|
@@ -3,7 +3,7 @@ export type PDFLinkService = import("../../web/pdf_link_service.js").PDFLinkServ
|
|
|
3
3
|
export type XfaLayerParameters = {
|
|
4
4
|
viewport: PageViewport;
|
|
5
5
|
div: HTMLDivElement;
|
|
6
|
-
xfaHtml:
|
|
6
|
+
xfaHtml: object;
|
|
7
7
|
annotationStorage?: import("./annotation_storage.js").AnnotationStorage | undefined;
|
|
8
8
|
linkService: PDFLinkService;
|
|
9
9
|
/**
|
|
@@ -11,16 +11,12 @@ export type XfaLayerParameters = {
|
|
|
11
11
|
*/
|
|
12
12
|
intent?: string | undefined;
|
|
13
13
|
};
|
|
14
|
-
/**
|
|
15
|
-
* @typedef {Object} XfaLayerParameters
|
|
16
|
-
* @property {PageViewport} viewport
|
|
17
|
-
* @property {HTMLDivElement} div
|
|
18
|
-
* @property {Object} xfaHtml
|
|
19
|
-
* @property {AnnotationStorage} [annotationStorage]
|
|
20
|
-
* @property {PDFLinkService} linkService
|
|
21
|
-
* @property {string} [intent] - (default value is 'display').
|
|
22
|
-
*/
|
|
23
14
|
export class XfaLayer {
|
|
15
|
+
static get _allowedHtmlElements(): any;
|
|
16
|
+
static get _allowedSvgElements(): any;
|
|
17
|
+
static get _allowedRichTextElements(): any;
|
|
18
|
+
static get _allowedRichTextAttributes(): any;
|
|
19
|
+
static get _allowedRichTextStyles(): any;
|
|
24
20
|
static setupStorage(html: any, id: any, element: any, storage: any, intent: any): void;
|
|
25
21
|
static setAttributes({ html, element, storage, intent, linkService }: {
|
|
26
22
|
html: any;
|
|
@@ -29,9 +25,9 @@ export class XfaLayer {
|
|
|
29
25
|
intent: any;
|
|
30
26
|
linkService: any;
|
|
31
27
|
}): void;
|
|
28
|
+
static #createElement(name: any, xmlns: any, intent: any): any;
|
|
32
29
|
/**
|
|
33
30
|
* Render the XFA layer.
|
|
34
|
-
*
|
|
35
31
|
* @param {XfaLayerParameters} parameters
|
|
36
32
|
*/
|
|
37
33
|
static render(parameters: XfaLayerParameters): {
|
|
@@ -39,7 +35,6 @@ export class XfaLayer {
|
|
|
39
35
|
};
|
|
40
36
|
/**
|
|
41
37
|
* Update the XFA layer.
|
|
42
|
-
*
|
|
43
38
|
* @param {XfaLayerParameters} parameters
|
|
44
39
|
*/
|
|
45
40
|
static update(parameters: XfaLayerParameters): void;
|
|
@@ -5,15 +5,12 @@ export class XfaText {
|
|
|
5
5
|
* Walk an XFA tree and create an array of text nodes that is compatible
|
|
6
6
|
* with a regular PDFs TextContent. Currently, only TextItem.str is supported,
|
|
7
7
|
* all other fields and styles haven't been implemented.
|
|
8
|
-
*
|
|
9
|
-
* @param {Object} xfa - An XFA fake DOM object.
|
|
10
|
-
*
|
|
8
|
+
* @param {object} xfa - An XFA fake DOM object.
|
|
11
9
|
* @returns {TextContent}
|
|
12
10
|
*/
|
|
13
|
-
static textContent(xfa:
|
|
11
|
+
static textContent(xfa: object): TextContent;
|
|
14
12
|
/**
|
|
15
13
|
* @param {string} name - DOM node name. (lower case)
|
|
16
|
-
*
|
|
17
14
|
* @returns {boolean} true if the DOM node should have a corresponding text
|
|
18
15
|
* node.
|
|
19
16
|
*/
|
package/dist/types/src/pdf.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ import { isValidExplicitDest } from "./display/api_utils.js";
|
|
|
37
37
|
import { makeArr } from "./shared/util.js";
|
|
38
38
|
import { makeMap } from "./shared/util.js";
|
|
39
39
|
import { makeObj } from "./shared/util.js";
|
|
40
|
+
import { makeSet } from "./shared/util.js";
|
|
40
41
|
import { MathClamp } from "./shared/math_clamp.js";
|
|
41
42
|
import { noContextMenu } from "./display/display_utils.js";
|
|
42
43
|
import { normalizeUnicode } from "./shared/util.js";
|
|
@@ -65,4 +66,4 @@ import { Util } from "./shared/util.js";
|
|
|
65
66
|
import { VerbosityLevel } from "./shared/util.js";
|
|
66
67
|
import { version } from "./display/api.js";
|
|
67
68
|
import { XfaLayer } from "./display/xfa_layer.js";
|
|
68
|
-
export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, AnnotationType, applyOpacity, build, ColorPicker, createValidAbsoluteUrl, CSSConstants, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, findContrastColor, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getRGB, getRGBA, getUuid, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, isValidExplicitDest, makeArr, makeMap, makeObj, MathClamp, noContextMenu, normalizeUnicode, OPS, OutputScale, PasswordException, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, renderRichText, ResponseException, setLayerDimensions, shadow, SignatureExtractor, stopEvent, SupportedImageMimeTypes, TextLayer, TextLayerImages, TouchManager, updateUrlHash, Util, VerbosityLevel, version, XfaLayer };
|
|
69
|
+
export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, AnnotationType, applyOpacity, build, ColorPicker, createValidAbsoluteUrl, CSSConstants, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, findContrastColor, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getRGB, getRGBA, getUuid, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, isValidExplicitDest, makeArr, makeMap, makeObj, makeSet, MathClamp, noContextMenu, normalizeUnicode, OPS, OutputScale, PasswordException, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, renderRichText, ResponseException, setLayerDimensions, shadow, SignatureExtractor, stopEvent, SupportedImageMimeTypes, TextLayer, TextLayerImages, TouchManager, updateUrlHash, Util, VerbosityLevel, version, XfaLayer };
|
|
@@ -18,7 +18,6 @@ export class BasePDFStream {
|
|
|
18
18
|
*
|
|
19
19
|
* NOTE: Currently this method is only expected to be invoked *after*
|
|
20
20
|
* the `BasePDFStreamReader.prototype.headersReady` promise has resolved.
|
|
21
|
-
*
|
|
22
21
|
* @param {number} begin - the start offset of the data.
|
|
23
22
|
* @param {number} end - the end offset of the data.
|
|
24
23
|
* @returns {BasePDFStreamRangeReader}
|
|
@@ -26,9 +25,9 @@ export class BasePDFStream {
|
|
|
26
25
|
getRangeReader(begin: number, end: number): BasePDFStreamRangeReader;
|
|
27
26
|
/**
|
|
28
27
|
* Cancels all opened reader and closes all their opened requests.
|
|
29
|
-
* @param {
|
|
28
|
+
* @param {object} reason - the reason for cancelling
|
|
30
29
|
*/
|
|
31
|
-
cancelAllRequests(reason:
|
|
30
|
+
cancelAllRequests(reason: object): void;
|
|
32
31
|
#private;
|
|
33
32
|
}
|
|
34
33
|
/**
|
|
@@ -48,9 +47,9 @@ export class BasePDFStreamRangeReader {
|
|
|
48
47
|
read(): Promise<any>;
|
|
49
48
|
/**
|
|
50
49
|
* Cancels all pending read requests and closes the stream.
|
|
51
|
-
* @param {
|
|
50
|
+
* @param {object} reason
|
|
52
51
|
*/
|
|
53
|
-
cancel(reason:
|
|
52
|
+
cancel(reason: object): void;
|
|
54
53
|
}
|
|
55
54
|
/**
|
|
56
55
|
* Interface for a PDF binary data reader.
|
|
@@ -115,7 +114,7 @@ export class BasePDFStreamReader {
|
|
|
115
114
|
read(): Promise<any>;
|
|
116
115
|
/**
|
|
117
116
|
* Cancels all pending read requests and closes the stream.
|
|
118
|
-
* @param {
|
|
117
|
+
* @param {object} reason
|
|
119
118
|
*/
|
|
120
|
-
cancel(reason:
|
|
119
|
+
cancel(reason: object): void;
|
|
121
120
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const CONTROL_CHAR_REGEXP: RegExp;
|
|
2
|
+
/**
|
|
3
|
+
* Serializes a font family, originating from the PDF document, such that it
|
|
4
|
+
* can safely be interpolated into CSS.
|
|
5
|
+
* @param {string} fontFamily
|
|
6
|
+
* @returns {string}
|
|
7
|
+
*/
|
|
8
|
+
export function serializeFontFamily(fontFamily: string): string;
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
export class MessageHandler {
|
|
2
2
|
constructor(sourceName: any, targetName: any, comObj: any);
|
|
3
|
-
sourceName: any;
|
|
4
|
-
targetName: any;
|
|
5
|
-
comObj: any;
|
|
6
|
-
callbackId: number;
|
|
7
|
-
streamId: number;
|
|
8
|
-
streamSinks: any;
|
|
9
|
-
streamControllers: any;
|
|
10
|
-
callbackCapabilities: any;
|
|
11
|
-
actionHandler: any;
|
|
12
3
|
on(actionName: any, handler: any): void;
|
|
13
4
|
/**
|
|
14
5
|
* Sends a message to the comObj to invoke the action with the supplied data.
|
|
@@ -31,12 +22,12 @@ export class MessageHandler {
|
|
|
31
22
|
* Expect that the other side will callback to signal 'start_complete'.
|
|
32
23
|
* @param {string} actionName - Action to call.
|
|
33
24
|
* @param {JSON} data - JSON data to send.
|
|
34
|
-
* @param {
|
|
25
|
+
* @param {object} queueingStrategy - Strategy to signal backpressure based on
|
|
35
26
|
* internal queue.
|
|
36
27
|
* @param {Array} [transfers] - List of transfers/ArrayBuffers.
|
|
37
28
|
* @returns {ReadableStream} ReadableStream to read data in chunks.
|
|
38
29
|
*/
|
|
39
|
-
sendWithStream(actionName: string, data: JSON, queueingStrategy:
|
|
30
|
+
sendWithStream(actionName: string, data: JSON, queueingStrategy: object, transfers?: any[]): ReadableStream;
|
|
40
31
|
destroy(): void;
|
|
41
32
|
#private;
|
|
42
33
|
}
|
|
@@ -3,14 +3,15 @@ export class CSS_FONT_INFO {
|
|
|
3
3
|
}
|
|
4
4
|
export class FONT_INFO {
|
|
5
5
|
static bools: string[];
|
|
6
|
-
static numbers: string[];
|
|
7
6
|
static strings: string[];
|
|
8
|
-
static OFFSET_NUMBERS: number;
|
|
9
7
|
static OFFSET_BBOX: number;
|
|
10
8
|
static OFFSET_FONT_MATRIX: number;
|
|
11
|
-
static OFFSET_DEFAULT_VMETRICS: number;
|
|
12
9
|
static OFFSET_STRINGS: number;
|
|
13
10
|
}
|
|
11
|
+
export class InfoUtils {
|
|
12
|
+
static get decoder(): any;
|
|
13
|
+
static get encoder(): any;
|
|
14
|
+
}
|
|
14
15
|
export class PATTERN_INFO {
|
|
15
16
|
static KIND: number;
|
|
16
17
|
static HAS_BBOX: number;
|
|
@@ -156,13 +156,12 @@ export const BBOX_INIT: number[];
|
|
|
156
156
|
export function bytesToString(bytes: any): string;
|
|
157
157
|
/**
|
|
158
158
|
* Attempts to create a valid absolute URL.
|
|
159
|
-
*
|
|
160
159
|
* @param {URL|string} url - An absolute, or relative, URL.
|
|
161
160
|
* @param {URL|string} [baseUrl] - An absolute URL.
|
|
162
|
-
* @param {
|
|
163
|
-
* @returns Either a valid {URL}, or `null` otherwise.
|
|
161
|
+
* @param {object} [options]
|
|
162
|
+
* @returns {URL | null} Either a valid {@link URL}, or `null` otherwise.
|
|
164
163
|
*/
|
|
165
|
-
export function createValidAbsoluteUrl(url: URL | string, baseUrl?: URL | string, options?:
|
|
164
|
+
export function createValidAbsoluteUrl(url: URL | string, baseUrl?: URL | string, options?: object): URL | null;
|
|
166
165
|
export namespace DocumentActionEventType {
|
|
167
166
|
let WC: string;
|
|
168
167
|
let WS: string;
|
|
@@ -218,13 +217,13 @@ export const LINE_FACTOR: 1.35;
|
|
|
218
217
|
export function makeArr(): never[];
|
|
219
218
|
export function makeMap(): Map<any, any>;
|
|
220
219
|
export function makeObj(): any;
|
|
220
|
+
export function makeSet(): Set<any>;
|
|
221
221
|
export namespace MeshFigureType {
|
|
222
222
|
let TRIANGLES: number;
|
|
223
223
|
let LATTICE: number;
|
|
224
224
|
let PATCH: number;
|
|
225
225
|
}
|
|
226
226
|
export function normalizeUnicode(str: any): any;
|
|
227
|
-
export function objectSize(obj: any): number;
|
|
228
227
|
export namespace OPS {
|
|
229
228
|
export let dependency: number;
|
|
230
229
|
export let setLineWidth: number;
|
|
@@ -399,7 +398,6 @@ export class UnknownErrorException extends UnknownErrorException_base {
|
|
|
399
398
|
export function unreachable(msg: string): never;
|
|
400
399
|
/**
|
|
401
400
|
* Remove, or replace, the hash property of the URL.
|
|
402
|
-
*
|
|
403
401
|
* @param {URL|string} url - The absolute, or relative, URL.
|
|
404
402
|
* @param {string} hash - The hash property (use an empty string to remove it).
|
|
405
403
|
* @param {boolean} [allowRel] - Allow relative URLs.
|
|
@@ -23,7 +23,7 @@ export type AnnotationEditorLayerBuilderRenderOptions = {
|
|
|
23
23
|
intent?: string | undefined;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
* @typedef {
|
|
26
|
+
* @typedef {object} AnnotationEditorLayerBuilderOptions
|
|
27
27
|
* @property {AnnotationEditorUIManager} [uiManager]
|
|
28
28
|
* @property {number} pageIndex
|
|
29
29
|
* @property {L10n} [l10n]
|
|
@@ -32,10 +32,10 @@ export type AnnotationEditorLayerBuilderRenderOptions = {
|
|
|
32
32
|
* @property {AnnotationLayer} [annotationLayer]
|
|
33
33
|
* @property {TextLayer} [textLayer]
|
|
34
34
|
* @property {DrawLayer} [drawLayer]
|
|
35
|
-
* @property {
|
|
35
|
+
* @property {Function} [onAppend]
|
|
36
36
|
*/
|
|
37
37
|
/**
|
|
38
|
-
* @typedef {
|
|
38
|
+
* @typedef {object} AnnotationEditorLayerBuilderRenderOptions
|
|
39
39
|
* @property {PageViewport} viewport
|
|
40
40
|
* @property {string} [intent] - The default value is "display".
|
|
41
41
|
*/
|
|
@@ -56,6 +56,8 @@ export class AnnotationEditorLayerBuilder {
|
|
|
56
56
|
* @returns {Promise<void>}
|
|
57
57
|
*/
|
|
58
58
|
render({ viewport, intent }: AnnotationEditorLayerBuilderRenderOptions): Promise<void>;
|
|
59
|
+
/** @param {PageViewport} viewport */
|
|
60
|
+
update(viewport: PageViewport): void;
|
|
59
61
|
cancel(): void;
|
|
60
62
|
hide(): void;
|
|
61
63
|
show(): void;
|
|
@@ -21,9 +21,7 @@ export type AnnotationLayerBuilderOptions = {
|
|
|
21
21
|
enableComment?: boolean | undefined;
|
|
22
22
|
enableScripting?: boolean | undefined;
|
|
23
23
|
hasJSActionsPromise?: Promise<boolean> | undefined;
|
|
24
|
-
fieldObjectsPromise?: Promise<
|
|
25
|
-
[x: string]: Object[];
|
|
26
|
-
} | null> | undefined;
|
|
24
|
+
fieldObjectsPromise?: Promise<Record<string, object[]> | null> | undefined;
|
|
27
25
|
annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined;
|
|
28
26
|
accessibilityManager?: import("./text_accessibility.js").TextAccessibilityManager | undefined;
|
|
29
27
|
annotationEditorUIManager?: import("../src/pdf.js").AnnotationEditorUIManager | undefined;
|
|
@@ -40,7 +38,7 @@ export type AnnotationLayerBuilderRenderOptions = {
|
|
|
40
38
|
optionalContentConfigPromise?: Promise<any> | undefined;
|
|
41
39
|
};
|
|
42
40
|
/**
|
|
43
|
-
* @typedef {
|
|
41
|
+
* @typedef {object} AnnotationLayerBuilderOptions
|
|
44
42
|
* @property {PDFPageProxy} pdfPage
|
|
45
43
|
* @property {AnnotationStorage} [annotationStorage]
|
|
46
44
|
* @property {string} [imageResourcesPath] - Path for image resources, mainly
|
|
@@ -51,16 +49,16 @@ export type AnnotationLayerBuilderRenderOptions = {
|
|
|
51
49
|
* @property {boolean} [enableComment]
|
|
52
50
|
* @property {boolean} [enableScripting]
|
|
53
51
|
* @property {Promise<boolean>} [hasJSActionsPromise]
|
|
54
|
-
* @property {Promise<
|
|
52
|
+
* @property {Promise<Record<string, Array<object>> | null>}
|
|
55
53
|
* [fieldObjectsPromise]
|
|
56
54
|
* @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap]
|
|
57
55
|
* @property {TextAccessibilityManager} [accessibilityManager]
|
|
58
56
|
* @property {AnnotationEditorUIManager} [annotationEditorUIManager]
|
|
59
|
-
* @property {
|
|
57
|
+
* @property {Function} [onAppend]
|
|
60
58
|
* @property {CommentManager} [commentManager]
|
|
61
59
|
*/
|
|
62
60
|
/**
|
|
63
|
-
* @typedef {
|
|
61
|
+
* @typedef {object} AnnotationLayerBuilderRenderOptions
|
|
64
62
|
* @property {PageViewport} viewport
|
|
65
63
|
* @property {string} [intent] - The default value is "display".
|
|
66
64
|
* @property {StructTreeLayerBuilder} [structTreeLayer]
|
|
@@ -80,9 +78,7 @@ export class AnnotationLayerBuilder {
|
|
|
80
78
|
enableComment: boolean;
|
|
81
79
|
enableScripting: boolean;
|
|
82
80
|
_hasJSActionsPromise: Promise<boolean>;
|
|
83
|
-
_fieldObjectsPromise: Promise<
|
|
84
|
-
[x: string]: Object[];
|
|
85
|
-
} | null>;
|
|
81
|
+
_fieldObjectsPromise: Promise<Record<string, object[]> | null>;
|
|
86
82
|
_annotationCanvasMap: Map<string, HTMLCanvasElement>;
|
|
87
83
|
_accessibilityManager: import("./text_accessibility.js").TextAccessibilityManager;
|
|
88
84
|
_annotationEditorUIManager: import("../src/pdf.js").AnnotationEditorUIManager;
|
|
@@ -101,11 +97,11 @@ export class AnnotationLayerBuilder {
|
|
|
101
97
|
hide(): void;
|
|
102
98
|
hasEditableAnnotations(): boolean;
|
|
103
99
|
/**
|
|
104
|
-
* @param {Array<
|
|
100
|
+
* @param {Array<object>} inferredLinks
|
|
105
101
|
* @returns {Promise<void>} A promise that is resolved when the inferred links
|
|
106
102
|
* are added to the annotation layer.
|
|
107
103
|
*/
|
|
108
|
-
injectLinkAnnotations(inferredLinks: Array<
|
|
104
|
+
injectLinkAnnotations(inferredLinks: Array<object>): Promise<void>;
|
|
109
105
|
#private;
|
|
110
106
|
}
|
|
111
107
|
import { AnnotationLayer } from "../src/pdf.js";
|
|
@@ -13,11 +13,11 @@ export type DrawLayerBuilderOptions = {
|
|
|
13
13
|
/**
|
|
14
14
|
* Filter factory used to style selections (optional).
|
|
15
15
|
*/
|
|
16
|
-
filterFactory?:
|
|
16
|
+
filterFactory?: object | null | undefined;
|
|
17
17
|
/**
|
|
18
18
|
* Page foreground/background colors for HCM (optional).
|
|
19
19
|
*/
|
|
20
|
-
pageColors?:
|
|
20
|
+
pageColors?: object | null | undefined;
|
|
21
21
|
};
|
|
22
22
|
export type DrawLayerBuilderRenderOptions = {
|
|
23
23
|
/**
|
|
@@ -32,27 +32,25 @@ export type DrawLayerBuilderRenderOptions = {
|
|
|
32
32
|
* Zero-based page index.
|
|
33
33
|
* @property {Element | null} [textLayer]
|
|
34
34
|
* Text layer element (optional).
|
|
35
|
-
* @property {
|
|
35
|
+
* @property {object | null} [filterFactory]
|
|
36
36
|
* Filter factory used to style selections (optional).
|
|
37
|
-
* @property {
|
|
37
|
+
* @property {object | null} [pageColors]
|
|
38
38
|
* Page foreground/background colors for HCM (optional).
|
|
39
39
|
*/
|
|
40
40
|
/**
|
|
41
|
-
* @typedef {
|
|
41
|
+
* @typedef {object} DrawLayerBuilderRenderOptions
|
|
42
42
|
* @property {string} [intent] - The default value is "display".
|
|
43
43
|
*/
|
|
44
44
|
export class DrawLayerBuilder {
|
|
45
45
|
/**
|
|
46
46
|
* @param {DrawLayerBuilderOptions} options
|
|
47
47
|
* Configuration.
|
|
48
|
-
* @returns
|
|
49
|
-
* Instance.
|
|
50
48
|
*/
|
|
51
49
|
constructor(options: DrawLayerBuilderOptions);
|
|
52
50
|
pageIndex: number;
|
|
53
51
|
textLayer: Element | null;
|
|
54
|
-
filterFactory:
|
|
55
|
-
pageColors:
|
|
52
|
+
filterFactory: object | null;
|
|
53
|
+
pageColors: object | null;
|
|
56
54
|
/**
|
|
57
55
|
* @param {DrawLayerBuilderRenderOptions} options
|
|
58
56
|
* @returns {Promise<void>}
|
|
@@ -3,7 +3,7 @@ export type WaitOnEventOrTimeoutParameters = {
|
|
|
3
3
|
* - The event target, can for example be:
|
|
4
4
|
* `window`, `document`, a DOM element, or an {EventBus} instance.
|
|
5
5
|
*/
|
|
6
|
-
target:
|
|
6
|
+
target: object;
|
|
7
7
|
/**
|
|
8
8
|
* - The name of the event.
|
|
9
9
|
*/
|
|
@@ -21,21 +21,21 @@ export type WaitOnEventOrTimeoutParameters = {
|
|
|
21
21
|
export class EventBus {
|
|
22
22
|
/**
|
|
23
23
|
* @param {string} eventName
|
|
24
|
-
* @param {
|
|
25
|
-
* @param {
|
|
24
|
+
* @param {Function} listener
|
|
25
|
+
* @param {object} [options]
|
|
26
26
|
*/
|
|
27
|
-
on(eventName: string, listener: Function, options?:
|
|
27
|
+
on(eventName: string, listener: Function, options?: object): void;
|
|
28
28
|
/**
|
|
29
29
|
* @param {string} eventName
|
|
30
|
-
* @param {
|
|
31
|
-
* @param {
|
|
30
|
+
* @param {Function} listener
|
|
31
|
+
* @param {object} [options]
|
|
32
32
|
*/
|
|
33
|
-
off(eventName: string, listener: Function, options?:
|
|
33
|
+
off(eventName: string, listener: Function, options?: object): void;
|
|
34
34
|
/**
|
|
35
35
|
* @param {string} eventName
|
|
36
|
-
* @param {
|
|
36
|
+
* @param {object} data
|
|
37
37
|
*/
|
|
38
|
-
dispatch(eventName: string, data:
|
|
38
|
+
dispatch(eventName: string, data: object): void;
|
|
39
39
|
#private;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
@@ -47,8 +47,8 @@ export class FirefoxEventBus extends EventBus {
|
|
|
47
47
|
#private;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* @typedef {
|
|
51
|
-
* @property {
|
|
50
|
+
* @typedef {object} WaitOnEventOrTimeoutParameters
|
|
51
|
+
* @property {object} target - The event target, can for example be:
|
|
52
52
|
* `window`, `document`, a DOM element, or an {EventBus} instance.
|
|
53
53
|
* @property {string} name - The name of the event.
|
|
54
54
|
* @property {number} delay - The delay, in milliseconds, after which the
|
|
@@ -58,8 +58,7 @@ export class FirefoxEventBus extends EventBus {
|
|
|
58
58
|
* Allows waiting for an event or a timeout, whichever occurs first.
|
|
59
59
|
* Can be used to ensure that an action always occurs, even when an event
|
|
60
60
|
* arrives late or not at all.
|
|
61
|
-
*
|
|
62
|
-
* @param {WaitOnEventOrTimeoutParameters}
|
|
61
|
+
* @param {WaitOnEventOrTimeoutParameters} params
|
|
63
62
|
* @returns {Promise} A promise that is resolved with a {WaitOnType} value.
|
|
64
63
|
*/
|
|
65
64
|
export function waitOnEventOrTimeout({ target, name, delay }: WaitOnEventOrTimeoutParameters): Promise<any>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export class GenericL10n extends L10n {
|
|
2
2
|
/**
|
|
3
3
|
* Generate the bundles for Fluent.
|
|
4
|
-
* @param {
|
|
4
|
+
* @param {string} defaultLang - The fallback language to use for
|
|
5
5
|
* translations.
|
|
6
|
-
* @param {
|
|
6
|
+
* @param {string} baseLang - The base language to use for translations.
|
|
7
7
|
*/
|
|
8
8
|
static #generateBundles(defaultLang: string, baseLang: string): AsyncGenerator<any, void, unknown>;
|
|
9
9
|
static #createBundle(lang: any, baseURL: any, paths: any): Promise<any>;
|
package/dist/types/web/l10n.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export class L10n {
|
|
|
16
16
|
/** @inheritdoc */
|
|
17
17
|
getDirection(): string;
|
|
18
18
|
/** @inheritdoc */
|
|
19
|
-
get(ids: any, args
|
|
19
|
+
get(ids: any, args?: null): Promise<any>;
|
|
20
20
|
/** @inheritdoc */
|
|
21
21
|
translate(element: any): Promise<void>;
|
|
22
22
|
/** @inheritdoc */
|