pdfjs-serverless 1.0.1 → 1.2.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 (86) hide show
  1. package/README.md +14 -44
  2. package/dist/index.d.mts +1 -1
  3. package/dist/index.mjs +1 -1
  4. package/dist/types/src/display/annotation_layer.d.ts +49 -16
  5. package/dist/types/src/display/annotation_storage.d.ts +10 -8
  6. package/dist/types/src/display/api.d.ts +134 -126
  7. package/dist/types/src/display/api_utils.d.ts +13 -0
  8. package/dist/types/src/display/binary_data_factory.d.ts +26 -0
  9. package/dist/types/src/display/canvas.d.ts +97 -92
  10. package/dist/types/src/display/canvas_dependency_tracker.d.ts +216 -0
  11. package/dist/types/src/display/canvas_factory.d.ts +3 -1
  12. package/dist/types/src/display/display_utils.d.ts +27 -3
  13. package/dist/types/src/display/draw_layer.d.ts +2 -6
  14. package/dist/types/src/display/editor/alt_text.d.ts +1 -1
  15. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +16 -19
  16. package/dist/types/src/display/editor/color_picker.d.ts +20 -1
  17. package/dist/types/src/display/editor/comment.d.ts +59 -0
  18. package/dist/types/src/display/editor/draw.d.ts +4 -8
  19. package/dist/types/src/display/editor/drawers/freedraw.d.ts +4 -3
  20. package/dist/types/src/display/editor/drawers/highlight.d.ts +2 -1
  21. package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +13 -13
  22. package/dist/types/src/display/editor/editor.d.ts +119 -15
  23. package/dist/types/src/display/editor/freetext.d.ts +11 -7
  24. package/dist/types/src/display/editor/highlight.d.ts +8 -3
  25. package/dist/types/src/display/editor/ink.d.ts +5 -0
  26. package/dist/types/src/display/editor/signature.d.ts +2 -5
  27. package/dist/types/src/display/editor/stamp.d.ts +3 -1
  28. package/dist/types/src/display/editor/toolbar.d.ts +8 -3
  29. package/dist/types/src/display/editor/tools.d.ts +72 -6
  30. package/dist/types/src/display/fetch_stream.d.ts +3 -56
  31. package/dist/types/src/display/font_loader.d.ts +28 -1
  32. package/dist/types/src/display/network.d.ts +14 -80
  33. package/dist/types/src/display/network_stream.d.ts +2 -0
  34. package/dist/types/src/display/network_utils.d.ts +3 -3
  35. package/dist/types/src/display/node_stream.d.ts +2 -52
  36. package/dist/types/src/display/node_utils.d.ts +5 -19
  37. package/dist/types/src/display/obj_bin_transform_display.d.ts +67 -0
  38. package/dist/types/src/display/pages_mapper.d.ts +72 -0
  39. package/dist/types/src/display/pattern_helper.d.ts +9 -4
  40. package/dist/types/src/display/pdf_objects.d.ts +40 -0
  41. package/dist/types/src/display/text_layer.d.ts +16 -10
  42. package/dist/types/src/display/text_layer_images.d.ts +10 -0
  43. package/dist/types/src/display/transport_stream.d.ts +8 -64
  44. package/dist/types/src/display/webgpu_mesh.d.ts +3 -0
  45. package/dist/types/src/display/worker_options.d.ts +2 -2
  46. package/dist/types/src/display/xfa_layer.d.ts +3 -3
  47. package/dist/types/src/pdf.d.ts +11 -2
  48. package/dist/types/src/{interfaces.d.ts → shared/base_pdf_stream.d.ts} +26 -27
  49. package/dist/types/src/shared/obj_bin_transform_utils.d.ts +26 -0
  50. package/dist/types/src/shared/scripting_utils.d.ts +2 -0
  51. package/dist/types/src/shared/util.d.ts +21 -8
  52. package/dist/types/web/annotation_editor_layer_builder.d.ts +7 -8
  53. package/dist/types/web/annotation_layer_builder.d.ts +18 -23
  54. package/dist/types/web/app_options.d.ts +1 -1
  55. package/dist/types/web/autolinker.d.ts +3 -2
  56. package/dist/types/web/base_download_manager.d.ts +24 -0
  57. package/dist/types/web/base_pdf_page_view.d.ts +7 -6
  58. package/dist/types/web/comment_manager.d.ts +20 -0
  59. package/dist/types/web/download_manager.d.ts +3 -12
  60. package/dist/types/web/draw_layer_builder.d.ts +0 -12
  61. package/dist/types/web/event_utils.d.ts +1 -1
  62. package/dist/types/web/genericl10n.d.ts +6 -10
  63. package/dist/types/web/l10n.d.ts +3 -6
  64. package/dist/types/web/menu.d.ts +11 -0
  65. package/dist/types/web/pdf_find_controller.d.ts +10 -12
  66. package/dist/types/web/pdf_history.d.ts +3 -3
  67. package/dist/types/web/pdf_link_service.d.ts +10 -7
  68. package/dist/types/web/pdf_page_detail_view.d.ts +2 -7
  69. package/dist/types/web/pdf_page_view.d.ts +39 -17
  70. package/dist/types/web/pdf_rendering_queue.d.ts +10 -14
  71. package/dist/types/web/pdf_thumbnail_view.d.ts +18 -50
  72. package/dist/types/web/pdf_thumbnail_viewer.d.ts +57 -13
  73. package/dist/types/web/pdf_viewer.component.d.ts +1 -1
  74. package/dist/types/web/pdf_viewer.d.ts +95 -29
  75. package/dist/types/web/renderable_view.d.ts +33 -0
  76. package/dist/types/web/sidebar.d.ts +65 -0
  77. package/dist/types/web/struct_tree_layer_builder.d.ts +1 -1
  78. package/dist/types/web/text_accessibility.d.ts +1 -1
  79. package/dist/types/web/text_layer_builder.d.ts +11 -6
  80. package/dist/types/web/ui_utils.d.ts +3 -11
  81. package/dist/types/web/xfa_layer_builder.d.ts +4 -4
  82. package/package.json +18 -15
  83. package/dist/types/src/display/cmap_reader_factory.d.ts +0 -25
  84. package/dist/types/src/display/standard_fontdata_factory.d.ts +0 -20
  85. package/dist/types/src/display/wasm_factory.d.ts +0 -20
  86. package/dist/types/web/interfaces.d.ts +0 -167
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Maps between page IDs and page numbers, allowing bidirectional conversion
3
+ * between the two representations. This is useful when the page numbering
4
+ * in the PDF document doesn't match the default sequential ordering.
5
+ *
6
+ * When #pageNumberToId is null the mapping is the identity (page N has ID N).
7
+ */
8
+ export class PagesMapper {
9
+ set pagesNumber(n: number);
10
+ get pagesNumber(): number;
11
+ /**
12
+ * Move a set of pages to a new position.
13
+ *
14
+ * @param {Set<number>} selectedPages - Page numbers being moved (1-indexed).
15
+ * @param {number[]} pagesToMove - Ordered list of page numbers to move.
16
+ * @param {number} index - Zero-based insertion index in the page-number list.
17
+ */
18
+ movePages(selectedPages: Set<number>, pagesToMove: number[], index: number): void;
19
+ /**
20
+ * Deletes a set of pages.
21
+ * @param {Array<number>} pagesToDelete - Page numbers to delete (1-indexed),
22
+ * unique and sorted ascending.
23
+ */
24
+ deletePages(pagesToDelete: Array<number>): void;
25
+ cancelDelete(): void;
26
+ cleanSavedData(): void;
27
+ /**
28
+ * Records which pages are being copied so that pastePages can insert them.
29
+ * @param {Uint32Array} pagesToCopy - Page numbers to copy (1-indexed).
30
+ */
31
+ copyPages(pagesToCopy: Uint32Array): void;
32
+ cancelCopy(): void;
33
+ /**
34
+ * Inserts the previously copied pages at the given position.
35
+ * @param {number} index - Zero-based insertion index in the page-number list.
36
+ */
37
+ pastePages(index: number): void;
38
+ /**
39
+ * Checks if the page mappings have been altered from their initial state.
40
+ * @returns {boolean}
41
+ */
42
+ hasBeenAltered(): boolean;
43
+ /**
44
+ * Gets the current page mapping suitable for saving.
45
+ * @param {Map<number, Array<number>>} [idToPageNumber]
46
+ * @returns {Array<Object>}
47
+ */
48
+ getPageMappingForSaving(idToPageNumber?: Map<number, Array<number>>): Array<Object>;
49
+ extractPages(extractedPageNumbers: any): Object[];
50
+ /**
51
+ * Gets the previous page number for a given page number.
52
+ * Negative values indicate a copied page (the absolute value is the source).
53
+ * @param {number} pageNumber
54
+ * @returns {number}
55
+ */
56
+ getPrevPageNumber(pageNumber: number): number;
57
+ /**
58
+ * Gets the first page number that currently maps to the given page ID.
59
+ * @param {number} id - The page ID (1-indexed).
60
+ * @returns {number} The page number, or 0 if not found.
61
+ */
62
+ getPageNumber(id: number): number;
63
+ /**
64
+ * Gets the page ID for a given page number.
65
+ * @param {number} pageNumber - The page number (1-indexed).
66
+ * @returns {number} The page ID, or the page number itself if no mapping
67
+ * exists.
68
+ */
69
+ getPageId(pageNumber: number): number;
70
+ getMapping(): Uint32Array<ArrayBufferLike> | undefined;
71
+ #private;
72
+ }
@@ -18,8 +18,9 @@ export class TilingPattern {
18
18
  ctx: any;
19
19
  canvasGraphicsFactory: any;
20
20
  baseTransform: any;
21
- createPatternCanvas(owner: any): {
21
+ createPatternCanvas(owner: any, opIdx: any): {
22
22
  canvas: any;
23
+ canvasEntry: any;
23
24
  scaleX: any;
24
25
  scaleY: any;
25
26
  offsetX: any;
@@ -32,7 +33,7 @@ export class TilingPattern {
32
33
  clipBbox(graphics: any, x0: any, y0: any, x1: any, y1: any): void;
33
34
  setFillAndStrokeStyleToContext(graphics: any, paintType: any, color: any): void;
34
35
  isModifyingCurrentTransform(): boolean;
35
- getPattern(ctx: any, owner: any, inverse: any, pathType: any): any;
36
+ getPattern(ctx: any, owner: any, inverse: any, pathType: any, opIdx: any): any;
36
37
  }
37
38
  declare class RadialAxialShadingPattern extends BaseShadingPattern {
38
39
  constructor(IR: any);
@@ -44,7 +45,11 @@ declare class RadialAxialShadingPattern extends BaseShadingPattern {
44
45
  _r0: any;
45
46
  _r1: any;
46
47
  matrix: any;
47
- _createGradient(ctx: any): any;
48
+ isOriginBased(): boolean;
49
+ isRadial(): boolean;
50
+ _isCircleCenterOutside(): boolean;
51
+ _createGradient(ctx: any, transform?: null): any;
52
+ _createReversedGradient(ctx: any, transform?: null): any;
48
53
  getPattern(ctx: any, owner: any, inverse: any, pathType: any): any;
49
54
  }
50
55
  declare class MeshShadingPattern extends BaseShadingPattern {
@@ -56,7 +61,7 @@ declare class MeshShadingPattern extends BaseShadingPattern {
56
61
  _bbox: any;
57
62
  _background: any;
58
63
  matrix: any;
59
- _createMeshCanvas(combinedScale: any, backgroundColor: any, cachedCanvases: any): {
64
+ _createMeshCanvas(combinedScale: any, backgroundColor: any, canvasFactory: any): {
60
65
  canvas: any;
61
66
  offsetX: number;
62
67
  offsetY: number;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * A PDF document and page is built of many objects. E.g. there are objects for
3
+ * fonts, images, rendering code, etc. These objects may get processed inside of
4
+ * a worker. This class implements some basic methods to manage these objects.
5
+ */
6
+ export class PDFObjects {
7
+ /**
8
+ * If called *without* callback, this returns the data of `objId` but the
9
+ * object needs to be resolved. If it isn't, this method throws.
10
+ *
11
+ * If called *with* a callback, the callback is called with the data of the
12
+ * object once the object is resolved. That means, if you call this method
13
+ * and the object is already resolved, the callback gets called right away.
14
+ *
15
+ * @param {string} objId
16
+ * @param {function} [callback]
17
+ * @returns {any}
18
+ */
19
+ get(objId: string, callback?: Function): any;
20
+ /**
21
+ * @param {string} objId
22
+ * @returns {boolean}
23
+ */
24
+ has(objId: string): boolean;
25
+ /**
26
+ * @param {string} objId
27
+ * @returns {boolean}
28
+ */
29
+ delete(objId: string): boolean;
30
+ /**
31
+ * Resolves the object `objId` with optional `data`.
32
+ *
33
+ * @param {string} objId
34
+ * @param {any} [data]
35
+ */
36
+ resolve(objId: string, data?: any): void;
37
+ clear(): void;
38
+ [Symbol.iterator](): Generator<any[], void, unknown>;
39
+ #private;
40
+ }
@@ -1,5 +1,6 @@
1
1
  export type PageViewport = import("./display_utils").PageViewport;
2
2
  export type TextContent = import("./api").TextContent;
3
+ export type TextLayerImages = import("./text_layer_images").TextLayerImages;
3
4
  export type TextLayerParameters = {
4
5
  /**
5
6
  * - Text content to
@@ -17,6 +18,11 @@ export type TextLayerParameters = {
17
18
  * the text runs.
18
19
  */
19
20
  viewport: PageViewport;
21
+ /**
22
+ * - An optional TextLayerImages instance
23
+ * that handles right clicking on images.
24
+ */
25
+ images?: import("./text_layer_images").TextLayerImages | undefined;
20
26
  };
21
27
  export type TextLayerUpdateParameters = {
22
28
  /**
@@ -31,28 +37,28 @@ export type TextLayerUpdateParameters = {
31
37
  onBefore?: Function | undefined;
32
38
  };
33
39
  export class TextLayer {
34
- static "__#54@#ascentCache": Map<any, any>;
35
- static "__#54@#canvasContexts": Map<any, any>;
36
- static "__#54@#canvasCtxFonts": WeakMap<object, any>;
37
- static "__#54@#minFontSize": null;
38
- static "__#54@#pendingTextLayers": Set<any>;
40
+ static "__#private@#ascentCache": Map<any, any>;
41
+ static "__#private@#canvasContexts": Map<any, any>;
42
+ static "__#private@#canvasCtxFonts": WeakMap<object, any>;
43
+ static "__#private@#minFontSize": null;
44
+ static "__#private@#pendingTextLayers": Set<any>;
39
45
  static get fontFamilyMap(): any;
40
46
  /**
41
47
  * Clean-up global textLayer data.
42
48
  * @returns {undefined}
43
49
  */
44
50
  static cleanup(): undefined;
45
- static "__#54@#getCtx"(lang?: null): any;
46
- static "__#54@#ensureCtxFont"(ctx: any, size: any, family: any): void;
51
+ static "__#private@#getCtx"(lang?: null): any;
52
+ static "__#private@#ensureCtxFont"(ctx: any, size: any, family: any): void;
47
53
  /**
48
54
  * Compute the minimum font size enforced by the browser.
49
55
  */
50
- static "__#54@#ensureMinFontSizeComputed"(): void;
51
- static "__#54@#getAscent"(fontFamily: any, style: any, lang: any): any;
56
+ static "__#private@#ensureMinFontSizeComputed"(): void;
57
+ static "__#private@#getAscent"(fontFamily: any, style: any, lang: any): any;
52
58
  /**
53
59
  * @param {TextLayerParameters} options
54
60
  */
55
- constructor({ textContentSource, container, viewport }: TextLayerParameters);
61
+ constructor({ textContentSource, images, container, viewport }: TextLayerParameters);
56
62
  /**
57
63
  * Render the textLayer.
58
64
  * @returns {Promise}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Used to manage paceholder <canvas> elements that, when right-clicked on,
3
+ * are populated with the corresponding image extracted from the PDF page.
4
+ */
5
+ export class TextLayerImages {
6
+ static "__#private@#activeImage": null;
7
+ constructor(minSize: any, coordinates: any, viewport: any, getPageCanvas: any);
8
+ render(): HTMLDivElement;
9
+ #private;
10
+ }
@@ -1,67 +1,11 @@
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
- });
1
+ export function endRequests(): void;
2
+ export class PDFDataTransportStream extends BasePDFStream {
3
+ constructor(source: any);
4
+ _progressiveDone: boolean;
10
5
  _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;
6
+ getRangeReader(begin: any, end: any): BasePDFStreamRangeReader;
29
7
  cancelAllRequests(reason: any): void;
8
+ #private;
30
9
  }
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 {};
10
+ import { BasePDFStream } from "../shared/base_pdf_stream.js";
11
+ import { BasePDFStreamRangeReader } from "../shared/base_pdf_stream.js";
@@ -0,0 +1,3 @@
1
+ export function drawMeshWithGPU(figures: any, context: any, backgroundColor: any, paddedWidth: any, paddedHeight: any, borderSize: any): ImageBitmap;
2
+ export function initWebGPUMesh(): void;
3
+ export function isWebGPUMeshReady(): boolean;
@@ -1,6 +1,6 @@
1
1
  export class GlobalWorkerOptions {
2
- static "__#50@#port": null;
3
- static "__#50@#src": string;
2
+ static "__#private@#port": null;
3
+ static "__#private@#src": string;
4
4
  /**
5
5
  * @param {Worker | null} workerPort - Defines global port for worker process.
6
6
  * Overrides the `workerSrc` option.
@@ -1,12 +1,12 @@
1
1
  export type AnnotationStorage = import("./annotation_storage").AnnotationStorage;
2
2
  export type PageViewport = import("./display_utils").PageViewport;
3
- export type IPDFLinkService = import("../../web/interfaces").IPDFLinkService;
3
+ export type PDFLinkService = import("../../web/pdf_link_service.js").PDFLinkService;
4
4
  export type XfaLayerParameters = {
5
5
  viewport: PageViewport;
6
6
  div: HTMLDivElement;
7
7
  xfaHtml: Object;
8
8
  annotationStorage?: import("./annotation_storage").AnnotationStorage | undefined;
9
- linkService: IPDFLinkService;
9
+ linkService: PDFLinkService;
10
10
  /**
11
11
  * - (default value is 'display').
12
12
  */
@@ -18,7 +18,7 @@ export type XfaLayerParameters = {
18
18
  * @property {HTMLDivElement} div
19
19
  * @property {Object} xfaHtml
20
20
  * @property {AnnotationStorage} [annotationStorage]
21
- * @property {IPDFLinkService} linkService
21
+ * @property {PDFLinkService} linkService
22
22
  * @property {string} [intent] - (default value is 'display').
23
23
  */
24
24
  export class XfaLayer {
@@ -12,16 +12,20 @@ import { AnnotationEditorUIManager } from "./display/editor/tools.js";
12
12
  import { AnnotationLayer } from "./display/annotation_layer.js";
13
13
  import { AnnotationMode } from "./shared/util.js";
14
14
  import { AnnotationType } from "./shared/util.js";
15
+ import { applyOpacity } from "./display/display_utils.js";
15
16
  import { build } from "./display/api.js";
16
17
  import { ColorPicker } from "./display/editor/color_picker.js";
17
18
  import { createValidAbsoluteUrl } from "./shared/util.js";
19
+ import { CSSConstants } from "./display/display_utils.js";
18
20
  import { DOMSVGFactory } from "./display/svg_factory.js";
19
21
  import { DrawLayer } from "./display/draw_layer.js";
20
22
  import { FeatureTest } from "./shared/util.js";
21
23
  import { fetchData } from "./display/display_utils.js";
24
+ import { findContrastColor } from "./display/display_utils.js";
22
25
  import { getDocument } from "./display/api.js";
23
26
  import { getFilenameFromUrl } from "./display/display_utils.js";
24
27
  import { getPdfFilenameFromUrl } from "./display/display_utils.js";
28
+ import { getRGB } from "./display/display_utils.js";
25
29
  import { getUuid } from "./shared/util.js";
26
30
  import { getXfaPageViewport } from "./display/display_utils.js";
27
31
  import { GlobalWorkerOptions } from "./display/worker_options.js";
@@ -29,7 +33,10 @@ import { ImageKind } from "./shared/util.js";
29
33
  import { InvalidPDFException } from "./shared/util.js";
30
34
  import { isDataScheme } from "./display/display_utils.js";
31
35
  import { isPdfFile } from "./display/display_utils.js";
32
- import { isValidExplicitDest } from "./display/api.js";
36
+ import { isValidExplicitDest } from "./display/api_utils.js";
37
+ import { makeArr } from "./shared/util.js";
38
+ import { makeMap } from "./shared/util.js";
39
+ import { makeObj } from "./shared/util.js";
33
40
  import { MathClamp } from "./shared/util.js";
34
41
  import { noContextMenu } from "./display/display_utils.js";
35
42
  import { normalizeUnicode } from "./shared/util.js";
@@ -42,6 +49,7 @@ import { PDFWorker } from "./display/api.js";
42
49
  import { PermissionFlag } from "./shared/util.js";
43
50
  import { PixelsPerInch } from "./display/display_utils.js";
44
51
  import { RenderingCancelledException } from "./display/display_utils.js";
52
+ import { renderRichText } from "./display/display_utils.js";
45
53
  import { ResponseException } from "./shared/util.js";
46
54
  import { setLayerDimensions } from "./display/display_utils.js";
47
55
  import { shadow } from "./shared/util.js";
@@ -49,10 +57,11 @@ import { SignatureExtractor } from "./display/editor/drawers/signaturedraw.js";
49
57
  import { stopEvent } from "./display/display_utils.js";
50
58
  import { SupportedImageMimeTypes } from "./display/display_utils.js";
51
59
  import { TextLayer } from "./display/text_layer.js";
60
+ import { TextLayerImages } from "./display/text_layer_images.js";
52
61
  import { TouchManager } from "./display/touch_manager.js";
53
62
  import { updateUrlHash } from "./shared/util.js";
54
63
  import { Util } from "./shared/util.js";
55
64
  import { VerbosityLevel } from "./shared/util.js";
56
65
  import { version } from "./display/api.js";
57
66
  import { XfaLayer } from "./display/xfa_layer.js";
58
- 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, isValidExplicitDest, MathClamp, noContextMenu, normalizeUnicode, OPS, OutputScale, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, ResponseException, setLayerDimensions, shadow, SignatureExtractor, stopEvent, SupportedImageMimeTypes, TextLayer, TouchManager, updateUrlHash, Util, VerbosityLevel, version, XfaLayer };
67
+ export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, AnnotationType, applyOpacity, build, ColorPicker, createValidAbsoluteUrl, CSSConstants, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, findContrastColor, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getRGB, getUuid, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, isValidExplicitDest, makeArr, makeMap, makeObj, MathClamp, noContextMenu, normalizeUnicode, OPS, OutputScale, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, renderRichText, ResponseException, setLayerDimensions, shadow, SignatureExtractor, stopEvent, SupportedImageMimeTypes, TextLayer, TextLayerImages, TouchManager, updateUrlHash, Util, VerbosityLevel, version, XfaLayer };
@@ -1,50 +1,42 @@
1
1
  /**
2
2
  * Interface that represents PDF data transport. If possible, it allows
3
3
  * progressively load entire or fragment of the PDF binary data.
4
- *
5
- * @interface
6
4
  */
7
- export class IPDFStream {
5
+ export class BasePDFStream {
6
+ constructor(source: any, PDFStreamReader: any, PDFStreamRangeReader: any);
7
+ _fullReader: null;
8
+ _rangeReaders: Set<any>;
9
+ _source: null;
10
+ get _progressiveDataLength(): any;
8
11
  /**
9
12
  * Gets a reader for the entire PDF data.
10
- * @returns {IPDFStreamReader}
13
+ * @returns {BasePDFStreamReader}
11
14
  */
12
- getFullReader(): IPDFStreamReader;
15
+ getFullReader(): BasePDFStreamReader;
13
16
  /**
14
17
  * Gets a reader for the range of the PDF data.
15
18
  *
16
19
  * NOTE: Currently this method is only expected to be invoked *after*
17
- * the `IPDFStreamReader.prototype.headersReady` promise has resolved.
20
+ * the `BasePDFStreamReader.prototype.headersReady` promise has resolved.
18
21
  *
19
22
  * @param {number} begin - the start offset of the data.
20
23
  * @param {number} end - the end offset of the data.
21
- * @returns {IPDFStreamRangeReader}
24
+ * @returns {BasePDFStreamRangeReader}
22
25
  */
23
- getRangeReader(begin: number, end: number): IPDFStreamRangeReader;
26
+ getRangeReader(begin: number, end: number): BasePDFStreamRangeReader;
24
27
  /**
25
28
  * Cancels all opened reader and closes all their opened requests.
26
29
  * @param {Object} reason - the reason for cancelling
27
30
  */
28
31
  cancelAllRequests(reason: Object): void;
32
+ #private;
29
33
  }
30
34
  /**
31
35
  * Interface for a PDF binary data fragment reader.
32
- *
33
- * @interface
34
36
  */
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;
37
+ export class BasePDFStreamRangeReader {
38
+ constructor(stream: any, begin: any, end: any);
39
+ _stream: null;
48
40
  /**
49
41
  * Requests a chunk of the binary data. The method returns the promise, which
50
42
  * is resolved into object with properties "value" and "done". If the done
@@ -62,17 +54,24 @@ export class IPDFStreamRangeReader {
62
54
  }
63
55
  /**
64
56
  * Interface for a PDF binary data reader.
65
- *
66
- * @interface
67
57
  */
68
- export class IPDFStreamReader {
58
+ export class BasePDFStreamReader {
59
+ constructor(stream: any);
69
60
  /**
70
61
  * Sets or gets the progress callback. The callback can be useful when the
71
62
  * isStreamingSupported property of the object is defined as false.
72
63
  * The callback is called with one parameter: an object with the loaded and
73
64
  * total properties.
74
65
  */
75
- onProgress: any;
66
+ onProgress: null;
67
+ _contentLength: number;
68
+ _filename: null;
69
+ _headersCapability: any;
70
+ _isRangeSupported: boolean;
71
+ _isStreamingSupported: boolean;
72
+ _loaded: number;
73
+ _stream: null;
74
+ _callOnProgress(): void;
76
75
  /**
77
76
  * Gets a promise that is resolved when the headers and other metadata of
78
77
  * the PDF data stream are available.
@@ -0,0 +1,26 @@
1
+ export class CSS_FONT_INFO {
2
+ static strings: string[];
3
+ }
4
+ export class FONT_INFO {
5
+ static bools: string[];
6
+ static numbers: string[];
7
+ static strings: string[];
8
+ static OFFSET_NUMBERS: number;
9
+ static OFFSET_BBOX: number;
10
+ static OFFSET_FONT_MATRIX: number;
11
+ static OFFSET_DEFAULT_VMETRICS: number;
12
+ static OFFSET_STRINGS: number;
13
+ }
14
+ export class PATTERN_INFO {
15
+ static KIND: number;
16
+ static HAS_BBOX: number;
17
+ static HAS_BACKGROUND: number;
18
+ static SHADING_TYPE: number;
19
+ static N_COORD: number;
20
+ static N_COLOR: number;
21
+ static N_STOP: number;
22
+ static N_FIGURES: number;
23
+ }
24
+ export class SYSTEM_FONT_INFO {
25
+ static strings: string[];
26
+ }
@@ -14,3 +14,5 @@ export class ColorConverters {
14
14
  static CMYK_HTML(components: any): string;
15
15
  static RGB_CMYK([r, g, b]: [any, any, any]): (string | number)[];
16
16
  }
17
+ export const DateFormats: string[];
18
+ export const TimeFormats: string[];
@@ -40,7 +40,6 @@ export namespace AnnotationEditorParamsType {
40
40
  let INK_THICKNESS: number;
41
41
  let INK_OPACITY: number;
42
42
  let HIGHLIGHT_COLOR: number;
43
- let HIGHLIGHT_DEFAULT_COLOR: number;
44
43
  let HIGHLIGHT_THICKNESS: number;
45
44
  let HIGHLIGHT_FREE: number;
46
45
  let HIGHLIGHT_SHOW_ALL: number;
@@ -54,7 +53,9 @@ export namespace AnnotationEditorType {
54
53
  let HIGHLIGHT: number;
55
54
  let STAMP: number;
56
55
  let INK: number;
56
+ let POPUP: number;
57
57
  let SIGNATURE: number;
58
+ let COMMENT: number;
58
59
  }
59
60
  export namespace AnnotationFieldFlag {
60
61
  let READONLY: number;
@@ -123,7 +124,8 @@ export namespace AnnotationType {
123
124
  export let CARET: number;
124
125
  let INK_1: number;
125
126
  export { INK_1 as INK };
126
- export let POPUP: number;
127
+ let POPUP_1: number;
128
+ export { POPUP_1 as POPUP };
127
129
  export let FILEATTACHMENT: number;
128
130
  export let SOUND: number;
129
131
  export let MOVIE: number;
@@ -162,6 +164,7 @@ export namespace DrawOPS {
162
164
  let moveTo: number;
163
165
  let lineTo: number;
164
166
  let curveTo: number;
167
+ let quadraticCurveTo: number;
165
168
  let closePath: number;
166
169
  }
167
170
  export class FeatureTest {
@@ -169,6 +172,8 @@ export class FeatureTest {
169
172
  static get isEvalSupported(): any;
170
173
  static get isOffscreenCanvasSupported(): any;
171
174
  static get isImageDecoderSupported(): any;
175
+ static get isFloat16ArraySupported(): any;
176
+ static get isSanitizerSupported(): any;
172
177
  static get platform(): any;
173
178
  static get isCSSRoundSupported(): any;
174
179
  }
@@ -181,7 +186,6 @@ export class FormatError extends FormatError_base {
181
186
  [x: string]: any;
182
187
  constructor(msg: any);
183
188
  }
184
- export function fromBase64Util(str: any): any;
185
189
  export function getModificationDate(date?: Date): string;
186
190
  export function getUuid(): string;
187
191
  export function getVerbosityLevel(): number;
@@ -201,7 +205,15 @@ export function isArrayEqual(arr1: any, arr2: any): boolean;
201
205
  export const isNodeJS: any;
202
206
  export const LINE_DESCENT_FACTOR: 0.35;
203
207
  export const LINE_FACTOR: 1.35;
208
+ export function makeArr(): never[];
209
+ export function makeMap(): Map<any, any>;
210
+ export function makeObj(): any;
204
211
  export function MathClamp(v: any, min: any, max: any): number;
212
+ export namespace MeshFigureType {
213
+ let TRIANGLES: number;
214
+ let LATTICE: number;
215
+ let PATCH: number;
216
+ }
205
217
  export function normalizeUnicode(str: any): any;
206
218
  export function objectSize(obj: any): number;
207
219
  export namespace OPS {
@@ -350,8 +362,9 @@ export function setVerbosityLevel(level: any): void;
350
362
  export function shadow(obj: any, prop: any, value: any, nonSerializable?: boolean): any;
351
363
  export function string32(value: any): string;
352
364
  export function stringToBytes(str: any): Uint8Array<any>;
353
- export function stringToPDFString(str: any): string;
365
+ export function stringToPDFString(str: any, keepEscapeSequence?: boolean): string;
354
366
  export function stringToUTF8String(str: any): string;
367
+ export function stripPath(str: any): any;
355
368
  export namespace TextRenderingMode {
356
369
  export let FILL: number;
357
370
  export let STROKE: number;
@@ -365,8 +378,6 @@ export namespace TextRenderingMode {
365
378
  export let FILL_STROKE_MASK: number;
366
379
  export let ADD_TO_PATH_FLAG: number;
367
380
  }
368
- export function toBase64Util(arr: any): any;
369
- export function toHexUtil(arr: any): any;
370
381
  declare const UnknownErrorException_base: any;
371
382
  export class UnknownErrorException extends UnknownErrorException_base {
372
383
  [x: string]: any;
@@ -386,8 +397,10 @@ export function updateUrlHash(url: URL | string, hash: string, allowRel?: boolea
386
397
  export function utf8StringToString(str: any): string;
387
398
  export class Util {
388
399
  static makeHexColor(r: any, g: any, b: any): string;
400
+ static domMatrixToTransform(dm: any): any[];
389
401
  static scaleMinMax(transform: any, minMax: any): void;
390
402
  static transform(m1: any, m2: any): any[];
403
+ static multiplyByDOMMatrix(m: any, md: any): any[];
391
404
  static applyTransform(p: any, m: any, pos?: number): void;
392
405
  static applyTransformToBezier(p: any, transform: any, pos?: number): void;
393
406
  static applyInverseTransform(p: any, m: any): void;
@@ -398,8 +411,8 @@ export class Util {
398
411
  static intersect(rect1: any, rect2: any): number[] | null;
399
412
  static pointBoundingBox(x: any, y: any, minMax: any): void;
400
413
  static rectBoundingBox(x0: any, y0: any, x1: any, y1: any, minMax: any): void;
401
- static "__#1@#getExtremumOnCurve"(x0: any, x1: any, x2: any, x3: any, y0: any, y1: any, y2: any, y3: any, t: any, minMax: any): void;
402
- static "__#1@#getExtremum"(x0: any, x1: any, x2: any, x3: any, y0: any, y1: any, y2: any, y3: any, a: any, b: any, c: any, minMax: any): void;
414
+ static "__#private@#getExtremumOnCurve"(x0: any, x1: any, x2: any, x3: any, y0: any, y1: any, y2: any, y3: any, t: any, minMax: any): void;
415
+ static "__#private@#getExtremum"(x0: any, x1: any, x2: any, x3: any, y0: any, y1: any, y2: any, y3: any, a: any, b: any, c: any, minMax: any): void;
403
416
  static bezierBoundingBox(x0: any, y0: any, x1: any, y1: any, x2: any, y2: any, x3: any, y3: any, minMax: any): void;
404
417
  }
405
418
  export namespace VerbosityLevel {