unpdf 1.3.2 → 1.5.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 (84) hide show
  1. package/README.md +22 -38
  2. package/dist/index.d.cts +1 -1
  3. package/dist/index.d.mts +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/pdfjs.mjs +107 -1
  6. package/dist/types/src/display/annotation_layer.d.ts +42 -17
  7. package/dist/types/src/display/annotation_storage.d.ts +10 -8
  8. package/dist/types/src/display/api.d.ts +93 -63
  9. package/dist/types/src/display/api_utils.d.ts +1 -1
  10. package/dist/types/src/display/binary_data_factory.d.ts +26 -0
  11. package/dist/types/src/display/canvas.d.ts +19 -16
  12. package/dist/types/src/display/canvas_dependency_tracker.d.ts +99 -27
  13. package/dist/types/src/display/canvas_factory.d.ts +3 -1
  14. package/dist/types/src/display/display_utils.d.ts +25 -2
  15. package/dist/types/src/display/draw_layer.d.ts +2 -6
  16. package/dist/types/src/display/editor/alt_text.d.ts +1 -1
  17. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +11 -14
  18. package/dist/types/src/display/editor/color_picker.d.ts +2 -2
  19. package/dist/types/src/display/editor/comment.d.ts +32 -5
  20. package/dist/types/src/display/editor/draw.d.ts +3 -7
  21. package/dist/types/src/display/editor/drawers/freedraw.d.ts +4 -3
  22. package/dist/types/src/display/editor/drawers/highlight.d.ts +2 -1
  23. package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +13 -13
  24. package/dist/types/src/display/editor/editor.d.ts +81 -26
  25. package/dist/types/src/display/editor/freetext.d.ts +3 -3
  26. package/dist/types/src/display/editor/highlight.d.ts +6 -4
  27. package/dist/types/src/display/editor/ink.d.ts +2 -1
  28. package/dist/types/src/display/editor/signature.d.ts +0 -5
  29. package/dist/types/src/display/editor/toolbar.d.ts +5 -3
  30. package/dist/types/src/display/editor/tools.d.ts +58 -4
  31. package/dist/types/src/display/fetch_stream.d.ts +3 -56
  32. package/dist/types/src/display/font_loader.d.ts +28 -1
  33. package/dist/types/src/display/network.d.ts +14 -80
  34. package/dist/types/src/display/network_stream.d.ts +2 -0
  35. package/dist/types/src/display/network_utils.d.ts +3 -3
  36. package/dist/types/src/display/node_stream.d.ts +2 -52
  37. package/dist/types/src/display/node_utils.d.ts +5 -19
  38. package/dist/types/src/display/obj_bin_transform_display.d.ts +67 -0
  39. package/dist/types/src/display/pages_mapper.d.ts +72 -0
  40. package/dist/types/src/display/pattern_helper.d.ts +9 -4
  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 +9 -1
  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/util.d.ts +14 -5
  51. package/dist/types/web/annotation_editor_layer_builder.d.ts +7 -8
  52. package/dist/types/web/annotation_layer_builder.d.ts +15 -23
  53. package/dist/types/web/app_options.d.ts +1 -1
  54. package/dist/types/web/autolinker.d.ts +3 -2
  55. package/dist/types/web/base_download_manager.d.ts +24 -0
  56. package/dist/types/web/base_pdf_page_view.d.ts +6 -6
  57. package/dist/types/web/comment_manager.d.ts +20 -0
  58. package/dist/types/web/download_manager.d.ts +3 -12
  59. package/dist/types/web/draw_layer_builder.d.ts +0 -12
  60. package/dist/types/web/genericl10n.d.ts +6 -10
  61. package/dist/types/web/l10n.d.ts +3 -6
  62. package/dist/types/web/menu.d.ts +11 -0
  63. package/dist/types/web/pdf_find_controller.d.ts +9 -11
  64. package/dist/types/web/pdf_history.d.ts +3 -3
  65. package/dist/types/web/pdf_link_service.d.ts +4 -8
  66. package/dist/types/web/pdf_page_detail_view.d.ts +1 -7
  67. package/dist/types/web/pdf_page_view.d.ts +23 -12
  68. package/dist/types/web/pdf_rendering_queue.d.ts +10 -14
  69. package/dist/types/web/pdf_thumbnail_view.d.ts +18 -42
  70. package/dist/types/web/pdf_thumbnail_viewer.d.ts +57 -13
  71. package/dist/types/web/pdf_viewer.component.d.ts +1 -1
  72. package/dist/types/web/pdf_viewer.d.ts +40 -28
  73. package/dist/types/web/renderable_view.d.ts +33 -0
  74. package/dist/types/web/sidebar.d.ts +65 -0
  75. package/dist/types/web/struct_tree_layer_builder.d.ts +1 -1
  76. package/dist/types/web/text_accessibility.d.ts +1 -1
  77. package/dist/types/web/text_layer_builder.d.ts +11 -6
  78. package/dist/types/web/ui_utils.d.ts +3 -11
  79. package/dist/types/web/xfa_layer_builder.d.ts +4 -4
  80. package/package.json +25 -20
  81. package/dist/types/src/display/cmap_reader_factory.d.ts +0 -25
  82. package/dist/types/src/display/standard_fontdata_factory.d.ts +0 -20
  83. package/dist/types/src/display/wasm_factory.d.ts +0 -20
  84. package/dist/types/web/interfaces.d.ts +0 -174
@@ -0,0 +1,2 @@
1
+ export function getNetworkStream(url: any): typeof PDFNodeStream;
2
+ import { PDFNodeStream } from "./node_stream.js";
@@ -1,5 +1,6 @@
1
1
  export function createHeaders(isHttp: any, httpHeaders: any): Headers;
2
2
  export function createResponseError(status: any, url: any): ResponseException;
3
+ export function ensureResponseOrigin(rangeOrigin: any, origin: any): void;
3
4
  export function extractFilenameFromHeader(responseHeaders: any): string | null;
4
5
  export function getResponseOrigin(url: any): string | null;
5
6
  export function validateRangeRequestCapabilities({ responseHeaders, isHttp, rangeChunkSize, disableRange, }: {
@@ -8,8 +9,7 @@ export function validateRangeRequestCapabilities({ responseHeaders, isHttp, rang
8
9
  rangeChunkSize: any;
9
10
  disableRange: any;
10
11
  }): {
11
- allowRangeRequests: boolean;
12
- suggestedLength: undefined;
12
+ contentLength: number;
13
+ isRangeSupported: boolean;
13
14
  };
14
- export function validateResponseStatus(status: any): boolean;
15
15
  import { ResponseException } from "../shared/util.js";
@@ -1,54 +1,4 @@
1
- export class PDFNodeStream {
1
+ export class PDFNodeStream extends BasePDFStream {
2
2
  constructor(source: any);
3
- source: any;
4
- url: URL;
5
- _fullRequestReader: PDFNodeStreamFsFullReader | null;
6
- _rangeRequestReaders: any[];
7
- get _progressiveDataLength(): number;
8
- getFullReader(): PDFNodeStreamFsFullReader;
9
- getRangeReader(start: any, end: any): PDFNodeStreamFsRangeReader | null;
10
- cancelAllRequests(reason: any): void;
11
3
  }
12
- declare class PDFNodeStreamFsFullReader {
13
- constructor(stream: any);
14
- _url: any;
15
- _done: boolean;
16
- _storedError: any;
17
- onProgress: any;
18
- _contentLength: any;
19
- _loaded: number;
20
- _filename: any;
21
- _disableRange: any;
22
- _rangeChunkSize: any;
23
- _isStreamingSupported: boolean;
24
- _isRangeSupported: boolean;
25
- _readableStream: any;
26
- _readCapability: any;
27
- _headersCapability: any;
28
- get headersReady(): any;
29
- get filename(): any;
30
- get contentLength(): any;
31
- get isRangeSupported(): boolean;
32
- get isStreamingSupported(): boolean;
33
- read(): any;
34
- cancel(reason: any): void;
35
- _error(reason: any): void;
36
- _setReadableStream(readableStream: any): void;
37
- }
38
- declare class PDFNodeStreamFsRangeReader {
39
- constructor(stream: any, start: any, end: any);
40
- _url: any;
41
- _done: boolean;
42
- _storedError: any;
43
- onProgress: any;
44
- _loaded: number;
45
- _readableStream: any;
46
- _readCapability: any;
47
- _isStreamingSupported: boolean;
48
- get isStreamingSupported(): boolean;
49
- read(): any;
50
- cancel(reason: any): void;
51
- _error(reason: any): void;
52
- _setReadableStream(readableStream: any): void;
53
- }
54
- export {};
4
+ import { BasePDFStream } from "../shared/base_pdf_stream.js";
@@ -1,32 +1,18 @@
1
1
  export function fetchData(url: any): Promise<Uint8Array<ArrayBuffer>>;
2
- export class NodeCanvasFactory extends BaseCanvasFactory {
2
+ export class NodeBinaryDataFactory extends BaseBinaryDataFactory {
3
3
  /**
4
4
  * @ignore
5
5
  */
6
- _createCanvas(width: any, height: any): import("@napi-rs/canvas").Canvas;
6
+ _fetch(url: any, kind: any): Promise<Uint8Array<ArrayBuffer>>;
7
7
  }
8
- export class NodeCMapReaderFactory extends BaseCMapReaderFactory {
8
+ export class NodeCanvasFactory extends BaseCanvasFactory {
9
9
  /**
10
10
  * @ignore
11
11
  */
12
- _fetch(url: any): Promise<Uint8Array<ArrayBuffer>>;
12
+ _createCanvas(width: any, height: any): import("@napi-rs/canvas").Canvas;
13
13
  }
14
14
  export class NodeFilterFactory extends BaseFilterFactory {
15
15
  }
16
- export class NodeStandardFontDataFactory extends BaseStandardFontDataFactory {
17
- /**
18
- * @ignore
19
- */
20
- _fetch(url: any): Promise<Uint8Array<ArrayBuffer>>;
21
- }
22
- export class NodeWasmFactory extends BaseWasmFactory {
23
- /**
24
- * @ignore
25
- */
26
- _fetch(url: any): Promise<Uint8Array<ArrayBuffer>>;
27
- }
16
+ import { BaseBinaryDataFactory } from "./binary_data_factory.js";
28
17
  import { BaseCanvasFactory } from "./canvas_factory.js";
29
- import { BaseCMapReaderFactory } from "./cmap_reader_factory.js";
30
18
  import { BaseFilterFactory } from "./filter_factory.js";
31
- import { BaseStandardFontDataFactory } from "./standard_fontdata_factory.js";
32
- import { BaseWasmFactory } from "./wasm_factory.js";
@@ -0,0 +1,67 @@
1
+ export class CssFontInfo {
2
+ constructor(buffer: any);
3
+ get fontFamily(): string;
4
+ get fontWeight(): string;
5
+ get italicAngle(): string;
6
+ #private;
7
+ }
8
+ export class FontInfo {
9
+ constructor({ buffer, extra }: {
10
+ buffer: any;
11
+ extra: any;
12
+ });
13
+ get black(): boolean | undefined;
14
+ get bold(): boolean | undefined;
15
+ get disableFontFace(): boolean | undefined;
16
+ get fontExtraProperties(): boolean | undefined;
17
+ get isInvalidPDFjsFont(): boolean | undefined;
18
+ get isType3Font(): boolean | undefined;
19
+ get italic(): boolean | undefined;
20
+ get missingFile(): boolean | undefined;
21
+ get remeasure(): boolean | undefined;
22
+ get vertical(): boolean | undefined;
23
+ get ascent(): number;
24
+ get defaultWidth(): number;
25
+ get descent(): number;
26
+ get bbox(): any[] | undefined;
27
+ get fontMatrix(): any[] | undefined;
28
+ get defaultVMetrics(): any[] | undefined;
29
+ get fallbackName(): string;
30
+ get loadedName(): string;
31
+ get mimetype(): string;
32
+ get name(): string;
33
+ get data(): Uint8Array<any> | undefined;
34
+ clearData(): void;
35
+ get cssFontInfo(): CssFontInfo | null;
36
+ get systemFontInfo(): SystemFontInfo | null;
37
+ #private;
38
+ }
39
+ export class FontPathInfo {
40
+ constructor(buffer: any);
41
+ get path(): Float32Array<any> | Float16Array<any>;
42
+ #private;
43
+ }
44
+ export class PatternInfo {
45
+ constructor(buffer: any);
46
+ buffer: any;
47
+ view: DataView<any>;
48
+ data: Uint8Array<any>;
49
+ getIR(): (string | number | number[] | Uint8Array<any> | Float32Array<any> | {
50
+ type: number;
51
+ coords: Int32Array<any>;
52
+ colors: Int32Array<any>;
53
+ }[] | null)[] | (string | number | number[] | (string | number)[][] | null)[];
54
+ }
55
+ export class SystemFontInfo {
56
+ constructor(buffer: any);
57
+ get guessFallback(): boolean;
58
+ get css(): string;
59
+ get loadedName(): string;
60
+ get baseFontName(): string;
61
+ get src(): string;
62
+ get style(): {
63
+ style: string;
64
+ weight: string;
65
+ };
66
+ #private;
67
+ }
@@ -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;
@@ -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 #ascentCache: Map<any, any>;
35
- static #canvasContexts: Map<any, any>;
36
- static #canvasCtxFonts: WeakMap<object, any>;
37
- static #minFontSize: null;
38
- static #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 #getCtx(lang?: null): any;
46
- static #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 #ensureMinFontSizeComputed(): void;
51
- static #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 #port: null;
3
- static #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,13 +12,16 @@ 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";
@@ -31,6 +34,9 @@ import { InvalidPDFException } from "./shared/util.js";
31
34
  import { isDataScheme } from "./display/display_utils.js";
32
35
  import { isPdfFile } from "./display/display_utils.js";
33
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";
34
40
  import { MathClamp } from "./shared/util.js";
35
41
  import { noContextMenu } from "./display/display_utils.js";
36
42
  import { normalizeUnicode } from "./shared/util.js";
@@ -43,6 +49,7 @@ import { PDFWorker } from "./display/api.js";
43
49
  import { PermissionFlag } from "./shared/util.js";
44
50
  import { PixelsPerInch } from "./display/display_utils.js";
45
51
  import { RenderingCancelledException } from "./display/display_utils.js";
52
+ import { renderRichText } from "./display/display_utils.js";
46
53
  import { ResponseException } from "./shared/util.js";
47
54
  import { setLayerDimensions } from "./display/display_utils.js";
48
55
  import { shadow } from "./shared/util.js";
@@ -50,10 +57,11 @@ import { SignatureExtractor } from "./display/editor/drawers/signaturedraw.js";
50
57
  import { stopEvent } from "./display/display_utils.js";
51
58
  import { SupportedImageMimeTypes } from "./display/display_utils.js";
52
59
  import { TextLayer } from "./display/text_layer.js";
60
+ import { TextLayerImages } from "./display/text_layer_images.js";
53
61
  import { TouchManager } from "./display/touch_manager.js";
54
62
  import { updateUrlHash } from "./shared/util.js";
55
63
  import { Util } from "./shared/util.js";
56
64
  import { VerbosityLevel } from "./shared/util.js";
57
65
  import { version } from "./display/api.js";
58
66
  import { XfaLayer } from "./display/xfa_layer.js";
59
- export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, AnnotationType, build, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getRGB, 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
+ }