pdfjs-serverless 0.5.1 → 0.7.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 (66) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.mts +1 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.mjs +1 -1
  5. package/dist/types/src/display/annotation_layer.d.ts +14 -4
  6. package/dist/types/src/display/annotation_storage.d.ts +9 -0
  7. package/dist/types/src/display/api.d.ts +119 -53
  8. package/dist/types/src/display/canvas.d.ts +4 -1
  9. package/dist/types/src/display/canvas_factory.d.ts +27 -0
  10. package/dist/types/src/display/cmap_reader_factory.d.ts +25 -0
  11. package/dist/types/src/display/display_utils.d.ts +29 -59
  12. package/dist/types/src/display/draw_layer.d.ts +6 -19
  13. package/dist/types/src/display/editor/alt_text.d.ts +17 -5
  14. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +15 -9
  15. package/dist/types/src/display/editor/color_picker.d.ts +1 -0
  16. package/dist/types/src/display/editor/draw.d.ts +120 -0
  17. package/dist/types/src/display/editor/drawers/freedraw.d.ts +31 -0
  18. package/dist/types/src/display/editor/drawers/highlight.d.ts +36 -0
  19. package/dist/types/src/display/editor/drawers/inkdraw.d.ts +128 -0
  20. package/dist/types/src/display/editor/drawers/outline.d.ts +19 -0
  21. package/dist/types/src/display/editor/editor.d.ts +60 -12
  22. package/dist/types/src/display/editor/freetext.d.ts +7 -18
  23. package/dist/types/src/display/editor/highlight.d.ts +9 -27
  24. package/dist/types/src/display/editor/ink.d.ts +15 -73
  25. package/dist/types/src/display/editor/stamp.d.ts +27 -10
  26. package/dist/types/src/display/editor/toolbar.d.ts +3 -1
  27. package/dist/types/src/display/editor/tools.d.ts +32 -7
  28. package/dist/types/src/display/fetch_stream.d.ts +6 -13
  29. package/dist/types/src/display/filter_factory.d.ts +29 -0
  30. package/dist/types/src/display/font_loader.d.ts +3 -1
  31. package/dist/types/src/display/network.d.ts +10 -6
  32. package/dist/types/src/display/network_utils.d.ts +5 -3
  33. package/dist/types/src/display/node_stream.d.ts +7 -23
  34. package/dist/types/src/display/node_utils.d.ts +8 -11
  35. package/dist/types/src/display/optional_content_config.d.ts +1 -1
  36. package/dist/types/src/display/standard_fontdata_factory.d.ts +20 -0
  37. package/dist/types/src/display/svg_factory.d.ts +14 -0
  38. package/dist/types/src/display/text_layer.d.ts +15 -13
  39. package/dist/types/src/display/touch_manager.d.ts +14 -0
  40. package/dist/types/src/display/transport_stream.d.ts +1 -1
  41. package/dist/types/src/display/worker_options.d.ts +2 -2
  42. package/dist/types/src/interfaces.d.ts +4 -0
  43. package/dist/types/src/pdf.d.ts +5 -6
  44. package/dist/types/src/shared/message_handler.d.ts +10 -4
  45. package/dist/types/src/shared/util.d.ts +12 -20
  46. package/dist/types/web/annotation_editor_layer_builder.d.ts +5 -2
  47. package/dist/types/web/annotation_layer_builder.d.ts +3 -1
  48. package/dist/types/web/app_options.d.ts +4 -2
  49. package/dist/types/web/download_manager.d.ts +1 -2
  50. package/dist/types/web/event_utils.d.ts +10 -8
  51. package/dist/types/web/genericl10n.d.ts +5 -5
  52. package/dist/types/web/interfaces.d.ts +7 -14
  53. package/dist/types/web/l10n.d.ts +6 -2
  54. package/dist/types/web/pdf_find_controller.d.ts +24 -0
  55. package/dist/types/web/pdf_link_service.d.ts +2 -2
  56. package/dist/types/web/pdf_page_view.d.ts +17 -17
  57. package/dist/types/web/pdf_rendering_queue.d.ts +1 -1
  58. package/dist/types/web/pdf_thumbnail_view.d.ts +11 -3
  59. package/dist/types/web/pdf_thumbnail_viewer.d.ts +16 -1
  60. package/dist/types/web/pdf_viewer.d.ts +24 -11
  61. package/dist/types/web/struct_tree_layer_builder.d.ts +4 -2
  62. package/dist/types/web/text_layer_builder.d.ts +5 -5
  63. package/dist/types/web/ui_utils.d.ts +10 -21
  64. package/package.json +19 -19
  65. package/dist/types/src/display/base_factory.d.ts +0 -56
  66. package/dist/types/src/display/editor/outliner.d.ts +0 -70
@@ -1,10 +1,12 @@
1
1
  export class FontFaceObject {
2
- constructor(translatedData: any, { disableFontFace, inspectFont }: {
2
+ constructor(translatedData: any, { disableFontFace, fontExtraProperties, inspectFont }: {
3
3
  disableFontFace?: boolean | undefined;
4
+ fontExtraProperties?: boolean | undefined;
4
5
  inspectFont?: null | undefined;
5
6
  });
6
7
  compiledGlyphs: any;
7
8
  disableFontFace: boolean;
9
+ fontExtraProperties: boolean;
8
10
  _inspectFont: any;
9
11
  createNativeFontFace(): FontFace | null;
10
12
  createFontFaceRule(): string | null;
@@ -12,15 +12,18 @@ export class PDFNetworkStream implements IPDFStream {
12
12
  cancelAllRequests(reason: any): void;
13
13
  }
14
14
  declare class NetworkManager {
15
- constructor(url: any, args?: {});
15
+ constructor({ url, httpHeaders, withCredentials }: {
16
+ url: any;
17
+ httpHeaders: any;
18
+ withCredentials: any;
19
+ });
20
+ _responseOrigin: null;
16
21
  url: any;
17
22
  isHttp: boolean;
18
- httpHeaders: any;
23
+ headers: Headers;
19
24
  withCredentials: any;
20
25
  currXhrId: number;
21
26
  pendingRequests: any;
22
- requestRange(begin: any, end: any, listeners: any): number;
23
- requestFull(listeners: any): number;
24
27
  request(args: any): number;
25
28
  onProgress(xhrId: any, evt: any): void;
26
29
  onStateChange(xhrId: any, evt: any): void;
@@ -34,7 +37,7 @@ declare class PDFNetworkStreamFullRequestReader implements IPDFStreamReader {
34
37
  _manager: any;
35
38
  _url: any;
36
39
  _fullRequestId: any;
37
- _headersReceivedCapability: any;
40
+ _headersCapability: any;
38
41
  _disableRange: any;
39
42
  _contentLength: any;
40
43
  _rangeChunkSize: any;
@@ -68,9 +71,10 @@ declare class PDFNetworkStreamRangeRequestReader implements IPDFStreamRangeReade
68
71
  _requests: any[];
69
72
  _queuedChunk: any;
70
73
  _done: boolean;
71
- _storedError: import("../shared/util.js").MissingPDFException | import("../shared/util.js").UnexpectedResponseException | undefined;
74
+ _storedError: Error | undefined;
72
75
  onProgress: any;
73
76
  onClosed: any;
77
+ _onHeadersReceived(): void;
74
78
  _close(): void;
75
79
  _onDone(data: any): void;
76
80
  _onError(status: any): void;
@@ -1,7 +1,9 @@
1
+ export function createHeaders(isHttp: any, httpHeaders: any): Headers;
1
2
  export function createResponseStatusError(status: any, url: any): MissingPDFException | UnexpectedResponseException;
2
- export function extractFilenameFromHeader(getResponseHeader: any): string | null;
3
- export function validateRangeRequestCapabilities({ getResponseHeader, isHttp, rangeChunkSize, disableRange, }: {
4
- getResponseHeader: any;
3
+ export function extractFilenameFromHeader(responseHeaders: any): string | null;
4
+ export function getResponseOrigin(url: any): string | null;
5
+ export function validateRangeRequestCapabilities({ responseHeaders, isHttp, rangeChunkSize, disableRange, }: {
6
+ responseHeaders: any;
5
7
  isHttp: any;
6
8
  rangeChunkSize: any;
7
9
  disableRange: any;
@@ -1,31 +1,15 @@
1
1
  export class PDFNodeStream {
2
2
  constructor(source: any);
3
3
  source: any;
4
- url: any;
5
- isHttp: boolean;
6
- isFsUrl: boolean;
7
- httpHeaders: any;
8
- _fullRequestReader: PDFNodeStreamFsFullReader | PDFNodeStreamFullReader | null;
4
+ url: URL;
5
+ _fullRequestReader: PDFNodeStreamFsFullReader | null;
9
6
  _rangeRequestReaders: any[];
10
7
  get _progressiveDataLength(): number;
11
- getFullReader(): PDFNodeStreamFsFullReader | PDFNodeStreamFullReader;
12
- getRangeReader(start: any, end: any): PDFNodeStreamFsRangeReader | PDFNodeStreamRangeReader | null;
8
+ getFullReader(): PDFNodeStreamFsFullReader;
9
+ getRangeReader(start: any, end: any): PDFNodeStreamFsRangeReader | null;
13
10
  cancelAllRequests(reason: any): void;
14
11
  }
15
- declare class PDFNodeStreamFsFullReader extends BaseFullReader {
16
- }
17
- declare class PDFNodeStreamFullReader extends BaseFullReader {
18
- _request: any;
19
- }
20
- declare class PDFNodeStreamFsRangeReader extends BaseRangeReader {
21
- constructor(stream: any, start: any, end: any);
22
- }
23
- declare class PDFNodeStreamRangeReader extends BaseRangeReader {
24
- constructor(stream: any, start: any, end: any);
25
- _httpHeaders: {};
26
- _request: any;
27
- }
28
- declare class BaseFullReader {
12
+ declare class PDFNodeStreamFsFullReader {
29
13
  constructor(stream: any);
30
14
  _url: any;
31
15
  _done: boolean;
@@ -51,8 +35,8 @@ declare class BaseFullReader {
51
35
  _error(reason: any): void;
52
36
  _setReadableStream(readableStream: any): void;
53
37
  }
54
- declare class BaseRangeReader {
55
- constructor(stream: any);
38
+ declare class PDFNodeStreamFsRangeReader {
39
+ constructor(stream: any, start: any, end: any);
56
40
  _url: any;
57
41
  _done: boolean;
58
42
  _storedError: any;
@@ -1,28 +1,25 @@
1
+ export function fetchData(url: any): Promise<Uint8Array<ArrayBuffer>>;
1
2
  export class NodeCanvasFactory extends BaseCanvasFactory {
2
3
  /**
3
4
  * @ignore
4
5
  */
5
- _createCanvas(width: any, height: any): any;
6
+ _createCanvas(width: any, height: any): import("@napi-rs/canvas").Canvas;
6
7
  }
7
8
  export class NodeCMapReaderFactory extends BaseCMapReaderFactory {
8
9
  /**
9
10
  * @ignore
10
11
  */
11
- _fetchData(url: any, compressionType: any): any;
12
+ _fetch(url: any): Promise<Uint8Array<ArrayBuffer>>;
12
13
  }
13
14
  export class NodeFilterFactory extends BaseFilterFactory {
14
15
  }
15
- export class NodePackages {
16
- static get promise(): any;
17
- static get(name: any): any;
18
- }
19
16
  export class NodeStandardFontDataFactory extends BaseStandardFontDataFactory {
20
17
  /**
21
18
  * @ignore
22
19
  */
23
- _fetchData(url: any): any;
20
+ _fetch(url: any): Promise<Uint8Array<ArrayBuffer>>;
24
21
  }
25
- import { BaseCanvasFactory } from "./base_factory.js";
26
- import { BaseCMapReaderFactory } from "./base_factory.js";
27
- import { BaseFilterFactory } from "./base_factory.js";
28
- import { BaseStandardFontDataFactory } from "./base_factory.js";
22
+ import { BaseCanvasFactory } from "./canvas_factory.js";
23
+ import { BaseCMapReaderFactory } from "./cmap_reader_factory.js";
24
+ import { BaseFilterFactory } from "./filter_factory.js";
25
+ import { BaseStandardFontDataFactory } from "./standard_fontdata_factory.js";
@@ -4,7 +4,7 @@ export class OptionalContentConfig {
4
4
  name: any;
5
5
  creator: any;
6
6
  isVisible(group: any): any;
7
- setVisibility(id: any, visible?: boolean): void;
7
+ setVisibility(id: any, visible?: boolean, preserveRB?: boolean): void;
8
8
  setOCGState({ state, preserveRB }: {
9
9
  state: any;
10
10
  preserveRB: any;
@@ -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
+ }
@@ -30,22 +30,25 @@ export type TextLayerUpdateParameters = {
30
30
  */
31
31
  onBefore?: Function | undefined;
32
32
  };
33
- export function renderTextLayer(...args: any[]): {
34
- promise: Promise<any>;
35
- textDivs: HTMLElement[];
36
- textContentItemsStr: string[];
37
- } | undefined;
38
33
  export class TextLayer {
39
- static "__#44@#ascentCache": Map<any, any>;
40
- static "__#44@#canvasContexts": Map<any, any>;
41
- static "__#44@#pendingTextLayers": Set<any>;
34
+ static "__#53@#ascentCache": Map<any, any>;
35
+ static "__#53@#canvasContexts": Map<any, any>;
36
+ static "__#53@#canvasCtxFonts": WeakMap<object, any>;
37
+ static "__#53@#minFontSize": null;
38
+ static "__#53@#pendingTextLayers": Set<any>;
39
+ static get fontFamilyMap(): any;
42
40
  /**
43
41
  * Clean-up global textLayer data.
44
42
  * @returns {undefined}
45
43
  */
46
44
  static cleanup(): undefined;
47
- static "__#44@#getCtx"(lang?: null): any;
48
- static "__#44@#getAscent"(fontFamily: any, lang: any): any;
45
+ static "__#53@#getCtx"(lang?: null): any;
46
+ static "__#53@#ensureCtxFont"(ctx: any, size: any, family: any): void;
47
+ /**
48
+ * Compute the minimum font size enforced by the browser.
49
+ */
50
+ static "__#53@#ensureMinFontSizeComputed"(): void;
51
+ static "__#53@#getAscent"(fontFamily: any, lang: any): any;
49
52
  /**
50
53
  * @param {TextLayerParameters} options
51
54
  */
@@ -71,13 +74,12 @@ export class TextLayer {
71
74
  * of the textContent input.
72
75
  * This is output and will initially be set to an empty array.
73
76
  */
74
- get textDivs(): HTMLElement[];
77
+ get textDivs(): Array<HTMLElement>;
75
78
  /**
76
79
  * @type {Array<string>} Strings that correspond to the `str` property of
77
80
  * the text items of the textContent input.
78
81
  * This is output and will initially be set to an empty array
79
82
  */
80
- get textContentItemsStr(): string[];
83
+ get textContentItemsStr(): Array<string>;
81
84
  #private;
82
85
  }
83
- export function updateTextLayer(): void;
@@ -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
+ }
@@ -7,7 +7,7 @@ export class PDFDataTransportStream implements IPDFStream {
7
7
  disableRange?: boolean | undefined;
8
8
  disableStream?: boolean | undefined;
9
9
  });
10
- _queuedChunks: ArrayBuffer[];
10
+ _queuedChunks: any[];
11
11
  _progressiveDone: any;
12
12
  _contentDispositionFilename: any;
13
13
  _pdfDataRangeTransport: any;
@@ -1,6 +1,6 @@
1
1
  export class GlobalWorkerOptions {
2
- static "__#39@#port": null;
3
- static "__#39@#src": string;
2
+ static "__#49@#port": null;
3
+ static "__#49@#src": string;
4
4
  /**
5
5
  * @param {Worker | null} workerPort - Defines global port for worker process.
6
6
  * Overrides the `workerSrc` option.
@@ -12,6 +12,10 @@ export class IPDFStream {
12
12
  getFullReader(): IPDFStreamReader;
13
13
  /**
14
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
+ *
15
19
  * @param {number} begin - the start offset of the data.
16
20
  * @param {number} end - the end offset of the data.
17
21
  * @returns {IPDFStreamRangeReader}
@@ -12,10 +12,9 @@ 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 { build } from "./display/api.js";
15
- import { CMapCompressionType } from "./shared/util.js";
16
15
  import { ColorPicker } from "./display/editor/color_picker.js";
17
16
  import { createValidAbsoluteUrl } from "./shared/util.js";
18
- import { DOMSVGFactory } from "./display/display_utils.js";
17
+ import { DOMSVGFactory } from "./display/svg_factory.js";
19
18
  import { DrawLayer } from "./display/draw_layer.js";
20
19
  import { FeatureTest } from "./shared/util.js";
21
20
  import { fetchData } from "./display/display_utils.js";
@@ -32,7 +31,7 @@ import { MissingPDFException } from "./shared/util.js";
32
31
  import { noContextMenu } from "./display/display_utils.js";
33
32
  import { normalizeUnicode } from "./shared/util.js";
34
33
  import { OPS } from "./shared/util.js";
35
- import { Outliner } from "./display/editor/outliner.js";
34
+ import { OutputScale } from "./display/display_utils.js";
36
35
  import { PasswordResponses } from "./shared/util.js";
37
36
  import { PDFDataRangeTransport } from "./display/api.js";
38
37
  import { PDFDateString } from "./display/display_utils.js";
@@ -40,14 +39,14 @@ import { PDFWorker } from "./display/api.js";
40
39
  import { PermissionFlag } from "./shared/util.js";
41
40
  import { PixelsPerInch } from "./display/display_utils.js";
42
41
  import { RenderingCancelledException } from "./display/display_utils.js";
43
- import { renderTextLayer } from "./display/text_layer.js";
44
42
  import { setLayerDimensions } from "./display/display_utils.js";
45
43
  import { shadow } from "./shared/util.js";
44
+ import { stopEvent } from "./display/display_utils.js";
46
45
  import { TextLayer } from "./display/text_layer.js";
46
+ import { TouchManager } from "./display/touch_manager.js";
47
47
  import { UnexpectedResponseException } from "./shared/util.js";
48
- import { updateTextLayer } from "./display/text_layer.js";
49
48
  import { Util } from "./shared/util.js";
50
49
  import { VerbosityLevel } from "./shared/util.js";
51
50
  import { version } from "./display/api.js";
52
51
  import { XfaLayer } from "./display/xfa_layer.js";
53
- export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, build, CMapCompressionType, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, MissingPDFException, noContextMenu, normalizeUnicode, OPS, Outliner, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, renderTextLayer, setLayerDimensions, shadow, TextLayer, UnexpectedResponseException, updateTextLayer, Util, VerbosityLevel, version, XfaLayer };
52
+ export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, build, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, MissingPDFException, noContextMenu, normalizeUnicode, OPS, OutputScale, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, setLayerDimensions, shadow, stopEvent, TextLayer, TouchManager, UnexpectedResponseException, Util, VerbosityLevel, version, XfaLayer };
@@ -9,7 +9,6 @@ export class MessageHandler {
9
9
  streamControllers: any;
10
10
  callbackCapabilities: any;
11
11
  actionHandler: any;
12
- _onComObjOnMessage: (event: any) => void;
13
12
  on(actionName: any, handler: any): void;
14
13
  /**
15
14
  * Sends a message to the comObj to invoke the action with the supplied data.
@@ -17,7 +16,7 @@ export class MessageHandler {
17
16
  * @param {JSON} data - JSON data to send.
18
17
  * @param {Array} [transfers] - List of transfers/ArrayBuffers.
19
18
  */
20
- send(actionName: string, data: JSON, transfers?: any[] | undefined): void;
19
+ send(actionName: string, data: JSON, transfers?: any[]): void;
21
20
  /**
22
21
  * Sends a message to the comObj to invoke the action with the supplied data.
23
22
  * Expects that the other side will callback with the response.
@@ -26,7 +25,7 @@ export class MessageHandler {
26
25
  * @param {Array} [transfers] - List of transfers/ArrayBuffers.
27
26
  * @returns {Promise} Promise to be resolved with response data.
28
27
  */
29
- sendWithPromise(actionName: string, data: JSON, transfers?: any[] | undefined): Promise<any>;
28
+ sendWithPromise(actionName: string, data: JSON, transfers?: any[]): Promise<any>;
30
29
  /**
31
30
  * Sends a message to the comObj to invoke the action with the supplied data.
32
31
  * Expect that the other side will callback to signal 'start_complete'.
@@ -37,7 +36,14 @@ export class MessageHandler {
37
36
  * @param {Array} [transfers] - List of transfers/ArrayBuffers.
38
37
  * @returns {ReadableStream} ReadableStream to read data in chunks.
39
38
  */
40
- sendWithStream(actionName: string, data: JSON, queueingStrategy: Object, transfers?: any[] | undefined): ReadableStream;
39
+ sendWithStream(actionName: string, data: JSON, queueingStrategy: Object, transfers?: any[]): ReadableStream;
41
40
  destroy(): void;
42
41
  #private;
43
42
  }
43
+ export function wrapReason(ex: any): PasswordException | UnknownErrorException | InvalidPDFException | MissingPDFException | UnexpectedResponseException | AbortException;
44
+ import { PasswordException } from "./util.js";
45
+ import { UnknownErrorException } from "./util.js";
46
+ import { InvalidPDFException } from "./util.js";
47
+ import { MissingPDFException } from "./util.js";
48
+ import { UnexpectedResponseException } from "./util.js";
49
+ import { AbortException } from "./util.js";
@@ -43,6 +43,7 @@ export namespace AnnotationEditorParamsType {
43
43
  let HIGHLIGHT_THICKNESS: number;
44
44
  let HIGHLIGHT_FREE: number;
45
45
  let HIGHLIGHT_SHOW_ALL: number;
46
+ let DRAW_STEP: number;
46
47
  }
47
48
  export const AnnotationEditorPrefix: "pdfjs_internal_editor_";
48
49
  export namespace AnnotationEditorType {
@@ -139,11 +140,6 @@ export function assert(cond: any, msg: any): void;
139
140
  export const BaseException: any;
140
141
  export const BASELINE_FACTOR: number;
141
142
  export function bytesToString(bytes: any): string;
142
- export namespace CMapCompressionType {
143
- let NONE_1: number;
144
- export { NONE_1 as NONE };
145
- export let BINARY: number;
146
- }
147
143
  /**
148
144
  * Attempts to create a valid absolute URL.
149
145
  *
@@ -152,7 +148,7 @@ export namespace CMapCompressionType {
152
148
  * @param {Object} [options]
153
149
  * @returns Either a valid {URL}, or `null` otherwise.
154
150
  */
155
- export function createValidAbsoluteUrl(url: URL | string, baseUrl?: string | URL | undefined, options?: Object | undefined): URL | null;
151
+ export function createValidAbsoluteUrl(url: URL | string, baseUrl?: URL | string, options?: Object): URL | null;
156
152
  export namespace DocumentActionEventType {
157
153
  let WC: string;
158
154
  let WS: string;
@@ -164,21 +160,11 @@ export class FeatureTest {
164
160
  static get isLittleEndian(): any;
165
161
  static get isEvalSupported(): any;
166
162
  static get isOffscreenCanvasSupported(): any;
163
+ static get isImageDecoderSupported(): any;
167
164
  static get platform(): any;
168
165
  static get isCSSRoundSupported(): any;
169
166
  }
170
167
  export const FONT_IDENTITY_MATRIX: number[];
171
- export namespace FontRenderOps {
172
- let BEZIER_CURVE_TO: number;
173
- let MOVE_TO: number;
174
- let LINE_TO: number;
175
- let QUADRATIC_CURVE_TO: number;
176
- let RESTORE: number;
177
- let SAVE: number;
178
- let SCALE: number;
179
- let TRANSFORM: number;
180
- let TRANSLATE: number;
181
- }
182
168
  declare const FormatError_base: any;
183
169
  /**
184
170
  * Error caused during parsing PDF data.
@@ -187,9 +173,11 @@ export class FormatError extends FormatError_base {
187
173
  [x: string]: any;
188
174
  constructor(msg: any);
189
175
  }
176
+ export function fromBase64Util(str: any): any;
190
177
  export function getModificationDate(date?: Date): string;
191
178
  export function getUuid(): string;
192
179
  export function getVerbosityLevel(): number;
180
+ export const hexNumbers: string[];
193
181
  export const IDENTITY_MATRIX: number[];
194
182
  export namespace ImageKind {
195
183
  let GRAYSCALE_1BPP: number;
@@ -304,6 +292,8 @@ export namespace OPS {
304
292
  let paintImageMaskXObjectRepeat: number;
305
293
  let paintSolidColorImageMask: number;
306
294
  let constructPath: number;
295
+ let setStrokeTransparent: number;
296
+ let setFillTransparent: number;
307
297
  }
308
298
  export namespace PageActionEventType {
309
299
  export let O: string;
@@ -336,17 +326,17 @@ export namespace RenderingIntentFlag {
336
326
  export let DISPLAY: number;
337
327
  let PRINT_2: number;
338
328
  export { PRINT_2 as PRINT };
339
- let SAVE_1: number;
340
- export { SAVE_1 as SAVE };
329
+ export let SAVE: number;
341
330
  export let ANNOTATIONS_FORMS: number;
342
331
  export let ANNOTATIONS_STORAGE: number;
343
332
  export let ANNOTATIONS_DISABLE: number;
333
+ export let IS_EDITING: number;
344
334
  export let OPLIST: number;
345
335
  }
346
336
  export function setVerbosityLevel(level: any): void;
347
337
  export function shadow(obj: any, prop: any, value: any, nonSerializable?: boolean): any;
348
338
  export function string32(value: any): string;
349
- export function stringToBytes(str: any): Uint8Array;
339
+ export function stringToBytes(str: any): Uint8Array<any>;
350
340
  export function stringToPDFString(str: any): string;
351
341
  export function stringToUTF8String(str: any): string;
352
342
  export namespace TextRenderingMode {
@@ -362,6 +352,8 @@ export namespace TextRenderingMode {
362
352
  export let FILL_STROKE_MASK: number;
363
353
  export let ADD_TO_PATH_FLAG: number;
364
354
  }
355
+ export function toBase64Util(arr: any): any;
356
+ export function toHexUtil(arr: any): any;
365
357
  declare const UnexpectedResponseException_base: any;
366
358
  export class UnexpectedResponseException extends UnexpectedResponseException_base {
367
359
  [x: string]: any;
@@ -4,14 +4,16 @@ export type AnnotationEditorUIManager = import("../src/display/editor/tools.js")
4
4
  export type TextAccessibilityManager = import("./text_accessibility.js").TextAccessibilityManager;
5
5
  export type IL10n = import("./interfaces").IL10n;
6
6
  export type AnnotationLayer = import("../src/display/annotation_layer.js").AnnotationLayer;
7
+ export type StructTreeLayerBuilder = any;
7
8
  export type AnnotationEditorLayerBuilderOptions = {
8
9
  uiManager?: import("../src/pdf").AnnotationEditorUIManager | undefined;
9
10
  pdfPage: PDFPageProxy;
10
11
  l10n?: import("./interfaces").IL10n | undefined;
12
+ structTreeLayer?: StructTreeLayerBuilder;
11
13
  accessibilityManager?: import("./text_accessibility.js").TextAccessibilityManager | undefined;
12
14
  annotationLayer?: import("../src/pdf").AnnotationLayer | undefined;
13
- textLayer?: any;
14
- drawLayer?: any;
15
+ textLayer?: TextLayer;
16
+ drawLayer?: DrawLayer;
15
17
  onAppend?: Function | undefined;
16
18
  };
17
19
  /**
@@ -19,6 +21,7 @@ export type AnnotationEditorLayerBuilderOptions = {
19
21
  * @property {AnnotationEditorUIManager} [uiManager]
20
22
  * @property {PDFPageProxy} pdfPage
21
23
  * @property {IL10n} [l10n]
24
+ * @property {StructTreeLayerBuilder} [structTreeLayer]
22
25
  * @property {TextAccessibilityManager} [accessibilityManager]
23
26
  * @property {AnnotationLayer} [annotationLayer]
24
27
  * @property {TextLayer} [textLayer]
@@ -69,13 +69,15 @@ export class AnnotationLayerBuilder {
69
69
  _eventBus: any;
70
70
  /**
71
71
  * @param {PageViewport} viewport
72
+ * @param {Object} options
72
73
  * @param {string} intent (default value is 'display')
73
74
  * @returns {Promise<void>} A promise that is resolved when rendering of the
74
75
  * annotations is complete.
75
76
  */
76
- render(viewport: PageViewport, intent?: string): Promise<void>;
77
+ render(viewport: PageViewport, options: Object, intent?: string): Promise<void>;
77
78
  cancel(): void;
78
79
  hide(): void;
80
+ hasEditableAnnotations(): boolean;
79
81
  #private;
80
82
  }
81
83
  import { AnnotationLayer } from "../src/pdf";
@@ -1,14 +1,16 @@
1
1
  export class AppOptions {
2
+ static eventBus: any;
3
+ static "__#72@#opts": Map<any, any>;
2
4
  static get(name: any): any;
3
5
  static getAll(kind?: null, defaultOnly?: boolean): any;
4
6
  static set(name: any, value: any): void;
5
- static setAll(options: any, init?: boolean): void;
6
- static remove(name: any): void;
7
+ static setAll(options: any, prefs?: boolean): void;
7
8
  }
8
9
  export namespace OptionKind {
9
10
  let BROWSER: number;
10
11
  let VIEWER: number;
11
12
  let API: number;
12
13
  let WORKER: number;
14
+ let EVENT_DISPATCH: number;
13
15
  let PREFERENCE: number;
14
16
  }
@@ -3,12 +3,11 @@ export type IDownloadManager = import("./interfaces").IDownloadManager;
3
3
  * @implements {IDownloadManager}
4
4
  */
5
5
  export class DownloadManager implements IDownloadManager {
6
- downloadUrl(url: any, filename: any, _options: any): void;
7
6
  downloadData(data: any, filename: any, contentType: any): void;
8
7
  /**
9
8
  * @returns {boolean} Indicating if the data was opened.
10
9
  */
11
10
  openOrDownloadData(data: any, filename: any, dest?: null): boolean;
12
- download(blob: any, url: any, filename: any, _options: any): void;
11
+ download(data: any, url: any, filename: any): void;
13
12
  #private;
14
13
  }
@@ -14,12 +14,6 @@ export type WaitOnEventOrTimeoutParameters = {
14
14
  */
15
15
  delay: number;
16
16
  };
17
- /**
18
- * NOTE: Only used to support various PDF viewer tests in `mozilla-central`.
19
- */
20
- export class AutomationEventBus extends EventBus {
21
- dispatch(eventName: any, data: any): void;
22
- }
23
17
  /**
24
18
  * Simple event bus for an application. Listeners are attached using the `on`
25
19
  * and `off` methods. To raise an event, the `dispatch` method shall be used.
@@ -30,13 +24,13 @@ export class EventBus {
30
24
  * @param {function} listener
31
25
  * @param {Object} [options]
32
26
  */
33
- on(eventName: string, listener: Function, options?: Object | undefined): void;
27
+ on(eventName: string, listener: Function, options?: Object): void;
34
28
  /**
35
29
  * @param {string} eventName
36
30
  * @param {function} listener
37
31
  * @param {Object} [options]
38
32
  */
39
- off(eventName: string, listener: Function, options?: Object | undefined): void;
33
+ off(eventName: string, listener: Function, options?: Object): void;
40
34
  /**
41
35
  * @param {string} eventName
42
36
  * @param {Object} data
@@ -52,6 +46,14 @@ export class EventBus {
52
46
  _off(eventName: any, listener: any, options?: null): void;
53
47
  #private;
54
48
  }
49
+ /**
50
+ * NOTE: Only used in the Firefox build-in pdf viewer.
51
+ */
52
+ export class FirefoxEventBus extends EventBus {
53
+ constructor(globalEventNames: any, externalServices: any, isInAutomation: any);
54
+ dispatch(eventName: any, data: any): void;
55
+ #private;
56
+ }
55
57
  /**
56
58
  * @typedef {Object} WaitOnEventOrTimeoutParameters
57
59
  * @property {Object} target - The event target, can for example be:
@@ -9,14 +9,14 @@ export class GenericL10n extends L10n implements IL10n {
9
9
  * translations.
10
10
  * @param {String} baseLang - The base language to use for translations.
11
11
  */
12
- static "__#59@#generateBundles"(defaultLang: string, baseLang: string): AsyncGenerator<any, void, unknown>;
13
- static "__#59@#createBundle"(lang: any, baseURL: any, paths: any): Promise<any>;
14
- static "__#59@#getPaths"(): Promise<{
12
+ static "__#69@#generateBundles"(defaultLang: string, baseLang: string): AsyncGenerator<any, void, unknown>;
13
+ static "__#69@#createBundle"(lang: any, baseURL: any, paths: any): Promise<any>;
14
+ static "__#69@#getPaths"(): Promise<{
15
15
  baseURL: any;
16
16
  paths: any;
17
17
  }>;
18
- static "__#59@#generateBundlesFallback"(lang: any): AsyncGenerator<any, void, unknown>;
19
- static "__#59@#createBundleFallback"(lang: any): Promise<any>;
18
+ static "__#69@#generateBundlesFallback"(lang: any): AsyncGenerator<any, void, unknown>;
19
+ static "__#69@#createBundleFallback"(lang: any): Promise<any>;
20
20
  constructor(lang: any);
21
21
  }
22
22
  import { L10n } from "./l10n.js";