pdfjs-serverless 0.1.0 → 0.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 (59) hide show
  1. package/README.md +11 -8
  2. package/dist/index.d.ts +1 -1
  3. package/dist/types/external/webL10n/l10n.d.ts +0 -0
  4. package/dist/types/src/display/annotation_layer.d.ts +203 -0
  5. package/dist/types/src/display/annotation_storage.d.ts +89 -0
  6. package/dist/types/src/display/api.d.ts +1472 -0
  7. package/dist/types/src/display/base_factory.d.ts +54 -0
  8. package/dist/types/src/display/canvas.d.ts +208 -0
  9. package/dist/types/src/display/display_utils.d.ts +277 -0
  10. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +182 -0
  11. package/dist/types/src/display/editor/editor.d.ts +308 -0
  12. package/dist/types/src/display/editor/freetext.d.ts +72 -0
  13. package/dist/types/src/display/editor/ink.d.ts +95 -0
  14. package/dist/types/src/display/editor/stamp.d.ts +22 -0
  15. package/dist/types/src/display/editor/tools.d.ts +324 -0
  16. package/dist/types/src/display/font_loader.d.ts +43 -0
  17. package/dist/types/src/display/metadata.d.ts +11 -0
  18. package/dist/types/src/display/optional_content_config.d.ts +13 -0
  19. package/dist/types/src/display/pattern_helper.d.ts +73 -0
  20. package/dist/types/src/display/text_layer.d.ts +151 -0
  21. package/dist/types/src/display/transport_stream.d.ts +68 -0
  22. package/dist/types/src/display/worker_options.d.ts +27 -0
  23. package/dist/types/src/display/xfa_layer.d.ts +46 -0
  24. package/dist/types/src/display/xfa_text.d.ts +19 -0
  25. package/dist/types/src/pdf.d.ts +50 -0
  26. package/dist/types/src/shared/image_utils.d.ts +17 -0
  27. package/dist/types/src/shared/message_handler.d.ts +43 -0
  28. package/dist/types/src/shared/murmurhash3.d.ts +7 -0
  29. package/dist/types/src/shared/scripting_utils.d.ts +12 -0
  30. package/dist/types/src/shared/util.d.ts +396 -0
  31. package/dist/types/web/annotation_editor_layer_builder.d.ts +50 -0
  32. package/dist/types/web/annotation_layer_builder.d.ts +83 -0
  33. package/dist/types/web/app_options.d.ts +14 -0
  34. package/dist/types/web/download_manager.d.ts +14 -0
  35. package/dist/types/web/event_utils.d.ts +75 -0
  36. package/dist/types/web/generic_scripting.d.ts +8 -0
  37. package/dist/types/web/genericl10n.d.ts +13 -0
  38. package/dist/types/web/interfaces.d.ts +163 -0
  39. package/dist/types/web/l10n_utils.d.ts +7 -0
  40. package/dist/types/web/pdf_find_controller.d.ts +108 -0
  41. package/dist/types/web/pdf_find_utils.d.ts +16 -0
  42. package/dist/types/web/pdf_history.d.ts +168 -0
  43. package/dist/types/web/pdf_link_service.d.ts +243 -0
  44. package/dist/types/web/pdf_page_view.d.ts +209 -0
  45. package/dist/types/web/pdf_rendering_queue.d.ts +53 -0
  46. package/dist/types/web/pdf_scripting_manager.component.d.ts +5 -0
  47. package/dist/types/web/pdf_scripting_manager.d.ts +61 -0
  48. package/dist/types/web/pdf_single_page_viewer.d.ts +7 -0
  49. package/dist/types/web/pdf_thumbnail_view.d.ts +131 -0
  50. package/dist/types/web/pdf_thumbnail_viewer.d.ts +104 -0
  51. package/dist/types/web/pdf_viewer.component.d.ts +24 -0
  52. package/dist/types/web/pdf_viewer.d.ts +455 -0
  53. package/dist/types/web/struct_tree_layer_builder.d.ts +7 -0
  54. package/dist/types/web/text_accessibility.d.ts +42 -0
  55. package/dist/types/web/text_highlighter.d.ts +63 -0
  56. package/dist/types/web/text_layer_builder.d.ts +64 -0
  57. package/dist/types/web/ui_utils.d.ts +288 -0
  58. package/dist/types/web/xfa_layer_builder.d.ts +41 -0
  59. package/package.json +6 -7
@@ -0,0 +1,83 @@
1
+ export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
2
+ export type PageViewport = import("../src/display/display_utils").PageViewport;
3
+ export type IDownloadManager = import("./interfaces").IDownloadManager;
4
+ export type IL10n = import("./interfaces").IL10n;
5
+ export type IPDFLinkService = import("./interfaces").IPDFLinkService;
6
+ export type TextAccessibilityManager = any;
7
+ export type AnnotationLayerBuilderOptions = {
8
+ pageDiv: HTMLDivElement;
9
+ pdfPage: PDFPageProxy;
10
+ annotationStorage?: any;
11
+ /**
12
+ * - Path for image resources, mainly
13
+ * for annotation icons. Include trailing slash.
14
+ */
15
+ imageResourcesPath?: string | undefined;
16
+ renderForms: boolean;
17
+ linkService: IPDFLinkService;
18
+ downloadManager: IDownloadManager;
19
+ /**
20
+ * - Localization service.
21
+ */
22
+ l10n: IL10n;
23
+ enableScripting?: boolean | undefined;
24
+ hasJSActionsPromise?: Promise<boolean> | undefined;
25
+ fieldObjectsPromise?: Promise<{
26
+ [x: string]: Object[];
27
+ } | null> | undefined;
28
+ annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined;
29
+ accessibilityManager?: any;
30
+ };
31
+ /**
32
+ * @typedef {Object} AnnotationLayerBuilderOptions
33
+ * @property {HTMLDivElement} pageDiv
34
+ * @property {PDFPageProxy} pdfPage
35
+ * @property {AnnotationStorage} [annotationStorage]
36
+ * @property {string} [imageResourcesPath] - Path for image resources, mainly
37
+ * for annotation icons. Include trailing slash.
38
+ * @property {boolean} renderForms
39
+ * @property {IPDFLinkService} linkService
40
+ * @property {IDownloadManager} downloadManager
41
+ * @property {IL10n} l10n - Localization service.
42
+ * @property {boolean} [enableScripting]
43
+ * @property {Promise<boolean>} [hasJSActionsPromise]
44
+ * @property {Promise<Object<string, Array<Object>> | null>}
45
+ * [fieldObjectsPromise]
46
+ * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap]
47
+ * @property {TextAccessibilityManager} [accessibilityManager]
48
+ */
49
+ export class AnnotationLayerBuilder {
50
+ /**
51
+ * @param {AnnotationLayerBuilderOptions} options
52
+ */
53
+ constructor({ pageDiv, pdfPage, linkService, downloadManager, annotationStorage, imageResourcesPath, renderForms, l10n, enableScripting, hasJSActionsPromise, fieldObjectsPromise, annotationCanvasMap, accessibilityManager, }: AnnotationLayerBuilderOptions);
54
+ pageDiv: HTMLDivElement;
55
+ pdfPage: import("../src/display/api").PDFPageProxy;
56
+ linkService: import("./interfaces").IPDFLinkService;
57
+ downloadManager: import("./interfaces").IDownloadManager;
58
+ imageResourcesPath: string;
59
+ renderForms: boolean;
60
+ l10n: import("./interfaces").IL10n;
61
+ annotationStorage: any;
62
+ enableScripting: boolean;
63
+ _hasJSActionsPromise: Promise<boolean>;
64
+ _fieldObjectsPromise: Promise<{
65
+ [x: string]: Object[];
66
+ } | null>;
67
+ _annotationCanvasMap: Map<string, HTMLCanvasElement>;
68
+ _accessibilityManager: any;
69
+ annotationLayer: any;
70
+ div: HTMLDivElement | null;
71
+ _cancelled: boolean;
72
+ _eventBus: any;
73
+ /**
74
+ * @param {PageViewport} viewport
75
+ * @param {string} intent (default value is 'display')
76
+ * @returns {Promise<void>} A promise that is resolved when rendering of the
77
+ * annotations is complete.
78
+ */
79
+ render(viewport: PageViewport, intent?: string): Promise<void>;
80
+ cancel(): void;
81
+ hide(): void;
82
+ #private;
83
+ }
@@ -0,0 +1,14 @@
1
+ export class AppOptions {
2
+ static get(name: any): any;
3
+ static getAll(kind?: null): any;
4
+ static set(name: any, value: any): void;
5
+ static setAll(options: any): void;
6
+ static remove(name: any): void;
7
+ }
8
+ export const compatibilityParams: any;
9
+ export namespace OptionKind {
10
+ let VIEWER: number;
11
+ let API: number;
12
+ let WORKER: number;
13
+ let PREFERENCE: number;
14
+ }
@@ -0,0 +1,14 @@
1
+ export type IDownloadManager = import("./interfaces").IDownloadManager;
2
+ /**
3
+ * @implements {IDownloadManager}
4
+ */
5
+ export class DownloadManager implements IDownloadManager {
6
+ downloadUrl(url: any, filename: any, _options: any): void;
7
+ downloadData(data: any, filename: any, contentType: any): void;
8
+ /**
9
+ * @returns {boolean} Indicating if the data was opened.
10
+ */
11
+ openOrDownloadData(element: any, data: any, filename: any): boolean;
12
+ download(blob: any, url: any, filename: any, _options: any): void;
13
+ #private;
14
+ }
@@ -0,0 +1,75 @@
1
+ export type WaitOnEventOrTimeoutParameters = {
2
+ /**
3
+ * - The event target, can for example be:
4
+ * `window`, `document`, a DOM element, or an {EventBus} instance.
5
+ */
6
+ target: Object;
7
+ /**
8
+ * - The name of the event.
9
+ */
10
+ name: string;
11
+ /**
12
+ * - The delay, in milliseconds, after which the
13
+ * timeout occurs (if the event wasn't already dispatched).
14
+ */
15
+ delay: number;
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
+ /**
24
+ * Simple event bus for an application. Listeners are attached using the `on`
25
+ * and `off` methods. To raise an event, the `dispatch` method shall be used.
26
+ */
27
+ export class EventBus {
28
+ /**
29
+ * @param {string} eventName
30
+ * @param {function} listener
31
+ * @param {Object} [options]
32
+ */
33
+ on(eventName: string, listener: Function, options?: Object | undefined): void;
34
+ /**
35
+ * @param {string} eventName
36
+ * @param {function} listener
37
+ * @param {Object} [options]
38
+ */
39
+ off(eventName: string, listener: Function, options?: Object | undefined): void;
40
+ /**
41
+ * @param {string} eventName
42
+ * @param {Object} data
43
+ */
44
+ dispatch(eventName: string, data: Object): void;
45
+ /**
46
+ * @ignore
47
+ */
48
+ _on(eventName: any, listener: any, options?: null): void;
49
+ /**
50
+ * @ignore
51
+ */
52
+ _off(eventName: any, listener: any, options?: null): void;
53
+ #private;
54
+ }
55
+ /**
56
+ * @typedef {Object} WaitOnEventOrTimeoutParameters
57
+ * @property {Object} target - The event target, can for example be:
58
+ * `window`, `document`, a DOM element, or an {EventBus} instance.
59
+ * @property {string} name - The name of the event.
60
+ * @property {number} delay - The delay, in milliseconds, after which the
61
+ * timeout occurs (if the event wasn't already dispatched).
62
+ */
63
+ /**
64
+ * Allows waiting for an event or a timeout, whichever occurs first.
65
+ * Can be used to ensure that an action always occurs, even when an event
66
+ * arrives late or not at all.
67
+ *
68
+ * @param {WaitOnEventOrTimeoutParameters}
69
+ * @returns {Promise} A promise that is resolved with a {WaitOnType} value.
70
+ */
71
+ export function waitOnEventOrTimeout({ target, name, delay }: WaitOnEventOrTimeoutParameters): Promise<any>;
72
+ export namespace WaitOnType {
73
+ let EVENT: string;
74
+ let TIMEOUT: string;
75
+ }
@@ -0,0 +1,8 @@
1
+ export function docProperties(pdfDocument: any): Promise<any>;
2
+ export class GenericScripting {
3
+ constructor(sandboxBundleSrc: any);
4
+ _ready: any;
5
+ createSandbox(data: any): Promise<void>;
6
+ dispatchEventInSandbox(event: any): Promise<void>;
7
+ destroySandbox(): Promise<void>;
8
+ }
@@ -0,0 +1,13 @@
1
+ export type IL10n = import("./interfaces").IL10n;
2
+ /**
3
+ * @implements {IL10n}
4
+ */
5
+ export class GenericL10n implements IL10n {
6
+ constructor(lang: any);
7
+ _lang: any;
8
+ _ready: Promise<any>;
9
+ getLanguage(): Promise<any>;
10
+ getDirection(): Promise<any>;
11
+ get(key: any, args?: null, fallback?: any): Promise<any>;
12
+ translate(element: any): Promise<any>;
13
+ }
@@ -0,0 +1,163 @@
1
+ export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
2
+ export type PageViewport = import("../src/display/display_utils").PageViewport;
3
+ export type RenderingStates = any;
4
+ /**
5
+ * @interface
6
+ */
7
+ export class IDownloadManager {
8
+ /**
9
+ * @param {string} url
10
+ * @param {string} filename
11
+ * @param {Object} [options]
12
+ */
13
+ downloadUrl(url: string, filename: string, options?: Object | undefined): void;
14
+ /**
15
+ * @param {Uint8Array} data
16
+ * @param {string} filename
17
+ * @param {string} [contentType]
18
+ */
19
+ downloadData(data: Uint8Array, filename: string, contentType?: string | undefined): void;
20
+ /**
21
+ * @param {HTMLElement} element
22
+ * @param {Uint8Array} data
23
+ * @param {string} filename
24
+ * @returns {boolean} Indicating if the data was opened.
25
+ */
26
+ openOrDownloadData(element: HTMLElement, data: Uint8Array, filename: string): boolean;
27
+ /**
28
+ * @param {Blob} blob
29
+ * @param {string} url
30
+ * @param {string} filename
31
+ * @param {Object} [options]
32
+ */
33
+ download(blob: Blob, url: string, filename: string, options?: Object | undefined): void;
34
+ }
35
+ /**
36
+ * @interface
37
+ */
38
+ export class IL10n {
39
+ /**
40
+ * @returns {Promise<string>} - Resolves to the current locale.
41
+ */
42
+ getLanguage(): Promise<string>;
43
+ /**
44
+ * @returns {Promise<string>} - Resolves to 'rtl' or 'ltr'.
45
+ */
46
+ getDirection(): Promise<string>;
47
+ /**
48
+ * Translates text identified by the key and adds/formats data using the args
49
+ * property bag. If the key was not found, translation falls back to the
50
+ * fallback text.
51
+ * @param {string} key
52
+ * @param {Object | null} [args]
53
+ * @param {string} [fallback]
54
+ * @returns {Promise<string>}
55
+ */
56
+ get(key: string, args?: Object | null | undefined, fallback?: string | undefined): Promise<string>;
57
+ /**
58
+ * Translates HTML element.
59
+ * @param {HTMLElement} element
60
+ * @returns {Promise<void>}
61
+ */
62
+ translate(element: HTMLElement): Promise<void>;
63
+ }
64
+ /** @typedef {import("../src/display/api").PDFPageProxy} PDFPageProxy */
65
+ /** @typedef {import("../src/display/display_utils").PageViewport} PageViewport */
66
+ /** @typedef {import("./ui_utils").RenderingStates} RenderingStates */
67
+ /**
68
+ * @interface
69
+ */
70
+ export class IPDFLinkService {
71
+ /**
72
+ * @type {number}
73
+ */
74
+ get pagesCount(): number;
75
+ /**
76
+ * @param {number} value
77
+ */
78
+ set page(arg: number);
79
+ /**
80
+ * @type {number}
81
+ */
82
+ get page(): number;
83
+ /**
84
+ * @param {number} value
85
+ */
86
+ set rotation(arg: number);
87
+ /**
88
+ * @type {number}
89
+ */
90
+ get rotation(): number;
91
+ /**
92
+ * @type {boolean}
93
+ */
94
+ get isInPresentationMode(): boolean;
95
+ /**
96
+ * @param {boolean} value
97
+ */
98
+ set externalLinkEnabled(arg: boolean);
99
+ /**
100
+ * @type {boolean}
101
+ */
102
+ get externalLinkEnabled(): boolean;
103
+ /**
104
+ * @param {string|Array} dest - The named, or explicit, PDF destination.
105
+ */
106
+ goToDestination(dest: string | any[]): Promise<void>;
107
+ /**
108
+ * @param {number|string} val - The page number, or page label.
109
+ */
110
+ goToPage(val: number | string): void;
111
+ /**
112
+ * @param {HTMLAnchorElement} link
113
+ * @param {string} url
114
+ * @param {boolean} [newWindow]
115
+ */
116
+ addLinkAttributes(link: HTMLAnchorElement, url: string, newWindow?: boolean | undefined): void;
117
+ /**
118
+ * @param dest - The PDF destination object.
119
+ * @returns {string} The hyperlink to the PDF object.
120
+ */
121
+ getDestinationHash(dest: any): string;
122
+ /**
123
+ * @param hash - The PDF parameters/hash.
124
+ * @returns {string} The hyperlink to the PDF object.
125
+ */
126
+ getAnchorUrl(hash: any): string;
127
+ /**
128
+ * @param {string} hash
129
+ */
130
+ setHash(hash: string): void;
131
+ /**
132
+ * @param {string} action
133
+ */
134
+ executeNamedAction(action: string): void;
135
+ /**
136
+ * @param {Object} action
137
+ */
138
+ executeSetOCGState(action: Object): void;
139
+ /**
140
+ * @param {number} pageNum - page number.
141
+ * @param {Object} pageRef - reference to the page.
142
+ */
143
+ cachePageRef(pageNum: number, pageRef: Object): void;
144
+ }
145
+ /**
146
+ * @interface
147
+ */
148
+ export class IRenderableView {
149
+ /** @type {function | null} */
150
+ resume: Function | null;
151
+ /**
152
+ * @type {string} - Unique ID for rendering queue.
153
+ */
154
+ get renderingId(): string;
155
+ /**
156
+ * @type {RenderingStates}
157
+ */
158
+ get renderingState(): any;
159
+ /**
160
+ * @returns {Promise} Resolved on draw completion.
161
+ */
162
+ draw(): Promise<any>;
163
+ }
@@ -0,0 +1,7 @@
1
+ export function getL10nFallback(key: any, args: any): any;
2
+ export namespace NullL10n {
3
+ function getLanguage(): Promise<string>;
4
+ function getDirection(): Promise<string>;
5
+ function get(key: any, args?: null, fallback?: any): Promise<any>;
6
+ function translate(element: any): Promise<void>;
7
+ }
@@ -0,0 +1,108 @@
1
+ export type PDFDocumentProxy = import("../src/display/api").PDFDocumentProxy;
2
+ export type EventBus = import("./event_utils").EventBus;
3
+ export type IPDFLinkService = import("./interfaces").IPDFLinkService;
4
+ export type PDFFindControllerOptions = {
5
+ /**
6
+ * - The navigation/linking service.
7
+ */
8
+ linkService: IPDFLinkService;
9
+ /**
10
+ * - The application event bus.
11
+ */
12
+ eventBus: EventBus;
13
+ /**
14
+ * - True if the matches
15
+ * count must be updated on progress or only when the last page is reached.
16
+ * The default value is `true`.
17
+ */
18
+ updateMatchesCountOnProgress?: boolean | undefined;
19
+ };
20
+ export namespace FindState {
21
+ let FOUND: number;
22
+ let NOT_FOUND: number;
23
+ let WRAPPED: number;
24
+ let PENDING: number;
25
+ }
26
+ /**
27
+ * @typedef {Object} PDFFindControllerOptions
28
+ * @property {IPDFLinkService} linkService - The navigation/linking service.
29
+ * @property {EventBus} eventBus - The application event bus.
30
+ * @property {boolean} [updateMatchesCountOnProgress] - True if the matches
31
+ * count must be updated on progress or only when the last page is reached.
32
+ * The default value is `true`.
33
+ */
34
+ /**
35
+ * Provides search functionality to find a given string in a PDF document.
36
+ */
37
+ export class PDFFindController {
38
+ /**
39
+ * @param {PDFFindControllerOptions} options
40
+ */
41
+ constructor({ linkService, eventBus, updateMatchesCountOnProgress }: PDFFindControllerOptions);
42
+ _linkService: import("./interfaces").IPDFLinkService;
43
+ _eventBus: import("./event_utils").EventBus;
44
+ /**
45
+ * Callback used to check if a `pageNumber` is currently visible.
46
+ * @type {function}
47
+ */
48
+ onIsPageVisible: Function;
49
+ get highlightMatches(): boolean | undefined;
50
+ get pageMatches(): any[] | undefined;
51
+ get pageMatchesLength(): any[] | undefined;
52
+ get selected(): {
53
+ pageIdx: number;
54
+ matchIdx: number;
55
+ } | undefined;
56
+ get state(): null;
57
+ /**
58
+ * Set a reference to the PDF document in order to search it.
59
+ * Note that searching is not possible if this method is not called.
60
+ *
61
+ * @param {PDFDocumentProxy} pdfDocument - The PDF document to search.
62
+ */
63
+ setDocument(pdfDocument: PDFDocumentProxy): void;
64
+ _pdfDocument: import("../src/display/api").PDFDocumentProxy | null | undefined;
65
+ _dirtyMatch: boolean | undefined;
66
+ _findTimeout: any;
67
+ _highlightMatches: boolean | undefined;
68
+ /**
69
+ * @typedef {Object} PDFFindControllerScrollMatchIntoViewParams
70
+ * @property {HTMLElement} element
71
+ * @property {number} selectedLeft
72
+ * @property {number} pageIndex
73
+ * @property {number} matchIndex
74
+ */
75
+ /**
76
+ * Scroll the current match into view.
77
+ * @param {PDFFindControllerScrollMatchIntoViewParams}
78
+ */
79
+ scrollMatchIntoView({ element, selectedLeft, pageIndex, matchIndex, }: {
80
+ element: HTMLElement;
81
+ selectedLeft: number;
82
+ pageIndex: number;
83
+ matchIndex: number;
84
+ }): void;
85
+ _scrollMatches: boolean | undefined;
86
+ _pageMatches: any[] | undefined;
87
+ _pageMatchesLength: any[] | undefined;
88
+ _selected: {
89
+ pageIdx: number;
90
+ matchIdx: number;
91
+ } | undefined;
92
+ _offset: {
93
+ pageIdx: null;
94
+ matchIdx: null;
95
+ wrapped: boolean;
96
+ } | undefined;
97
+ _extractTextPromises: any[] | undefined;
98
+ _pageContents: any[] | undefined;
99
+ _pageDiffs: any[] | undefined;
100
+ _hasDiacritics: any[] | undefined;
101
+ _matchesCountTotal: number | undefined;
102
+ _pagesToSearch: number | null | undefined;
103
+ _pendingFindMatches: Set<any> | undefined;
104
+ _resumePageIdx: any;
105
+ _firstPageCapability: any;
106
+ _rawQuery: any;
107
+ #private;
108
+ }
@@ -0,0 +1,16 @@
1
+ export namespace CharacterType {
2
+ let SPACE: number;
3
+ let ALPHA_LETTER: number;
4
+ let PUNCT: number;
5
+ let HAN_LETTER: number;
6
+ let KATAKANA_LETTER: number;
7
+ let HIRAGANA_LETTER: number;
8
+ let HALFWIDTH_KATAKANA_LETTER: number;
9
+ let THAI_LETTER: number;
10
+ }
11
+ /**
12
+ * This function is based on the word-break detection implemented in:
13
+ * https://hg.mozilla.org/mozilla-central/file/tip/intl/lwbrk/WordBreaker.cpp
14
+ */
15
+ export function getCharacterType(charCode: any): number;
16
+ export function getNormalizeWithNFKC(): any;
@@ -0,0 +1,168 @@
1
+ export type PDFHistoryOptions = {
2
+ /**
3
+ * - The navigation/linking service.
4
+ */
5
+ linkService: IPDFLinkService;
6
+ /**
7
+ * - The application event bus.
8
+ */
9
+ eventBus: EventBus;
10
+ };
11
+ export type InitializeParameters = {
12
+ /**
13
+ * - The PDF document's unique fingerprint.
14
+ */
15
+ fingerprint: string;
16
+ /**
17
+ * - Reset the browsing history.
18
+ */
19
+ resetHistory?: boolean | undefined;
20
+ /**
21
+ * - Attempt to update the document URL, with
22
+ * the current hash, when pushing/replacing browser history entries.
23
+ */
24
+ updateUrl?: boolean | undefined;
25
+ };
26
+ export type PushParameters = {
27
+ /**
28
+ * - The named destination. If absent, a
29
+ * stringified version of `explicitDest` is used.
30
+ */
31
+ namedDest?: string | undefined;
32
+ /**
33
+ * - The explicit destination array.
34
+ */
35
+ explicitDest: any[];
36
+ /**
37
+ * - The page to which the destination points.
38
+ */
39
+ pageNumber: number;
40
+ };
41
+ export type EventBus = import("./event_utils").EventBus;
42
+ export type IPDFLinkService = import("./interfaces").IPDFLinkService;
43
+ export function isDestArraysEqual(firstDest: any, secondDest: any): boolean;
44
+ export function isDestHashesEqual(destHash: any, pushHash: any): boolean;
45
+ export class PDFHistory {
46
+ /**
47
+ * @param {PDFHistoryOptions} options
48
+ */
49
+ constructor({ linkService, eventBus }: PDFHistoryOptions);
50
+ linkService: import("./interfaces").IPDFLinkService;
51
+ eventBus: import("./event_utils.js").EventBus;
52
+ _initialized: boolean;
53
+ _fingerprint: string;
54
+ _boundEvents: {
55
+ updateViewarea: ({ location }: {
56
+ location: any;
57
+ }) => void;
58
+ popState: ({ state }: {
59
+ state: any;
60
+ }) => void;
61
+ pageHide: () => void;
62
+ } | null;
63
+ _isPagesLoaded: boolean;
64
+ /**
65
+ * Initialize the history for the PDF document, using either the current
66
+ * browser history entry or the document hash, whichever is present.
67
+ * @param {InitializeParameters} params
68
+ */
69
+ initialize({ fingerprint, resetHistory, updateUrl }: InitializeParameters): void;
70
+ _updateUrl: boolean | undefined;
71
+ _popStateInProgress: boolean | undefined;
72
+ _blockHashChange: number | undefined;
73
+ _currentHash: string | undefined;
74
+ _numPositionUpdates: number | undefined;
75
+ _uid: any;
76
+ _maxUid: any;
77
+ _destination: any;
78
+ _position: {
79
+ hash: any;
80
+ page: number;
81
+ first: any;
82
+ rotation: any;
83
+ } | null | undefined;
84
+ _initialRotation: any;
85
+ _initialBookmark: any;
86
+ /**
87
+ * Reset the current `PDFHistory` instance, and consequently prevent any
88
+ * further updates and/or navigation of the browser history.
89
+ */
90
+ reset(): void;
91
+ _updateViewareaTimeout: any;
92
+ /**
93
+ * Push an internal destination to the browser history.
94
+ * @param {PushParameters}
95
+ */
96
+ push({ namedDest, explicitDest, pageNumber }: PushParameters): void;
97
+ /**
98
+ * Push a page to the browser history; generally the `push` method should be
99
+ * used instead.
100
+ * @param {number} pageNumber
101
+ */
102
+ pushPage(pageNumber: number): void;
103
+ /**
104
+ * Push the current position to the browser history.
105
+ */
106
+ pushCurrentPosition(): void;
107
+ /**
108
+ * Go back one step in the browser history.
109
+ * NOTE: Avoids navigating away from the document, useful for "named actions".
110
+ */
111
+ back(): void;
112
+ /**
113
+ * Go forward one step in the browser history.
114
+ * NOTE: Avoids navigating away from the document, useful for "named actions".
115
+ */
116
+ forward(): void;
117
+ /**
118
+ * @type {boolean} Indicating if the user is currently moving through the
119
+ * browser history, useful e.g. for skipping the next 'hashchange' event.
120
+ */
121
+ get popStateInProgress(): boolean;
122
+ get initialBookmark(): any;
123
+ get initialRotation(): any;
124
+ /**
125
+ * @private
126
+ */
127
+ private _pushOrReplaceState;
128
+ /**
129
+ * @private
130
+ */
131
+ private _tryPushCurrentPosition;
132
+ /**
133
+ * @private
134
+ */
135
+ private _isValidPage;
136
+ /**
137
+ * @private
138
+ */
139
+ private _isValidState;
140
+ /**
141
+ * @private
142
+ */
143
+ private _updateInternalState;
144
+ /**
145
+ * @private
146
+ */
147
+ private _parseCurrentHash;
148
+ /**
149
+ * @private
150
+ */
151
+ private _updateViewarea;
152
+ /**
153
+ * @private
154
+ */
155
+ private _popState;
156
+ /**
157
+ * @private
158
+ */
159
+ private _pageHide;
160
+ /**
161
+ * @private
162
+ */
163
+ private _bindEvents;
164
+ /**
165
+ * @private
166
+ */
167
+ private _unbindEvents;
168
+ }