-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathatalaWebDocumentViewer.d.ts
More file actions
1392 lines (1187 loc) · 48 KB
/
atalaWebDocumentViewer.d.ts
File metadata and controls
1392 lines (1187 loc) · 48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//-------------------------------------------------------------------------------------------------
//
// Type definition file for Atalasoft Web Document Viewer.
// (C) 2000-2026 Tungsten Automation. All Rights Reserved.
//
// This source code is property of Atalasoft, Inc. (http://www.atalasoft.com/)
// Permission for usage and modification of this code is only permitted
// with the purchase of a source code license.
//-------------------------------------------------------------------------------------------------
// Version 2026,2,0,48
export as namespace Atalasoft;
interface NotificationCallback {
(): any;
}
interface AnnotationCallback {
(event: object): any;
}
interface AnnotationContextMenuCallback{
(event: object, annotation: Controls.AnnotationData, menu: AnnotationContextMenu): any;
}
interface BeforeHandlerRequestCallback{
(event: Controls.BeforeHandlerRequestEvent): any;
}
interface GetPageTextCallback{
(text: string): any;
}
interface ErrorCallback{
(event: ErrorEvent): any;
}
interface OpenUrlCallback {
(error: string): any;
}
interface ReloadPageTextCallback {
(index: number): any;
}
interface TextSearchCallback{
(iterator: Controls.TextSearchIterator, match: TextSearchResult): any;
}
interface TextSearchResult{
page: number;
region: number;
line: number;
word: number;
}
interface DocumentPageReference{
uri: string;
index: number;
}
interface BookmarkData{
id: number;
Page: number;
Top: number;
Text: string;
Children: BookmarkData[];
}
interface DocumentInfo{
count: number;
dpi: number;
size: Record<string,any>;
vector: boolean;
}
interface AnnotationFill{
color?: string;
opacity?: number;
}
interface AnnotationLineCap{
style?: string;
width?: string;
height?: string;
}
interface AnnotationOutline{
color?: string;
opacity?: number;
width?: number;
startcap?: AnnotationLineCap;
endcap?: AnnotationLineCap;
}
interface AnnotationContextMenu{
menuItemTitle: AnnotationHandler;
}
interface AnnotationHandler{
annotation: Controls.AnnotationData;
}
interface Point{
x: number;
y: number;
}
interface AnnotationTextConfig{
value?: string;
align?: string;
font?: object;
readonly?: boolean;
autoscale?: boolean;
}
interface TextMouseToolConfig{
scrolltriggerarea?: Utils.ScrollArea;
throttlingtreshold?: number;
selection?: Record<string, any>;
highlight?: Record<string, any>;
hookcopy?: boolean;
allowsearch?: boolean;
wrapsearch?: boolean;
searchdelay?: number;
}
interface MouseToolConfig{
type?: Utils.MouseToolType;
text?: TextMouseToolConfig;
}
interface FileUploadConfig{
enabled?: boolean;
uploadpath?: string;
allowedfiletypes?: string;
allowedmaxfilesize?: number;
allowmultiplefiles?: boolean;
allowdragdrop?: boolean;
filesuploadconcurrency?: number;
closeuiafterupload?: boolean;
}
interface AtalaRequest{
method: string;
data: Record<string, any>;
type: string;
}
interface ToolbarButtonConfig{
id: string;
class?: string;
icon: string;
tooltip?: string;
onclick?: NotificationCallback;
}
interface ThumbDragCompleteEventArgs{
dragindex: number;
dragindices: number[];
dropindex: number;
source: Controls.WebDocumentThumbnailer;
target: Controls.WebDocumentThumbnailer;
}
interface ThumbDragEndEventArgs{
dragindex: number;
dragindices: number[];
dropindex: number;
source: Controls.WebDocumentThumbnailer;
target: Controls.WebDocumentThumbnailer;
external: boolean;
pageref: DocumentPageReference;
pagerefs: DocumentPageReference[];
cancel?: boolean;
copyannotations?: boolean;
}
interface ThumbDragEndCallback {
(event: object,args: ThumbDragEndEventArgs): any;
}
interface UploadFileErrorInfo{
filename: string;
error: string;
canceled: boolean;
customData: Record<string, any>;
}
interface UploadFileInfo{
filename: string;
size: number;
cancel: boolean;
}
interface UploadingFileInfo{
filename: string;
uploadedbytes: number;
totalbytes: number;
cancel: boolean;
}
interface UploadStartInfo{
cancel: boolean;
}
export namespace Controls {
export class AnnotationController{
public constructor();
//#region Methods
/**
* Inserts a layer of annotations at the source URL and index into the given page index. Single layer of annotations corresponds to single document page.
* @param sourceUrl Reserved for future use.
* @param layer The annotation layer data.
* @param index Index the layer is to be inserted into.
* @param callback Function to be called when the operation has completed.
*/
public insertLayer(sourceUrl: string, layer: AnnotationData[], index: number, callback?: NotificationCallback): void;
/**
* Cancels the drawing of an annotation and returns the viewer to the previous tool.
*/
public cancelDraw(): void;
/**
* Deletes an annotation on the given page by it's index on the page.
* @param pageIndex Page index the annotation is located on.
* @param annIndex Index of the annotation on the page.
*/
public deleteFromPage(pageIndex: number, annIndex: number): void;
/**
* Deselects all annotations on every page.
*/
public deselectAll(): void;
/**
* Deselects all annotations on the given page.
* @param index The index of the page the annotations should be deselected on.
*/
public deselectAllOnPage(index: number): void;
/**
* Setups the viewport to create an annotation
* @param aConfig Configuration for the annotation to draw
* @param callback function to call when the annotation has finished drawing.
* @param cancelled function to call when the annotation draw was canceled.
*/
public drawAnnotation(aConfig: AnnotationData, callback?: NotificationCallback, cancelled?: NotificationCallback): void;
/**
* Gets an array of annotation data objects located on the given zero based page index.
* @param index The page index the annotations are located on.
*/
public getFromPage(index: number): AnnotationData[];
/**
* Gets an array of selected annotation data objects.
*/
public getSelected(): AnnotationData[];
/**
* Hides the text annotation editor. Applies only to text annotations and ignores other types of annotations.
* @param annotation The annotation object to hide editor for.
*/
public hideEditor(annotation: AnnotationData): void;
/**
* Creates an annotation on the desired page with the given annotation data.
* @param annotationConfig Key value pairs representing annotation data.
* @param index The index of the page the annotation should be created on.
*/
public createOnPage(annotationConfig: AnnotationData, index: number): AnnotationData;
/**
* Moves a layer of annotations from one page index to another.
* @param sourceIndex index of the layer to be moved.
* @param destIndex Destination zero based page index.
* @param callback Function to be called when the operation has completed.
*/
public moveLayer(sourceIndex: number, destIndex: number, callback?: NotificationCallback): void;
/**
* Removes a layer(page annotation) of annotations. All other layers are shifted. This operation corresponds to removing page from the document.
* @param index index of the layer to be removed.
* @param callback Function to be called when the operation has completed.
*/
public removeLayer(index: number, callback?: NotificationCallback): void;
/**
* Scrolls viewer to the specified annotation.
* @param anno the annotation object to scroll to.
* @param callback Function to be called when the operation has completed.
*/
public scrollTo(anno: AnnotationData,callback?: NotificationCallback): void;
/**
* Selects all annotations on every page.
*/
public selectAll(): void;
/**
* Selects all annotations on the given page.
* @param index The index of the page the annotations should be selected on.
*/
public selectAllOnPage(index: number): void;
/**
* Sets the default annotation properties for initially created annotations.
* @param aConfig Default configurations for different types of the annotations.
*/
public setDefaults(aConfig: AnnotationData[]): WebDocumentViewer;
/**
* Sets the default annotation properties for image annotations
* @param aConfig Default configurations image annotations.
*/
public setImages(aConfig: AnnotationData[]): WebDocumentViewer;
/**
* Sets the default annotation properties for stamp annotations.
* @param aConfig Default configurations stamp annotations.
*/
public setStamps(aConfig: AnnotationData[]): WebDocumentViewer;
/**
* Shows the editor dialog for text annotations. Ignores other types of annotations.
* @param annotation the annotation object to show editor for.
*/
public showEditor(annotation: AnnotationData): void;
//#endregion
}
/**
* WebDocumentViewer Document operations API
*/
export class DocumentController{
public constructor();
//#region Methods
/**
* Gets the page reference object for the specified page. This can be passed as a 'srcindex' parameter into document.insertPage method.
* @param index Index of the page to get the reference.
*/
public getPageReference(index: number): DocumentPageReference;
/**
* Gets the rotation angle of the specified page.
* @param index Index of the page to retrieve rotation angle.
*/
public getPageRotation(index: number): number;
/**
* Inserts a page at the destination index from the given source uri and index.
* @param documenturl The identifier of the document which contains the page. If empty, src numeric value is considered as referencing currently opened document.
* @param src Zero based index of the page in the source document. Can be passed as string representation of a number. Or page descriptor returned by the getPageReference.
* @param destination Index in the target document to insert the page.
* @param callback Function to execute when the operation has completed.
*/
public insertPage(documenturl: string, src: number|string|DocumentPageReference,
destination: number, callback?: NotificationCallback): void;
// eslint-disable-next-line no-dupe-class-members
public insertPage(src: number|string|DocumentPageReference, destination: number, callback?: NotificationCallback): void;
/**
* Inserts a page at the destination index from the given source uri and index.
* @param documenturl The identifier of the document which contains the page. If empty, src numeric value is considered as referencing currently opened document.
* @param src Zero based indices of the pages in the source document. Can be passed as string representation of numbers. Or page descriptors returned by the getPageReference.
* @param destination Index in the target document to insert the page.
* @param callback Function to execute when the operation has completed.
*/
public insertPages(documenturl: string, src: number[]|string[]|DocumentPageReference[],
destination: number, callback?: NotificationCallback): void;
// eslint-disable-next-line no-dupe-class-members
public insertPages(src: number[]|string[]|DocumentPageReference[],
destination: number, callback?: NotificationCallback): void;
/**
* Moves a page from the source index to the destination index within single document.
* @param sourceIndex Source index to get the page from. Can be passed as string representation of a number
* @param destinationIndex Destination index to insert the page. Can be passed as string representation of a number
* @param callback Function to execute when the operation has completed.
*/
public movePage(sourceIndex: number|string, destinationIndex: number|string, callback?: NotificationCallback): void;
/**
* Moves pages from the source indices to the destination index within single document.
* @param sourceIndices Source indices to get pages from. Can be passed as string representation of numbers
* @param destinationIndex Destination index to insert pages. Can be passed as string representation of a number
* @param callback Function to execute when the operation has completed.
*/
public movePages(sourceIndices: number[]|string[], destinationIndex: number|string, callback?: NotificationCallback): void;
/**
* Removes the page at the given index.
* @param index Index of the page to remove. Can be passed as string representation of a number
* @param callback Function to execute when the operation has completed.
*/
public removePage(index: number|string, callback?: NotificationCallback): void;
/**
* Removes pages at given indices.
* @param indices Indices of pages to remove. Can be passed as string representation of numbers
* @param callback Function to execute when the operation has completed.
*/
public removePages(indices: number[]|string[], callback?: NotificationCallback): void;
/**
* Rotates the specified angle page to the specified angle.
* @param index Index of the page to rotate. Can be passed as string representation of a number
* @param angle Clockwise rotation angle in degrees. Can be passed as string representation of a number
* @param callback Function to execute when the operation has completed.
*/
public rotatePage(index: number|string, angle: number|string, callback?: NotificationCallback): void;
/**
* Rotates specified angle pages to specified angles.
* @param indices Indices of pages to rotate.
* @param angles Clockwise rotation angles in degrees. Can be passed as string representation of a number If angles is a number|string or an number[]|string[] with length 1, then all pages will be rotated to this angle, otherwise each page will be rotated to the specified angle in array.
* @param callback Function to execute when the operation has completed.
*/
public rotatePages(indices: number[]|string[], angles: number|number[]|string[], callback?: NotificationCallback): void;
/**
* Gets all bookmarks for PDF document.
*/
public getBookmarks(): BookmarkData[];
/**
* Gets an array of child bookmarks relative to specified.
* @param {BookmarkData} bookmark - the bookmark object for which children are searched.
*/
public getChildBookmarks(bookmark: BookmarkData): BookmarkData[];
/**
* Scrolls viewer to the specified bookmark.
* @param {BookmarkData} bookmark - the bookmark object to scroll to.
* @param {NotificationCallback} [callback] - Function to be called when the operation has completed.
*/
public scrollToBookmark(bookmark: BookmarkData, callback?: NotificationCallback): void;
/**
* Removes whole information about the bookmarks from PDF document.
* @param {NotificationCallback} [callback] - Function to be called when the operation has completed.
*/
public removeAllBookmarks(callback?: NotificationCallback): void;
//#endregion
}
/**
* WebDocumentViewer Text Layer operations API.
*/
export class TextController{
public constructor();
//#region Methods
/**
* Clears all text selection for the document.
*/
public clearSelection(): void;
/**
* Copies selected text to clipboard.
*/
public copySelected(): void;
/**
* Returns all text for the specified page.
* @param index Index of the page to retrieve text.
* @param success Function that that is called when page text is loaded and formatted.
* @param fail Function that that is called when page text load is failed.
*/
public getPageText(index: number, success?: GetPageTextCallback, fail?: NotificationCallback): string;
/**
* Retrieves the selected text.
* Returns: Selected text. Line break is inserted after each line and region.
*/
public getSelected(): string;
/**
* Indicates whether page text is loaded.
* @param index Index of the page to check text data state.
*/
public isPageTextLoaded(index: number): boolean;
/**
* Forcibly triggers page text load.
* @param index Index of the page to reset text data.
* @param success Function that that is called when page text is loaded successfully.
* @param fail Function that that is called when page text load is failed.
*/
public reloadPageText(index: number, success?: Function, fail?: Function): void;
/**
* Marks page text data for reload. After this call text data will be loaded next time page will be inserted into DOM on scrolling
* @param index Index of the page to reset text data. If not specified whole document text data is reset.
*/
public resetPageText(index?: number): void;
/**
* Triggers text search for the specified pages.
* @param text Text to search for. If empty, previous search results are dropped.
* @param startPage Index of the page to start search from. If not specified first page in document is assumed to be the first in search.
* @param endPage Index of the page to end search where. If not specified last page in document is assumed to be the last in search.
* @param activePage Index of the page from that viewer should start scrolling to the next search result.
* @param callback Search callback that receives search results iterator.
*/
public searchOnPages(text?: string, startPage?: number, endPage?: number,
activePage?: number, callback?: TextSearchCallback): TextSearchIterator;
/**
* Selects all text on the page. Any optional arguments could be omitted and callback could be passed instead of it.
* @param index Index of the page to select page on.
* @param region Index of the region to select.
* @param line Index of the line to select.
* @param word Index of the word to select.
* @param success
* @param fail
*/
public selectPageText(index: number, region?: number, line?: number, word?: number,
success?: NotificationCallback, fail?: NotificationCallback): void;
/**
* Deprecated: Use the searchOnPages method instead
* Triggers text search.
* @param text Text to search for. If empty, previous search results are dropped.
* @param startPage Index of the page to start search from. If not specified first page in document is assumed to be the first in search.
* @param callback Search callback that receives search results iterator.
*/
public search(text?: string, startPage?: number, callback?: TextSearchCallback): TextSearchIterator;
//#endregion
}
export class TextSearchIterator{
public constructor();
public wrap: boolean;
/**
* Returns the formatted text for the whole line containing current match.
*/
public getCurrentLineText(): string;
/**
* Gets the query text for this iterator.
*/
public getQuery(): string;
/**
* Indicates whether this is executing background search. If true, subsequent next/prev calls are stored into the search queue.
*/
public isSearching(): boolean;
/**
* Indicates whether this iterator corresponds to the active search.
*/
public isValid(): boolean;
/**
* Advances current item to the next query match or adds operation to the queue in case if next match is currently awaited.
* @param callback function that that is called when next match is found.
*/
public next(callback: TextSearchCallback): void;
/**
* Advances current item to the previous query match or adds operation to the queue in case if next match is currently awaited.
* @param callback Function that that is called when previous match is found.
*/
public prev(callback: TextSearchCallback): void;
}
export interface WebDocumentViewerConfig{
parent: object;
serverurl: string;
allowannotations?: boolean;
allowforms?: boolean;
allowtext?: boolean;
annotations?: AnnotationsConfig;
annotationsurl?: string;
columns?: number;
direction?: Utils.ScrollDirection;
documenturl?: string;
fitting?: Utils.Fitting;
forcepagefit?: boolean;
formurl?: string;
jpeg?: boolean;
localization?: Utils.LocalizationStrings;
maxwidth?: number;
memorythreshold?: number;
minwidth?: number;
mousetool?: MouseToolConfig | Utils.MouseToolType;
pageborderwidth?: number;
pagebuffersize?: number;
maxpagebuffersize?: number;
pageselectlocation?: Utils.PageSelection;
pagespacing?: number;
allowflick?: boolean;
persistrotation?: boolean;
savefileformat?: string;
savepath?: string;
scripturl?: string;
savepreviouslysigneddocument?: boolean;
showbookmarks?: boolean;
showbuttontext?: boolean;
showerrors?: boolean;
showpageborder?: boolean;
showpagenumber?: boolean;
showpagenumbertooltip?: boolean;
showrotatetools?: boolean;
showscrollbars?: boolean;
showselecttools?: boolean;
showstatus?: boolean;
singlepage?: boolean;
tabular?: boolean;
tiling?: boolean;
toolbarbuttons?: ToolbarButtonConfig[];
toolbarparent?: Record<string, any>;
upload?: FileUploadConfig;
zoom?: number;
}
export interface WebThumbnailerConfig extends WebDocumentViewerConfig{
viewer?: WebDocumentViewer;
selectedhovercolor?: string;
allowdragdrop?: boolean;
dragdelay?: number;
hovercolor?: string;
maxwidth?: number;
minwidth?: number;
selectedcolor?: string;
backcolor?: string;
selectedindex?: number;
selecteditemsorder?: Utils.SelectedItemsOrder;
selectionmode?: Utils.SelectionMode;
showthumbcaption?: boolean;
thumbcaptionformat?: string;
thumbpadding?: number;
}
export interface AnnotationsConfig{
defaults?: AnnotationDataConfig[];
stamps?: AnnotationDataConfig[];
images?: AnnotationDataConfig[];
saveusername?: boolean;
}
export class AnnotationData {
public constructor(config: AnnotationDataConfig)
// Methods
public update(): void;
public getPageIndex(): number;
// Properties
public name: string;
public type: Annotations.AnnotationTypes;
public rotation?: number;
public burn?: boolean;
public extra?: Record<string, any>;
public fill?: AnnotationFill;
public height?: number;
public movable?: boolean;
public outline?: AnnotationOutline;
public points?: Point[];
public readonly?: boolean;
public resizable?: boolean;
public rotatable?: boolean;
public cornerradius?: number;
public selectable?: boolean;
public selected?: boolean;
public src?: string;
public text?: AnnotationTextConfig;
public tooltip?: string;
public username?: string;
public visible?: boolean;
public width?: number;
public x?: number;
public y?: number;
}
export interface AnnotationDataConfig{
name: string;
type: Annotations.AnnotationTypes;
rotation?: number;
burn?: boolean;
extra?: Record<string, any>;
fill?: AnnotationFill;
height?: number;
movable?: boolean;
outline?: AnnotationOutline;
points?: Point[];
readonly?: boolean;
resizable?: boolean;
rotatable?: boolean;
cornerradius?: number;
selectable?: boolean;
selected?: boolean;
src?: string;
text?: AnnotationTextConfig;
tooltip?: string;
username?: string;
visible?: boolean;
width?: number;
x?: number;
y?: number;
}
export class WebDocumentViewer {
public constructor(config: WebDocumentViewerConfig);
// eslint-disable-next-line no-dupe-class-members
public constructor(config: WebDocumentViewerConfig,openCallback: OpenUrlCallback);
//#region Methods
/**
* Reloads the specified page.
* @param {number} index - The index of the page to reload.
* @param {string|boolean} [annotations=false] - Url of the annotation xmp file or flag indicating whether to reload annotations of boolean flag indicating whether to load annotations data.
* @param {string|boolean} [forms] - Url of the form file or flag indicating whether to reload forms of boolean flag indicating whether to load forms data.
* @param {Object} [params] - A plain object containing optional parameters that will be passed to server.
*
* Params could contain any application specific information that should be passed to server.
* For example, this could be the aggregated list of the parameters that was used in {@link Atalasoft.Controls.WebDocumentViewer#reloadPage|reloadPage} calls for different pages.
* @param {NotificationCallback} [callback] - function that is called when page have been loaded.
*
*/
public reloadPage(index: number,annotations?: string|boolean,forms?: string|boolean,params?: any,
callback?: NotificationCallback): void;
/**
* Attaches a handler to an event.
* @param {string} event - the name of the event to bind to.
* @param {function} handler - event handler.
* @returns {Atalasoft.Controls.WebDocumentViewer} reference to `this`.
*/
public bind(event: string,handler: Function): WebDocumentViewer;
/**
* Zooms in one level.
* @param callback Function to execute when the zoom operation is finished
*/
public zoomIn(callback?: NotificationCallback): void;
/**
* Asynchronously zooms the viewer to the given zoom over the default zoom duration
* @param zoom Desired zoom level to zoom to.
* @param callback function to execute after the zoom is finished animating.
*/
public zoom(zoom: number,callback?: NotificationCallback): void;
/**
* Removes all DOM elements, internal references, and empties memory intensive objects. The WebDocumentViewer will no longer function after a call to this method.
*/
public dispose(): void;
/**
* Resets the viewer to its default state.
* @param callback Function to execute when the empty process is finished
*/
public empty(callback?: OpenUrlCallback): void;
/**
* Filters files for upload using the settings from config upload section.
Filters files that should be uploaded using the settings from config upload section. This includes filtering by size, by type and even by name in order to find out files for upload that have same names. It can be useful, because all events in WDV related to upload use filename as a key, thus you can find duplicates and upload such files in separate uploadFiles method calls.
This method is fully optional and even if some files failed to pass this filtering, they still can be uploaded to server;
* @param files An array of file objects that can be used for upload.
* @param filteredFiles An array of filenames that previously were filtered. It's used for find duplicates in a new bunch of files.
* @param callback Function to execute when the filtering has finished.
*/
public filterFilesForUpload(files: File[],filteredFiles?: string[],callback?: NotificationCallback): File[];
/**
* Asynchronously zooms the viewer to fit to a page.
* @param fit Type of fitting to fit the page to.
* @param pageNumber Page number to fit to. Note, that it's 1-based.
* @param callback Function to execute after the fit is done animating.
*/
public fit(fit: Atalasoft.Utils.Fitting,pageNumber: number,callback: NotificationCallback): void;
/**
* Uploads several files on server to the predefined upload folder or to the given path.
* @param files Array of file objects that should be uploaded.
* @param uploadpath Relative path to upload to starting from uploadpath. Must be writable.
* @param callback Function to execute when the upload has requested.
*/
public uploadFiles(files: File[], uploadpath?: string, callback?: NotificationCallback): void;
/**
* Gets the current page index
* Returns: Zero based index of the current page.
*/
public getCurrentPageIndex(): number;
/**
* Gets the current document info
* Returns: object indicating document main page size, and number of pages
*/
public getDocumentInfo(): DocumentInfo;
/**
* Gets the current zoom level of the viewer.
*/
public getZoom(): number;
/**
* Checks whether specified document page have been loaded.
* @param index Page index.
*/
public isPageLoaded(index: number): boolean;
/**
* Indicates whether the viewer is ready to receive commands.
*/
public isReady(): boolean;
/**
* Scrolls to the next viewable page.
* @param n Number of pages to scroll forward.
* @param callback Function to execute when the scroll operation is finished.
*/
public next(n: number,callback: NotificationCallback): void;
/**
* Opens the document at the given urls. It's possible to call this method multiple times for the same document to load document and the forms or annotations data separately.
* @param documenturl url of the document file with respect to the config.serverurl.
* @param annotationsurl url of the annotation xmp file with respect to the config.serverurl
* @param formurl url of the form file with respect to the config.serverurl.
* @param callback Function to execute when the open operation is finished.
*/
public openUrl(documenturl?: string, annotationsurl?: string, formurl?: string, callback?: OpenUrlCallback): void;
/**
* Scrolls to the previous viewable page.
* @param n Number of pages to scroll backward.
* @param callback Function to execute when the scroll operation is finished.
*/
public previous(n: number,callback?: NotificationCallback): void;
/**
* Uploads one file on server to the predefined upload folder or to the given path.
* @param file File object that should be uploaded.
* @param uploadpath Relative path to upload to starting from uploadpath. Must be writable.
* @param callback Function to execute when the upload has requested.
*/
public uploadFile(file: File, uploadpath?: string, callback?: NotificationCallback): void;
/**
* Saves the client changes in this document to the predefined save folder or to the given path.
* @param subpath Relative path to save to starting from savepath. Must be writable.
* @param saveformat Save file format. If specified, the value overrides savefileformat form config.
* @param params A plain object containing optional reload parameters that will be passed to server.
* @param callback to execute when the save has finished
*/
public save(subpath?: string, saveformat?: string, params?: object, callback?: NotificationCallback): void;
/**
* Scrolls by the given deltas, does not account for zoom, i.e. dx and dy values are passed in window coordinate space.
* @param dx Indicating delta of the x axis.
* @param dy Indicating delta of the y axis .
* @param ani Indicating whether to animate this scroll.
* @param callback Function to execute when the scroll operation is finished.
*/
public scrollBy(dx: number, dy: number, ani?: boolean, callback?: NotificationCallback): void;
/**
* Scrolls to the given coordinates, does not account for zoom, i.e. x and y values are passed in window coordinate space.
* @param x Indicating the coordinate of the x axis.
* @param y Indicating the coordinate of the y axis.
* @param ani Indicating whether to animate this scroll.
* @param callback function to execute when the scroll operation is finished.
*/
public scrollTo(x: number, y: number, ani?: boolean, callback?: NotificationCallback): void;
/**
* Detaches the handler from the event.
* @param event the name of the event to unbind.
* @param handler the event handler to unbind. If not specified, all handlers are unbound.
*/
public unbind(event: string,handler?: Function): WebDocumentViewer;
/**
* Triggers the event.
* @param even the name of the event to trigger.
* @param parameters the event data.
*/
public trigger(even: string,parameters?: object): WebDocumentViewer;
/**
* Specifies the behavior of the mouse from within the WebDocumentViewer.
* @param tool
*/
public setMouseTool(tool: Utils.MouseToolType): void;
/**
* Scrolls the viewer to the given page index and executes the callback when finished.
* @param index Index of the page to show.
* @param callback Function to execute after this operation is done.
*/
public showPage(index: number,callback?: NotificationCallback): void;
/**
* Zooms out one level.
* @param callback
*/
public zoomOut(callback?: NotificationCallback): void;
/**
* Scrolls the viewer to the given page number and executes the callback when finished.
* @param pageNumber Number of the page to show. Note that page number is expected 1-based.
* @param callback Function to execute after this operation is done
*/
public showPageNumber(pageNumber: number, callback?: NotificationCallback): void;
//#endregion
public annotations: AnnotationController;
public document: DocumentController;
}
export class WebDocumentThumbnailer extends WebDocumentViewer{
public constructor(config?: WebThumbnailerConfig,openCallback?: OpenUrlCallback);
/**
* Takes ownership over referenced viewer, i.e. if shared viewer is currently displaying other document, it's switched to display document from calling thumbnailer.
*/
public activate(): void;
/**
* Resets the thumbnail highlight at the given index, and scrolls to the next selected thumbnail in the linked viewer, if possible.
* This function doesn't deselect the given index in the single select mode, and in multi select mode, if one page is selected.
* @param index Index of the page to deselect. Can be passed as string representation of a number
* @param callback function that is called when thumbnail has been deselected.
*/
public deselectThumb(index: number|string, callback?: NotificationCallback): void;
/**
* Gets the selected thumbnail index.
*/
public getSelectedPageIndex(): number;
/**
* Gets the selected thumbnails indices with respect of selecteditemsorder parameter value.
*/
public getSelectedPagesIndices(): number[];
/**
* Checks whether current thumbnailer is controlling referenced viewer.
*/
public isActive(): boolean;
/**
* Scrolls the viewer to the given page number and executes the callback when finished
* @param index Index of the page to scroll to.
* @param callback Function to execute after this operation is done.
*/
public scrollToThumb(index: number, callback?: NotificationCallback): void;
/**
* Highlights the thumbnail at the given index, and scrolls to it in the linked viewer, if possible.
* @param index Index of the page to select. Can be passed as string representation of a number
* @param append Append index to the already selected thumbs or not. Its value ignores in single select mode.
* @param callback function that is called when thumbnail has been selected.
*/
public selectThumb(index: number|string, append?: boolean, callback?: NotificationCallback): void;
}
//#region WDV Events
interface BeforeHandlerRequestEvent{
request: AtalaRequest;
}
interface DocumentInfoChangedEvent{
info: DocumentInfo;
customData: Record<string, any>;
}
interface DocumentLoadedEvent{
customData: Record<string, any>;
}
interface DocumentSavedEvent{
success: boolean;
fileName: string;
customData: Record<string, any>;
}
interface ErrorEvent{
name: string;
message: string;
}
interface FileAddedToUploadEvent{
filename: string;
reason: Utils.FileUploadRejectReason;
success: boolean;
}
interface FileuploaderrorEvent{