@chialab/pdfjs-lib 1.0.0-alpha.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.
Files changed (104) hide show
  1. package/README.md +29 -0
  2. package/dist/browser/FoxitDingbats-SB6TO3S5.js +9 -0
  3. package/dist/browser/FoxitFixed-UIGSMBQB.js +9 -0
  4. package/dist/browser/FoxitFixedBold-2PAEIZAT.js +9 -0
  5. package/dist/browser/FoxitFixedBoldItalic-OSQUQDEE.js +9 -0
  6. package/dist/browser/FoxitFixedItalic-W73RDK22.js +9 -0
  7. package/dist/browser/FoxitSerif-3HH3SOZF.js +9 -0
  8. package/dist/browser/FoxitSerifBold-HXP2QOO7.js +9 -0
  9. package/dist/browser/FoxitSerifBoldItalic-FZXLNWD7.js +9 -0
  10. package/dist/browser/FoxitSerifItalic-WQFHUBI2.js +9 -0
  11. package/dist/browser/FoxitSymbol-OVWU7LKS.js +9 -0
  12. package/dist/browser/LiberationMono-Regular-UUOCTXY2.js +9 -0
  13. package/dist/browser/LiberationSans-Bold-GSJN42N5.js +9 -0
  14. package/dist/browser/LiberationSans-BoldItalic-UCPQJ3L2.js +9 -0
  15. package/dist/browser/LiberationSans-Italic-6CIHEALY.js +9 -0
  16. package/dist/browser/LiberationSans-Regular-KIF3IRJY.js +9 -0
  17. package/dist/browser/LiberationSerif-Regular-ASQ2LI3D.js +9 -0
  18. package/dist/browser/chunk-DYHYQ33L.js +1775 -0
  19. package/dist/browser/chunk-O4UKW7AD.js +44 -0
  20. package/dist/browser/index.js +26324 -0
  21. package/dist/browser/worker.js +84242 -0
  22. package/dist/index.d.ts +10 -0
  23. package/dist/lib/AnnotationData.d.ts +204 -0
  24. package/dist/lib/Canvas.d.ts +17 -0
  25. package/dist/lib/PDFPageProxy.d.ts +1 -0
  26. package/dist/lib/Path2D.d.ts +72 -0
  27. package/dist/lib/StandardFontDataFactory.d.ts +14 -0
  28. package/dist/lib/SvgCanvasContext.d.ts +156 -0
  29. package/dist/lib/TextLayer.d.ts +51 -0
  30. package/dist/lib/polyfills.d.ts +0 -0
  31. package/dist/lib/utils.d.ts +13 -0
  32. package/dist/node/FoxitDingbats-65AZ2Z2V.js +9 -0
  33. package/dist/node/FoxitFixed-OZGLVVOQ.js +9 -0
  34. package/dist/node/FoxitFixedBold-37OOYMV7.js +9 -0
  35. package/dist/node/FoxitFixedBoldItalic-XYFHEG2V.js +9 -0
  36. package/dist/node/FoxitFixedItalic-MM7OSGS6.js +9 -0
  37. package/dist/node/FoxitSerif-MLMJQPRP.js +9 -0
  38. package/dist/node/FoxitSerifBold-AC7RJQWJ.js +9 -0
  39. package/dist/node/FoxitSerifBoldItalic-YCQ4CLKE.js +9 -0
  40. package/dist/node/FoxitSerifItalic-CXVTCST4.js +9 -0
  41. package/dist/node/FoxitSymbol-VUGMZN5C.js +9 -0
  42. package/dist/node/LiberationMono-Regular-KMFXXO3B.js +9 -0
  43. package/dist/node/LiberationSans-Bold-XSHQQBWB.js +9 -0
  44. package/dist/node/LiberationSans-BoldItalic-CTAZRFRL.js +9 -0
  45. package/dist/node/LiberationSans-Italic-WIOTUKLC.js +9 -0
  46. package/dist/node/LiberationSans-Regular-CDMMZL5S.js +9 -0
  47. package/dist/node/LiberationSerif-Regular-WAOWR76G.js +9 -0
  48. package/dist/node/chunk-7MW5RQZ5.js +30 -0
  49. package/dist/node/chunk-KTTVPO2G.js +1775 -0
  50. package/dist/node/index.js +26621 -0
  51. package/dist/node/worker.js +84242 -0
  52. package/dist/pdf.js/src/display/annotation_layer.d.ts +241 -0
  53. package/dist/pdf.js/src/display/annotation_storage.d.ts +99 -0
  54. package/dist/pdf.js/src/display/api.d.ts +1586 -0
  55. package/dist/pdf.js/src/display/canvas.d.ts +213 -0
  56. package/dist/pdf.js/src/display/canvas_factory.d.ts +27 -0
  57. package/dist/pdf.js/src/display/cmap_reader_factory.d.ts +25 -0
  58. package/dist/pdf.js/src/display/display_utils.d.ts +247 -0
  59. package/dist/pdf.js/src/display/draw_layer.d.ts +26 -0
  60. package/dist/pdf.js/src/display/editor/alt_text.d.ts +34 -0
  61. package/dist/pdf.js/src/display/editor/annotation_editor_layer.d.ts +230 -0
  62. package/dist/pdf.js/src/display/editor/color_picker.d.ts +20 -0
  63. package/dist/pdf.js/src/display/editor/draw.d.ts +121 -0
  64. package/dist/pdf.js/src/display/editor/drawers/contour.d.ts +3 -0
  65. package/dist/pdf.js/src/display/editor/drawers/freedraw.d.ts +31 -0
  66. package/dist/pdf.js/src/display/editor/drawers/highlight.d.ts +36 -0
  67. package/dist/pdf.js/src/display/editor/drawers/inkdraw.d.ts +129 -0
  68. package/dist/pdf.js/src/display/editor/drawers/outline.d.ts +19 -0
  69. package/dist/pdf.js/src/display/editor/drawers/signaturedraw.d.ts +79 -0
  70. package/dist/pdf.js/src/display/editor/editor.d.ts +474 -0
  71. package/dist/pdf.js/src/display/editor/freetext.d.ts +59 -0
  72. package/dist/pdf.js/src/display/editor/highlight.d.ts +70 -0
  73. package/dist/pdf.js/src/display/editor/ink.d.ts +36 -0
  74. package/dist/pdf.js/src/display/editor/signature.d.ts +79 -0
  75. package/dist/pdf.js/src/display/editor/stamp.d.ts +48 -0
  76. package/dist/pdf.js/src/display/editor/toolbar.d.ts +21 -0
  77. package/dist/pdf.js/src/display/editor/tools.d.ts +424 -0
  78. package/dist/pdf.js/src/display/filter_factory.d.ts +29 -0
  79. package/dist/pdf.js/src/display/font_loader.d.ts +39 -0
  80. package/dist/pdf.js/src/display/metadata.d.ts +11 -0
  81. package/dist/pdf.js/src/display/node_utils.d.ts +32 -0
  82. package/dist/pdf.js/src/display/optional_content_config.d.ts +18 -0
  83. package/dist/pdf.js/src/display/pattern_helper.d.ts +73 -0
  84. package/dist/pdf.js/src/display/standard_fontdata_factory.d.ts +20 -0
  85. package/dist/pdf.js/src/display/svg_factory.d.ts +14 -0
  86. package/dist/pdf.js/src/display/text_layer.d.ts +85 -0
  87. package/dist/pdf.js/src/display/touch_manager.d.ts +14 -0
  88. package/dist/pdf.js/src/display/transport_stream.d.ts +67 -0
  89. package/dist/pdf.js/src/display/wasm_factory.d.ts +20 -0
  90. package/dist/pdf.js/src/display/worker_options.d.ts +25 -0
  91. package/dist/pdf.js/src/display/xfa_layer.d.ts +47 -0
  92. package/dist/pdf.js/src/display/xfa_text.d.ts +21 -0
  93. package/dist/pdf.js/src/interfaces.d.ts +122 -0
  94. package/dist/pdf.js/src/pdf.d.ts +55 -0
  95. package/dist/pdf.js/src/shared/image_utils.d.ts +17 -0
  96. package/dist/pdf.js/src/shared/message_handler.d.ts +48 -0
  97. package/dist/pdf.js/src/shared/murmurhash3.d.ts +7 -0
  98. package/dist/pdf.js/src/shared/scripting_utils.d.ts +16 -0
  99. package/dist/pdf.js/src/shared/util.d.ts +388 -0
  100. package/dist/pdf.js/web/interfaces.d.ts +167 -0
  101. package/dist/pdf.js/web/struct_tree_layer_builder.d.ts +25 -0
  102. package/dist/pdf.js/web/text_accessibility.d.ts +44 -0
  103. package/dist/pdf.js/web/ui_utils.d.ts +273 -0
  104. package/package.json +43 -0
@@ -0,0 +1,18 @@
1
+ export class OptionalContentConfig {
2
+ constructor(data: any, renderingIntent?: number);
3
+ renderingIntent: number;
4
+ name: any;
5
+ creator: any;
6
+ isVisible(group: any): any;
7
+ setVisibility(id: any, visible?: boolean, preserveRB?: boolean): void;
8
+ setOCGState({ state, preserveRB }: {
9
+ state: any;
10
+ preserveRB: any;
11
+ }): void;
12
+ get hasInitialVisibility(): boolean;
13
+ getOrder(): any;
14
+ getGroups(): any;
15
+ getGroup(id: any): any;
16
+ getHash(): string;
17
+ #private;
18
+ }
@@ -0,0 +1,73 @@
1
+ export function getShadingPattern(IR: any): RadialAxialShadingPattern | MeshShadingPattern | DummyShadingPattern;
2
+ export namespace PathType {
3
+ let FILL: string;
4
+ let STROKE: string;
5
+ let SHADING: string;
6
+ }
7
+ export class TilingPattern {
8
+ static MAX_PATTERN_SIZE: number;
9
+ constructor(IR: any, color: any, ctx: any, canvasGraphicsFactory: any, baseTransform: any);
10
+ operatorList: any;
11
+ matrix: any;
12
+ bbox: any;
13
+ xstep: any;
14
+ ystep: any;
15
+ paintType: any;
16
+ tilingType: any;
17
+ color: any;
18
+ ctx: any;
19
+ canvasGraphicsFactory: any;
20
+ baseTransform: any;
21
+ createPatternCanvas(owner: any): {
22
+ canvas: any;
23
+ scaleX: any;
24
+ scaleY: any;
25
+ offsetX: any;
26
+ offsetY: any;
27
+ };
28
+ getSizeAndScale(step: any, realOutputSize: any, scale: any): {
29
+ scale: any;
30
+ size: number;
31
+ };
32
+ clipBbox(graphics: any, x0: any, y0: any, x1: any, y1: any): void;
33
+ setFillAndStrokeStyleToContext(graphics: any, paintType: any, color: any): void;
34
+ getPattern(ctx: any, owner: any, inverse: any, pathType: any): any;
35
+ }
36
+ declare class RadialAxialShadingPattern extends BaseShadingPattern {
37
+ constructor(IR: any);
38
+ _type: any;
39
+ _bbox: any;
40
+ _colorStops: any;
41
+ _p0: any;
42
+ _p1: any;
43
+ _r0: any;
44
+ _r1: any;
45
+ matrix: any;
46
+ _createGradient(ctx: any): any;
47
+ getPattern(ctx: any, owner: any, inverse: any, pathType: any): any;
48
+ }
49
+ declare class MeshShadingPattern extends BaseShadingPattern {
50
+ constructor(IR: any);
51
+ _coords: any;
52
+ _colors: any;
53
+ _figures: any;
54
+ _bounds: any;
55
+ _bbox: any;
56
+ _background: any;
57
+ matrix: any;
58
+ _createMeshCanvas(combinedScale: any, backgroundColor: any, cachedCanvases: any): {
59
+ canvas: any;
60
+ offsetX: number;
61
+ offsetY: number;
62
+ scaleX: number;
63
+ scaleY: number;
64
+ };
65
+ getPattern(ctx: any, owner: any, inverse: any, pathType: any): any;
66
+ }
67
+ declare class DummyShadingPattern extends BaseShadingPattern {
68
+ getPattern(): string;
69
+ }
70
+ declare class BaseShadingPattern {
71
+ getPattern(): void;
72
+ }
73
+ export {};
@@ -0,0 +1,20 @@
1
+ export class BaseStandardFontDataFactory {
2
+ constructor({ baseUrl }: {
3
+ baseUrl?: null | undefined;
4
+ });
5
+ baseUrl: any;
6
+ fetch({ filename }: {
7
+ filename: any;
8
+ }): Promise<Uint8Array<ArrayBufferLike>>;
9
+ /**
10
+ * @ignore
11
+ * @returns {Promise<Uint8Array>}
12
+ */
13
+ _fetch(url: any): Promise<Uint8Array>;
14
+ }
15
+ export class DOMStandardFontDataFactory extends BaseStandardFontDataFactory {
16
+ /**
17
+ * @ignore
18
+ */
19
+ _fetch(url: any): Promise<Uint8Array<any>>;
20
+ }
@@ -0,0 +1,14 @@
1
+ export class BaseSVGFactory {
2
+ create(width: any, height: any, skipDimensions?: boolean): void;
3
+ createElement(type: any): void;
4
+ /**
5
+ * @ignore
6
+ */
7
+ _createSVG(type: any): void;
8
+ }
9
+ export class DOMSVGFactory extends BaseSVGFactory {
10
+ /**
11
+ * @ignore
12
+ */
13
+ _createSVG(type: any): any;
14
+ }
@@ -0,0 +1,85 @@
1
+ export type PageViewport = import("./display_utils").PageViewport;
2
+ export type TextContent = import("./api").TextContent;
3
+ export type TextLayerParameters = {
4
+ /**
5
+ * - Text content to
6
+ * render, i.e. the value returned by the page's `streamTextContent` or
7
+ * `getTextContent` method.
8
+ */
9
+ textContentSource: ReadableStream | TextContent;
10
+ /**
11
+ * - The DOM node that will contain the text
12
+ * runs.
13
+ */
14
+ container: HTMLElement;
15
+ /**
16
+ * - The target viewport to properly layout
17
+ * the text runs.
18
+ */
19
+ viewport: PageViewport;
20
+ };
21
+ export type TextLayerUpdateParameters = {
22
+ /**
23
+ * - The target viewport to properly layout
24
+ * the text runs.
25
+ */
26
+ viewport: PageViewport;
27
+ /**
28
+ * - Callback invoked before the textLayer is
29
+ * updated in the DOM.
30
+ */
31
+ onBefore?: Function | undefined;
32
+ };
33
+ export class TextLayer {
34
+ static "__#54@#ascentCache": Map<any, any>;
35
+ static "__#54@#canvasContexts": Map<any, any>;
36
+ static "__#54@#canvasCtxFonts": WeakMap<WeakKey, any>;
37
+ static "__#54@#minFontSize": null;
38
+ static "__#54@#pendingTextLayers": Set<any>;
39
+ static get fontFamilyMap(): any;
40
+ /**
41
+ * Clean-up global textLayer data.
42
+ * @returns {undefined}
43
+ */
44
+ static cleanup(): undefined;
45
+ static "__#54@#getCtx"(lang?: null): any;
46
+ static "__#54@#ensureCtxFont"(ctx: any, size: any, family: any): void;
47
+ /**
48
+ * Compute the minimum font size enforced by the browser.
49
+ */
50
+ static "__#54@#ensureMinFontSizeComputed"(): void;
51
+ static "__#54@#getAscent"(fontFamily: any, style: any, lang: any): any;
52
+ /**
53
+ * @param {TextLayerParameters} options
54
+ */
55
+ constructor({ textContentSource, container, viewport }: TextLayerParameters);
56
+ /**
57
+ * Render the textLayer.
58
+ * @returns {Promise}
59
+ */
60
+ render(): Promise<any>;
61
+ /**
62
+ * Update a previously rendered textLayer, if necessary.
63
+ * @param {TextLayerUpdateParameters} options
64
+ * @returns {undefined}
65
+ */
66
+ update({ viewport, onBefore }: TextLayerUpdateParameters): undefined;
67
+ /**
68
+ * Cancel rendering of the textLayer.
69
+ * @returns {undefined}
70
+ */
71
+ cancel(): undefined;
72
+ /**
73
+ * @type {Array<HTMLElement>} HTML elements that correspond to the text items
74
+ * of the textContent input.
75
+ * This is output and will initially be set to an empty array.
76
+ */
77
+ get textDivs(): Array<HTMLElement>;
78
+ /**
79
+ * @type {Array<string>} Strings that correspond to the `str` property of
80
+ * the text items of the textContent input.
81
+ * This is output and will initially be set to an empty array
82
+ */
83
+ get textContentItemsStr(): Array<string>;
84
+ #private;
85
+ }
@@ -0,0 +1,14 @@
1
+ export class TouchManager {
2
+ constructor({ container, isPinchingDisabled, isPinchingStopped, onPinchStart, onPinching, onPinchEnd, signal, }: {
3
+ container: any;
4
+ isPinchingDisabled?: null | undefined;
5
+ isPinchingStopped?: null | undefined;
6
+ onPinchStart?: null | undefined;
7
+ onPinching?: null | undefined;
8
+ onPinchEnd?: null | undefined;
9
+ signal: any;
10
+ });
11
+ get MIN_TOUCH_DISTANCE_TO_PINCH(): any;
12
+ destroy(): void;
13
+ #private;
14
+ }
@@ -0,0 +1,67 @@
1
+ export type IPDFStream = import("../interfaces").IPDFStream;
2
+ export type IPDFStreamReader = import("../interfaces").IPDFStreamReader;
3
+ export type IPDFStreamRangeReader = import("../interfaces").IPDFStreamRangeReader;
4
+ /** @implements {IPDFStream} */
5
+ export class PDFDataTransportStream implements IPDFStream {
6
+ constructor(pdfDataRangeTransport: any, { disableRange, disableStream }: {
7
+ disableRange?: boolean | undefined;
8
+ disableStream?: boolean | undefined;
9
+ });
10
+ _queuedChunks: any[];
11
+ _progressiveDone: any;
12
+ _contentDispositionFilename: any;
13
+ _pdfDataRangeTransport: any;
14
+ _isStreamingSupported: boolean;
15
+ _isRangeSupported: boolean;
16
+ _contentLength: any;
17
+ _fullRequestReader: any;
18
+ _rangeReaders: any[];
19
+ _onReceiveData({ begin, chunk }: {
20
+ begin: any;
21
+ chunk: any;
22
+ }): void;
23
+ get _progressiveDataLength(): any;
24
+ _onProgress(evt: any): void;
25
+ _onProgressiveDone(): void;
26
+ _removeRangeReader(reader: any): void;
27
+ getFullReader(): PDFDataTransportStreamReader;
28
+ getRangeReader(begin: any, end: any): PDFDataTransportStreamRangeReader | null;
29
+ cancelAllRequests(reason: any): void;
30
+ }
31
+ /** @implements {IPDFStreamReader} */
32
+ declare class PDFDataTransportStreamReader implements IPDFStreamReader {
33
+ constructor(stream: any, queuedChunks: any, progressiveDone?: boolean, contentDispositionFilename?: null);
34
+ _stream: any;
35
+ _done: boolean;
36
+ _filename: any;
37
+ _queuedChunks: any;
38
+ _loaded: number;
39
+ _requests: any[];
40
+ _headersReady: Promise<void>;
41
+ onProgress: any;
42
+ _enqueue(chunk: any): void;
43
+ get headersReady(): Promise<void>;
44
+ get filename(): any;
45
+ get isRangeSupported(): any;
46
+ get isStreamingSupported(): any;
47
+ get contentLength(): any;
48
+ read(): Promise<any>;
49
+ cancel(reason: any): void;
50
+ progressiveDone(): void;
51
+ }
52
+ /** @implements {IPDFStreamRangeReader} */
53
+ declare class PDFDataTransportStreamRangeReader implements IPDFStreamRangeReader {
54
+ constructor(stream: any, begin: any, end: any);
55
+ _stream: any;
56
+ _begin: any;
57
+ _end: any;
58
+ _queuedChunk: any;
59
+ _requests: any[];
60
+ _done: boolean;
61
+ onProgress: any;
62
+ _enqueue(chunk: any): void;
63
+ get isStreamingSupported(): boolean;
64
+ read(): Promise<any>;
65
+ cancel(reason: any): void;
66
+ }
67
+ export {};
@@ -0,0 +1,20 @@
1
+ export class BaseWasmFactory {
2
+ constructor({ baseUrl }: {
3
+ baseUrl?: null | undefined;
4
+ });
5
+ baseUrl: any;
6
+ fetch({ filename }: {
7
+ filename: any;
8
+ }): Promise<Uint8Array<ArrayBufferLike>>;
9
+ /**
10
+ * @ignore
11
+ * @returns {Promise<Uint8Array>}
12
+ */
13
+ _fetch(url: any): Promise<Uint8Array>;
14
+ }
15
+ export class DOMWasmFactory extends BaseWasmFactory {
16
+ /**
17
+ * @ignore
18
+ */
19
+ _fetch(url: any): Promise<Uint8Array<any>>;
20
+ }
@@ -0,0 +1,25 @@
1
+ export class GlobalWorkerOptions {
2
+ static "__#50@#port": null;
3
+ static "__#50@#src": string;
4
+ /**
5
+ * @param {Worker | null} workerPort - Defines global port for worker process.
6
+ * Overrides the `workerSrc` option.
7
+ */
8
+ static set workerPort(val: Worker | null);
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.
16
+ *
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}
23
+ */
24
+ static get workerSrc(): string;
25
+ }
@@ -0,0 +1,47 @@
1
+ export type AnnotationStorage = import("./annotation_storage").AnnotationStorage;
2
+ export type PageViewport = import("./display_utils").PageViewport;
3
+ export type IPDFLinkService = import("../../web/interfaces").IPDFLinkService;
4
+ export type XfaLayerParameters = {
5
+ viewport: PageViewport;
6
+ div: HTMLDivElement;
7
+ xfaHtml: Object;
8
+ annotationStorage?: import("./annotation_storage").AnnotationStorage | undefined;
9
+ linkService: IPDFLinkService;
10
+ /**
11
+ * - (default value is 'display').
12
+ */
13
+ intent?: string | undefined;
14
+ };
15
+ /**
16
+ * @typedef {Object} XfaLayerParameters
17
+ * @property {PageViewport} viewport
18
+ * @property {HTMLDivElement} div
19
+ * @property {Object} xfaHtml
20
+ * @property {AnnotationStorage} [annotationStorage]
21
+ * @property {IPDFLinkService} linkService
22
+ * @property {string} [intent] - (default value is 'display').
23
+ */
24
+ export class XfaLayer {
25
+ static setupStorage(html: any, id: any, element: any, storage: any, intent: any): void;
26
+ static setAttributes({ html, element, storage, intent, linkService }: {
27
+ html: any;
28
+ element: any;
29
+ storage?: null | undefined;
30
+ intent: any;
31
+ linkService: any;
32
+ }): void;
33
+ /**
34
+ * Render the XFA layer.
35
+ *
36
+ * @param {XfaLayerParameters} parameters
37
+ */
38
+ static render(parameters: XfaLayerParameters): {
39
+ textDivs: Text[];
40
+ };
41
+ /**
42
+ * Update the XFA layer.
43
+ *
44
+ * @param {XfaLayerParameters} parameters
45
+ */
46
+ static update(parameters: XfaLayerParameters): void;
47
+ }
@@ -0,0 +1,21 @@
1
+ export type TextContent = import("./api").TextContent;
2
+ /** @typedef {import("./api").TextContent} TextContent */
3
+ export class XfaText {
4
+ /**
5
+ * Walk an XFA tree and create an array of text nodes that is compatible
6
+ * with a regular PDFs TextContent. Currently, only TextItem.str is supported,
7
+ * all other fields and styles haven't been implemented.
8
+ *
9
+ * @param {Object} xfa - An XFA fake DOM object.
10
+ *
11
+ * @returns {TextContent}
12
+ */
13
+ static textContent(xfa: Object): TextContent;
14
+ /**
15
+ * @param {string} name - DOM node name. (lower case)
16
+ *
17
+ * @returns {boolean} true if the DOM node should have a corresponding text
18
+ * node.
19
+ */
20
+ static shouldBuildText(name: string): boolean;
21
+ }
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Interface that represents PDF data transport. If possible, it allows
3
+ * progressively load entire or fragment of the PDF binary data.
4
+ *
5
+ * @interface
6
+ */
7
+ export class IPDFStream {
8
+ /**
9
+ * Gets a reader for the entire PDF data.
10
+ * @returns {IPDFStreamReader}
11
+ */
12
+ getFullReader(): IPDFStreamReader;
13
+ /**
14
+ * Gets a reader for the range of the PDF data.
15
+ *
16
+ * NOTE: Currently this method is only expected to be invoked *after*
17
+ * the `IPDFStreamReader.prototype.headersReady` promise has resolved.
18
+ *
19
+ * @param {number} begin - the start offset of the data.
20
+ * @param {number} end - the end offset of the data.
21
+ * @returns {IPDFStreamRangeReader}
22
+ */
23
+ getRangeReader(begin: number, end: number): IPDFStreamRangeReader;
24
+ /**
25
+ * Cancels all opened reader and closes all their opened requests.
26
+ * @param {Object} reason - the reason for cancelling
27
+ */
28
+ cancelAllRequests(reason: Object): void;
29
+ }
30
+ /**
31
+ * Interface for a PDF binary data fragment reader.
32
+ *
33
+ * @interface
34
+ */
35
+ export class IPDFStreamRangeReader {
36
+ /**
37
+ * Sets or gets the progress callback. The callback can be useful when the
38
+ * isStreamingSupported property of the object is defined as false.
39
+ * The callback is called with one parameter: an object with the loaded
40
+ * property.
41
+ */
42
+ onProgress: any;
43
+ /**
44
+ * Gets ability of the stream to progressively load binary data.
45
+ * @type {boolean}
46
+ */
47
+ get isStreamingSupported(): boolean;
48
+ /**
49
+ * Requests a chunk of the binary data. The method returns the promise, which
50
+ * is resolved into object with properties "value" and "done". If the done
51
+ * is set to true, then the stream has reached its end, otherwise the value
52
+ * contains binary data. Cancelled requests will be resolved with the done is
53
+ * set to true.
54
+ * @returns {Promise}
55
+ */
56
+ read(): Promise<any>;
57
+ /**
58
+ * Cancels all pending read requests and closes the stream.
59
+ * @param {Object} reason
60
+ */
61
+ cancel(reason: Object): void;
62
+ }
63
+ /**
64
+ * Interface for a PDF binary data reader.
65
+ *
66
+ * @interface
67
+ */
68
+ export class IPDFStreamReader {
69
+ /**
70
+ * Sets or gets the progress callback. The callback can be useful when the
71
+ * isStreamingSupported property of the object is defined as false.
72
+ * The callback is called with one parameter: an object with the loaded and
73
+ * total properties.
74
+ */
75
+ onProgress: any;
76
+ /**
77
+ * Gets a promise that is resolved when the headers and other metadata of
78
+ * the PDF data stream are available.
79
+ * @type {Promise}
80
+ */
81
+ get headersReady(): Promise<any>;
82
+ /**
83
+ * Gets the Content-Disposition filename. It is defined after the headersReady
84
+ * promise is resolved.
85
+ * @type {string|null} The filename, or `null` if the Content-Disposition
86
+ * header is missing/invalid.
87
+ */
88
+ get filename(): string | null;
89
+ /**
90
+ * Gets PDF binary data length. It is defined after the headersReady promise
91
+ * is resolved.
92
+ * @type {number} The data length (or 0 if unknown).
93
+ */
94
+ get contentLength(): number;
95
+ /**
96
+ * Gets ability of the stream to handle range requests. It is defined after
97
+ * the headersReady promise is resolved. Rejected when the reader is cancelled
98
+ * or an error occurs.
99
+ * @type {boolean}
100
+ */
101
+ get isRangeSupported(): boolean;
102
+ /**
103
+ * Gets ability of the stream to progressively load binary data. It is defined
104
+ * after the headersReady promise is resolved.
105
+ * @type {boolean}
106
+ */
107
+ get isStreamingSupported(): boolean;
108
+ /**
109
+ * Requests a chunk of the binary data. The method returns the promise, which
110
+ * is resolved into object with properties "value" and "done". If the done
111
+ * is set to true, then the stream has reached its end, otherwise the value
112
+ * contains binary data. Cancelled requests will be resolved with the done is
113
+ * set to true.
114
+ * @returns {Promise}
115
+ */
116
+ read(): Promise<any>;
117
+ /**
118
+ * Cancels all pending read requests and closes the stream.
119
+ * @param {Object} reason
120
+ */
121
+ cancel(reason: Object): void;
122
+ }
@@ -0,0 +1,55 @@
1
+ export type OnProgressParameters = import("./display/api").OnProgressParameters;
2
+ export type PDFDocumentLoadingTask = import("./display/api").PDFDocumentLoadingTask;
3
+ export type PDFDocumentProxy = import("./display/api").PDFDocumentProxy;
4
+ export type PDFPageProxy = import("./display/api").PDFPageProxy;
5
+ export type RenderTask = import("./display/api").RenderTask;
6
+ export type PageViewport = import("./display/display_utils").PageViewport;
7
+ import { AbortException } from "./shared/util.js";
8
+ import { AnnotationEditorLayer } from "./display/editor/annotation_editor_layer.js";
9
+ import { AnnotationEditorParamsType } from "./shared/util.js";
10
+ import { AnnotationEditorType } from "./shared/util.js";
11
+ import { AnnotationEditorUIManager } from "./display/editor/tools.js";
12
+ import { AnnotationLayer } from "./display/annotation_layer.js";
13
+ import { AnnotationMode } from "./shared/util.js";
14
+ import { AnnotationType } from "./shared/util.js";
15
+ import { build } from "./display/api.js";
16
+ import { ColorPicker } from "./display/editor/color_picker.js";
17
+ import { createValidAbsoluteUrl } from "./shared/util.js";
18
+ import { DOMSVGFactory } from "./display/svg_factory.js";
19
+ import { DrawLayer } from "./display/draw_layer.js";
20
+ import { FeatureTest } from "./shared/util.js";
21
+ import { fetchData } from "./display/display_utils.js";
22
+ import { getDocument } from "./display/api.js";
23
+ import { getFilenameFromUrl } from "./display/display_utils.js";
24
+ import { getPdfFilenameFromUrl } from "./display/display_utils.js";
25
+ import { getUuid } from "./shared/util.js";
26
+ import { getXfaPageViewport } from "./display/display_utils.js";
27
+ import { GlobalWorkerOptions } from "./display/worker_options.js";
28
+ import { ImageKind } from "./shared/util.js";
29
+ import { InvalidPDFException } from "./shared/util.js";
30
+ import { isDataScheme } from "./display/display_utils.js";
31
+ import { isPdfFile } from "./display/display_utils.js";
32
+ import { noContextMenu } from "./display/display_utils.js";
33
+ import { normalizeUnicode } from "./shared/util.js";
34
+ import { OPS } from "./shared/util.js";
35
+ import { OutputScale } from "./display/display_utils.js";
36
+ import { PasswordResponses } from "./shared/util.js";
37
+ import { PDFDataRangeTransport } from "./display/api.js";
38
+ import { PDFDateString } from "./display/display_utils.js";
39
+ import { PDFWorker } from "./display/api.js";
40
+ import { PermissionFlag } from "./shared/util.js";
41
+ import { PixelsPerInch } from "./display/display_utils.js";
42
+ import { RenderingCancelledException } from "./display/display_utils.js";
43
+ import { ResponseException } from "./shared/util.js";
44
+ import { setLayerDimensions } from "./display/display_utils.js";
45
+ import { shadow } from "./shared/util.js";
46
+ import { SignatureExtractor } from "./display/editor/drawers/signaturedraw.js";
47
+ import { stopEvent } from "./display/display_utils.js";
48
+ import { SupportedImageMimeTypes } from "./display/display_utils.js";
49
+ import { TextLayer } from "./display/text_layer.js";
50
+ import { TouchManager } from "./display/touch_manager.js";
51
+ import { Util } from "./shared/util.js";
52
+ import { VerbosityLevel } from "./shared/util.js";
53
+ import { version } from "./display/api.js";
54
+ import { XfaLayer } from "./display/xfa_layer.js";
55
+ export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, AnnotationType, build, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getUuid, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, noContextMenu, normalizeUnicode, OPS, OutputScale, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, ResponseException, setLayerDimensions, shadow, SignatureExtractor, stopEvent, SupportedImageMimeTypes, TextLayer, TouchManager, Util, VerbosityLevel, version, XfaLayer };
@@ -0,0 +1,17 @@
1
+ export function convertBlackAndWhiteToRGBA({ src, srcPos, dest, width, height, nonBlackColor, inverseDecode, }: {
2
+ src: any;
3
+ srcPos?: number | undefined;
4
+ dest: any;
5
+ width: any;
6
+ height: any;
7
+ nonBlackColor?: number | undefined;
8
+ inverseDecode?: boolean | undefined;
9
+ }): {
10
+ srcPos: number;
11
+ destPos: number;
12
+ };
13
+ export function convertToRGBA(params: any): {
14
+ srcPos: number;
15
+ destPos: number;
16
+ } | null;
17
+ export function grayToRGBA(src: any, dest: any): void;
@@ -0,0 +1,48 @@
1
+ export class MessageHandler {
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
+ on(actionName: any, handler: any): void;
13
+ /**
14
+ * Sends a message to the comObj to invoke the action with the supplied data.
15
+ * @param {string} actionName - Action to call.
16
+ * @param {JSON} data - JSON data to send.
17
+ * @param {Array} [transfers] - List of transfers/ArrayBuffers.
18
+ */
19
+ send(actionName: string, data: JSON, transfers?: any[]): void;
20
+ /**
21
+ * Sends a message to the comObj to invoke the action with the supplied data.
22
+ * Expects that the other side will callback with the response.
23
+ * @param {string} actionName - Action to call.
24
+ * @param {JSON} data - JSON data to send.
25
+ * @param {Array} [transfers] - List of transfers/ArrayBuffers.
26
+ * @returns {Promise} Promise to be resolved with response data.
27
+ */
28
+ sendWithPromise(actionName: string, data: JSON, transfers?: any[]): Promise<any>;
29
+ /**
30
+ * Sends a message to the comObj to invoke the action with the supplied data.
31
+ * Expect that the other side will callback to signal 'start_complete'.
32
+ * @param {string} actionName - Action to call.
33
+ * @param {JSON} data - JSON data to send.
34
+ * @param {Object} queueingStrategy - Strategy to signal backpressure based on
35
+ * internal queue.
36
+ * @param {Array} [transfers] - List of transfers/ArrayBuffers.
37
+ * @returns {ReadableStream} ReadableStream to read data in chunks.
38
+ */
39
+ sendWithStream(actionName: string, data: JSON, queueingStrategy: Object, transfers?: any[]): ReadableStream;
40
+ destroy(): void;
41
+ #private;
42
+ }
43
+ export function wrapReason(ex: any): AbortException | InvalidPDFException | PasswordException | ResponseException | UnknownErrorException;
44
+ import { AbortException } from "./util.js";
45
+ import { InvalidPDFException } from "./util.js";
46
+ import { PasswordException } from "./util.js";
47
+ import { ResponseException } from "./util.js";
48
+ import { UnknownErrorException } from "./util.js";
@@ -0,0 +1,7 @@
1
+ export class MurmurHash3_64 {
2
+ constructor(seed: any);
3
+ h1: number;
4
+ h2: number;
5
+ update(input: any): void;
6
+ hexdigest(): string;
7
+ }