5
5
AnnotationService , TextSearchService , TextSelectionService ,
6
6
PrintService , FormDesignerService , FormFieldsService , CustomToolbarItemModel
7
7
} from '@syncfusion/ej2-angular-pdfviewer' ;
8
+ import { ComboBox } from "@syncfusion/ej2-dropdowns" ;
9
+ import { TextBox } from "@syncfusion/ej2-inputs" ;
8
10
9
11
@Component ( {
10
12
selector : 'app-root' ,
@@ -25,20 +27,40 @@ import {
25
27
export class AppComponent implements OnInit {
26
28
public document = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf' ;
27
29
public resource = 'https://cdn.syncfusion.com/ej2/24.1.41/dist/ej2-pdfviewer-lib' ;
28
-
29
- public toolItem : CustomToolbarItemModel = {
30
+
31
+ public toolItem1 : CustomToolbarItemModel = {
30
32
prefixIcon : 'e-icons e-paste' ,
31
33
id : 'print' ,
32
34
tooltipText : 'Custom toolbar item' ,
33
- align : 'left'
34
35
} ;
35
-
36
+ public toolItem2 : CustomToolbarItemModel = {
37
+ id : 'download' ,
38
+ text : 'Save' ,
39
+ tooltipText : 'Custom toolbar item' ,
40
+ align : 'right'
41
+ } ;
42
+ LanguageList : string [ ] = [ 'Typescript' , 'Javascript' , 'Angular' , 'C#' , 'C' , 'Python' ] ;
43
+ public toolItem3 : CustomToolbarItemModel = {
44
+ type : 'Input' ,
45
+ tooltipText : 'Language List' ,
46
+ cssClass : 'percentage' ,
47
+ align : 'Left' ,
48
+ id : 'dropdown' ,
49
+ template : new ComboBox ( { width : 100 , value : 'TypeScript' , dataSource : this . LanguageList , popupWidth : 85 , showClearButton : false , readonly : false } )
50
+ } ;
51
+ public toolItem4 : CustomToolbarItemModel = {
52
+ type : 'Input' ,
53
+ tooltipText : 'Text' ,
54
+ align : 'Right' ,
55
+ cssClass : 'find' ,
56
+ id : 'textbox' ,
57
+ template : new TextBox ( { width : 125 , placeholder : 'Type Here' , created : this . OnCreateSearch } )
58
+ }
36
59
public toolbarSettings = {
37
60
showTooltip : true ,
38
- toolbarItems : [ this . toolItem , 'OpenOption' , 'PageNavigationTool' , 'MagnificationTool' , 'PanTool' , 'SelectionTool' ,
39
- 'SearchOption' , 'PrintOption' , 'DownloadOption' , 'UndoRedoTool' , 'AnnotationEditTool' ,
40
- 'FormDesignerEditTool' , 'CommentTool' , 'SubmitForm' , this . toolItem ]
61
+ toolbarItems : [ this . toolItem1 , this . toolItem2 , 'OpenOption' , 'PageNavigationTool' , 'MagnificationTool' , this . toolItem3 , 'PanTool' , 'SelectionTool' , 'SearchOption' , 'PrintOption' , 'DownloadOption' , 'UndoRedoTool' , 'AnnotationEditTool' , 'FormDesignerEditTool' , this . toolItem4 , 'CommentTool' , 'SubmitForm' ]
41
62
} ;
63
+
42
64
public toolbarClick ( args : any ) : void {
43
65
var pdfViewer = ( < any > document . getElementById ( 'pdfViewer' ) ) . ej2_instances [ 0 ] ;
44
66
if ( args . item && args . item . id === 'print' ) {
@@ -47,8 +69,9 @@ export class AppComponent implements OnInit {
47
69
pdfViewer . download ( ) ;
48
70
}
49
71
}
50
- ngOnInit ( ) : void {
72
+ public OnCreateSearch ( this : any ) : any {
73
+ this . addIcon ( 'prepend' , 'e-icons e-search' ) ;
51
74
}
52
-
53
-
75
+ ngOnInit ( ) : void {
54
76
}
77
+ }
0 commit comments