UNPKG

3.27 kBTypeScriptView Raw
1export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
2export type PageViewport = import("../src/display/display_utils").PageViewport;
3export type IDownloadManager = import("./interfaces").IDownloadManager;
4export type IL10n = import("./interfaces").IL10n;
5export type IPDFLinkService = import("./interfaces").IPDFLinkService;
6export type AnnotationLayerBuilderOptions = {
7 pageDiv: HTMLDivElement;
8 pdfPage: PDFPageProxy;
9 annotationStorage?: any;
10 /**
11 * - Path for image resources, mainly
12 * for annotation icons. Include trailing slash.
13 */
14 imageResourcesPath?: string | undefined;
15 renderForms: boolean;
16 linkService: IPDFLinkService;
17 downloadManager: IDownloadManager;
18 /**
19 * - Localization service.
20 */
21 l10n: IL10n;
22 enableScripting?: boolean | undefined;
23 hasJSActionsPromise?: Promise<boolean> | undefined;
24 fieldObjectsPromise?: Promise<{
25 [x: string]: Object[];
26 } | null> | undefined;
27 mouseState?: Object | undefined;
28 annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined;
29};
30/**
31 * @typedef {Object} AnnotationLayerBuilderOptions
32 * @property {HTMLDivElement} pageDiv
33 * @property {PDFPageProxy} pdfPage
34 * @property {AnnotationStorage} [annotationStorage]
35 * @property {string} [imageResourcesPath] - Path for image resources, mainly
36 * for annotation icons. Include trailing slash.
37 * @property {boolean} renderForms
38 * @property {IPDFLinkService} linkService
39 * @property {IDownloadManager} downloadManager
40 * @property {IL10n} l10n - Localization service.
41 * @property {boolean} [enableScripting]
42 * @property {Promise<boolean>} [hasJSActionsPromise]
43 * @property {Promise<Object<string, Array<Object>> | null>}
44 * [fieldObjectsPromise]
45 * @property {Object} [mouseState]
46 * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap]
47 */
48export class AnnotationLayerBuilder {
49 /**
50 * @param {AnnotationLayerBuilderOptions} options
51 */
52 constructor({ pageDiv, pdfPage, linkService, downloadManager, annotationStorage, imageResourcesPath, renderForms, l10n, enableScripting, hasJSActionsPromise, fieldObjectsPromise, mouseState, annotationCanvasMap, }: AnnotationLayerBuilderOptions);
53 pageDiv: HTMLDivElement;
54 pdfPage: import("../src/display/api").PDFPageProxy;
55 linkService: import("./interfaces").IPDFLinkService;
56 downloadManager: import("./interfaces").IDownloadManager;
57 imageResourcesPath: string;
58 renderForms: boolean;
59 l10n: import("./interfaces").IL10n;
60 annotationStorage: any;
61 enableScripting: boolean;
62 _hasJSActionsPromise: Promise<boolean>;
63 _fieldObjectsPromise: Promise<{
64 [x: string]: Object[];
65 } | null>;
66 _mouseState: Object;
67 _annotationCanvasMap: Map<string, HTMLCanvasElement>;
68 div: HTMLDivElement | null;
69 _cancelled: boolean;
70 /**
71 * @param {PageViewport} viewport
72 * @param {string} intent (default value is 'display')
73 * @returns {Promise<void>} A promise that is resolved when rendering of the
74 * annotations is complete.
75 */
76 render(viewport: PageViewport, intent?: string): Promise<void>;
77 cancel(): void;
78 hide(): void;
79}