Skip to content

Commit 46ef4b9

Browse files
Merge pull request #25 from SyncfusionExamples/856503-icon
856503-icon : Sample update for the customize the toolbar
2 parents 5bd0c37 + 54f9c46 commit 46ef4b9

File tree

2 files changed

+34
-10
lines changed

2 files changed

+34
-10
lines changed

How to/Customize existing toolbar/src/app/app.component.ts

+33-10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {
55
AnnotationService, TextSearchService, TextSelectionService,
66
PrintService, FormDesignerService, FormFieldsService, CustomToolbarItemModel
77
} from '@syncfusion/ej2-angular-pdfviewer';
8+
import { ComboBox } from "@syncfusion/ej2-dropdowns";
9+
import { TextBox } from "@syncfusion/ej2-inputs";
810

911
@Component({
1012
selector: 'app-root',
@@ -25,20 +27,40 @@ import {
2527
export class AppComponent implements OnInit {
2628
public document = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
2729
public resource = 'https://cdn.syncfusion.com/ej2/24.1.41/dist/ej2-pdfviewer-lib';
28-
29-
public toolItem: CustomToolbarItemModel = {
30+
31+
public toolItem1: CustomToolbarItemModel = {
3032
prefixIcon: 'e-icons e-paste',
3133
id: 'print',
3234
tooltipText: 'Custom toolbar item',
33-
align: 'left'
3435
};
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+
}
3659
public toolbarSettings = {
3760
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']
4162
};
63+
4264
public toolbarClick(args: any): void {
4365
var pdfViewer = (<any>document.getElementById('pdfViewer')).ej2_instances[0];
4466
if (args.item && args.item.id === 'print') {
@@ -47,8 +69,9 @@ export class AppComponent implements OnInit {
4769
pdfViewer.download();
4870
}
4971
}
50-
ngOnInit(): void {
72+
public OnCreateSearch(this: any): any {
73+
this.addIcon('prepend', 'e-icons e-search');
5174
}
52-
53-
75+
ngOnInit(): void {
5476
}
77+
}

How to/Customize existing toolbar/src/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<link rel="icon" type="image/x-icon" href="favicon.ico">
99
</head>
1010
<body>
11+
<br><br><br>
1112
<app-root></app-root>
1213
</body>
1314
</html>

0 commit comments

Comments
 (0)