1 | export type EventBus = import("./event_utils").EventBus;
|
2 | export type IPDFLinkService = import("./interfaces").IPDFLinkService;
|
3 | export type PDFLinkServiceOptions = {
|
4 | /**
|
5 | * - The application event bus.
|
6 | */
|
7 | eventBus: EventBus;
|
8 | /**
|
9 | * - Specifies the `target` attribute
|
10 | * for external links. Must use one of the values from {LinkTarget}.
|
11 | * Defaults to using no target.
|
12 | */
|
13 | externalLinkTarget?: number | undefined;
|
14 | /**
|
15 | * - Specifies the `rel` attribute for
|
16 | * external links. Defaults to stripping the referrer.
|
17 | */
|
18 | externalLinkRel?: string | undefined;
|
19 | /**
|
20 | * - Ignores the zoom argument,
|
21 | * thus preserving the current zoom level in the viewer, when navigating
|
22 | * to internal destinations. The default value is `false`.
|
23 | */
|
24 | ignoreDestinationZoom?: boolean | undefined;
|
25 | };
|
26 | /**
|
27 | * @typedef {Object} PDFLinkServiceOptions
|
28 | * @property {EventBus} eventBus - The application event bus.
|
29 | * @property {number} [externalLinkTarget] - Specifies the `target` attribute
|
30 | * for external links. Must use one of the values from {LinkTarget}.
|
31 | * Defaults to using no target.
|
32 | * @property {string} [externalLinkRel] - Specifies the `rel` attribute for
|
33 | * external links. Defaults to stripping the referrer.
|
34 | * @property {boolean} [ignoreDestinationZoom] - Ignores the zoom argument,
|
35 | * thus preserving the current zoom level in the viewer, when navigating
|
36 | * to internal destinations. The default value is `false`.
|
37 | */
|
38 | /**
|
39 | * Performs navigation functions inside PDF, such as opening specified page,
|
40 | * or destination.
|
41 | * @implements {IPDFLinkService}
|
42 | */
|
43 | export class PDFLinkService implements IPDFLinkService {
|
44 | /**
|
45 | * @param {PDFLinkServiceOptions} options
|
46 | */
|
47 | constructor({ eventBus, externalLinkTarget, externalLinkRel, ignoreDestinationZoom, }?: PDFLinkServiceOptions);
|
48 | eventBus: import("./event_utils").EventBus;
|
49 | externalLinkTarget: number;
|
50 | externalLinkRel: string;
|
51 | externalLinkEnabled: boolean;
|
52 | _ignoreDestinationZoom: boolean;
|
53 | baseUrl: any;
|
54 | pdfDocument: any;
|
55 | pdfViewer: any;
|
56 | pdfHistory: any;
|
57 | _pagesRefCache: any;
|
58 | setDocument(pdfDocument: any, baseUrl?: null): void;
|
59 | setViewer(pdfViewer: any): void;
|
60 | setHistory(pdfHistory: any): void;
|
61 | /**
|
62 | * @type {number}
|
63 | */
|
64 | get pagesCount(): number;
|
65 | /**
|
66 | * @param {number} value
|
67 | */
|
68 | set page(arg: number);
|
69 | /**
|
70 | * @type {number}
|
71 | */
|
72 | get page(): number;
|
73 | /**
|
74 | * @param {number} value
|
75 | */
|
76 | set rotation(arg: number);
|
77 | /**
|
78 | * @type {number}
|
79 | */
|
80 | get rotation(): number;
|
81 | /**
|
82 | * @private
|
83 | */
|
84 | private _goToDestinationHelper;
|
85 | /**
|
86 | * This method will, when available, also update the browser history.
|
87 | *
|
88 | * @param {string|Array} dest - The named, or explicit, PDF destination.
|
89 | */
|
90 | goToDestination(dest: string | any[]): Promise<void>;
|
91 | /**
|
92 | * This method will, when available, also update the browser history.
|
93 | *
|
94 | * @param {number|string} val - The page number, or page label.
|
95 | */
|
96 | goToPage(val: number | string): void;
|
97 | /**
|
98 | * Wrapper around the `addLinkAttributes`-function in the API.
|
99 | * @param {HTMLAnchorElement} link
|
100 | * @param {string} url
|
101 | * @param {boolean} [newWindow]
|
102 | */
|
103 | addLinkAttributes(link: HTMLAnchorElement, url: string, newWindow?: boolean | undefined): void;
|
104 | /**
|
105 | * @param {string|Array} dest - The PDF destination object.
|
106 | * @returns {string} The hyperlink to the PDF object.
|
107 | */
|
108 | getDestinationHash(dest: string | any[]): string;
|
109 | /**
|
110 | * Prefix the full url on anchor links to make sure that links are resolved
|
111 | * relative to the current URL instead of the one defined in <base href>.
|
112 | * @param {string} anchor - The anchor hash, including the #.
|
113 | * @returns {string} The hyperlink to the PDF object.
|
114 | */
|
115 | getAnchorUrl(anchor: string): string;
|
116 | /**
|
117 | * @param {string} hash
|
118 | */
|
119 | setHash(hash: string): void;
|
120 | /**
|
121 | * @param {string} action
|
122 | */
|
123 | executeNamedAction(action: string): void;
|
124 | /**
|
125 | * @param {number} pageNum - page number.
|
126 | * @param {Object} pageRef - reference to the page.
|
127 | */
|
128 | cachePageRef(pageNum: number, pageRef: Object): void;
|
129 | /**
|
130 | * @private
|
131 | */
|
132 | private _cachedPageNumber;
|
133 | /**
|
134 | * @param {number} pageNumber
|
135 | */
|
136 | isPageVisible(pageNumber: number): any;
|
137 | /**
|
138 | * @param {number} pageNumber
|
139 | */
|
140 | isPageCached(pageNumber: number): any;
|
141 | }
|
142 | /**
|
143 | * @implements {IPDFLinkService}
|
144 | */
|
145 | export class SimpleLinkService implements IPDFLinkService {
|
146 | externalLinkEnabled: boolean;
|
147 | /**
|
148 | * @type {number}
|
149 | */
|
150 | get pagesCount(): number;
|
151 | /**
|
152 | * @param {number} value
|
153 | */
|
154 | set page(arg: number);
|
155 | /**
|
156 | * @type {number}
|
157 | */
|
158 | get page(): number;
|
159 | /**
|
160 | * @param {number} value
|
161 | */
|
162 | set rotation(arg: number);
|
163 | /**
|
164 | * @type {number}
|
165 | */
|
166 | get rotation(): number;
|
167 | /**
|
168 | * @param {string|Array} dest - The named, or explicit, PDF destination.
|
169 | */
|
170 | goToDestination(dest: string | any[]): Promise<void>;
|
171 | /**
|
172 | * @param {number|string} val - The page number, or page label.
|
173 | */
|
174 | goToPage(val: number | string): void;
|
175 | /**
|
176 | * @param {HTMLAnchorElement} link
|
177 | * @param {string} url
|
178 | * @param {boolean} [newWindow]
|
179 | */
|
180 | addLinkAttributes(link: HTMLAnchorElement, url: string, newWindow?: boolean | undefined): void;
|
181 | /**
|
182 | * @param dest - The PDF destination object.
|
183 | * @returns {string} The hyperlink to the PDF object.
|
184 | */
|
185 | getDestinationHash(dest: any): string;
|
186 | /**
|
187 | * @param hash - The PDF parameters/hash.
|
188 | * @returns {string} The hyperlink to the PDF object.
|
189 | */
|
190 | getAnchorUrl(hash: any): string;
|
191 | /**
|
192 | * @param {string} hash
|
193 | */
|
194 | setHash(hash: string): void;
|
195 | /**
|
196 | * @param {string} action
|
197 | */
|
198 | executeNamedAction(action: string): void;
|
199 | /**
|
200 | * @param {number} pageNum - page number.
|
201 | * @param {Object} pageRef - reference to the page.
|
202 | */
|
203 | cachePageRef(pageNum: number, pageRef: Object): void;
|
204 | /**
|
205 | * @param {number} pageNumber
|
206 | */
|
207 | isPageVisible(pageNumber: number): boolean;
|
208 | /**
|
209 | * @param {number} pageNumber
|
210 | */
|
211 | isPageCached(pageNumber: number): boolean;
|
212 | }
|