Skip to content

Commit 67d911e

Browse files
Merge pull request #314 from syncfusion-content/895039-saveButton
895039: add docs for save button
2 parents 0d3de9b + d56d78e commit 67d911e

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
layout: post
3+
title: Add save button in Toolbar in ##Platform_Name## Pdfviewer control | Syncfusion
4+
description: Learn here all about How to add Save button in toolbar in Syncfusion ##Platform_Name## Pdfviewer control of Syncfusion Essential JS 2 and more.
5+
platform: ej2-javascript
6+
control: Toolbar
7+
publishingplatform: ##Platform_Name##
8+
documentation: ug
9+
domainurl: ##DomainURL##
10+
---
11+
12+
# Add Save button in Built-In Toolbar
13+
14+
PDF Viewer allows you to customize(add, show, hide, enable, and disable) existing items in a toolbar.
15+
16+
* Save button - New 'save' button-item can defined by [**CustomToolbarItemModel**](https://ej2.syncfusion.com/javascript/documentation/api/pdfviewer/customToolbarItem/) and with existing items in [**ToolbarSettings**](https://ej2.syncfusion.com/javascript/documentation/api/pdfviewer/toolbarSettings/) property. Newly added save button-item click action can be defined in [`toolbarclick`](https://ej2.syncfusion.com/javascript/documentation/api/toolbar/clickEventArgs/).
17+
18+
* Show, Hide - save button-item can be shown or hidden using the [`ToolbarSettings`](https://ej2.syncfusion.com/javascript/documentation/api/pdfviewer/toolbarSettings/) property. Pre-defined toolbar items are available with [`ToolbarItem`](https://ej2.syncfusion.com/javascript/documentation/api/pdfviewer/toolbarItem/).
19+
20+
* Enable, Disable - Toolbar items can be enabled or disable using [`enabletoolbaritem`](https://ej2.syncfusion.com/javascript/documentation/api/pdfviewer/toolbar/#enabletoolbaritem)
21+
22+
{% tabs %}
23+
{% highlight js tabtitle="Standalone" %}
24+
var toolItem1 = {
25+
prefixIcon: 'e-icons e-save',
26+
id: 'download',
27+
text: 'Save',
28+
tooltipText: 'Save button',
29+
align: 'Left'
30+
};
31+
var pdfviewer = new ej.pdfviewer.PdfViewer({
32+
documentPath:'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf',
33+
resourceUrl:'https://cdn.syncfusion.com/ej2/24.1.41/dist/ej2-pdfviewer-lib',
34+
toolbarSettings : { toolbarItems: ['OpenOption', toolItem1, 'PageNavigationTool', 'MagnificationTool', 'PanTool', 'SelectionTool', 'SearchOption', 'PrintOption', 'UndoRedoTool', 'AnnotationEditTool', 'FormDesignerEditTool', 'CommentTool', 'SubmitForm'] }
35+
});
36+
ej.pdfviewer.PdfViewer.Inject(ej.pdfviewer.TextSelection, ej.pdfviewer.TextSearch, ej.pdfviewer.Print, ej.pdfviewer.Navigation, ej.pdfviewer.Toolbar,ej.pdfviewer.Magnification, ej.pdfviewer.Annotation, ej.pdfviewer.FormDesigner, ej.pdfviewer.FormFields);
37+
38+
//PDF Viewer control rendering starts
39+
pdfviewer.appendTo('#PdfViewer');
40+
pdfviewer.toolbarClick = function (args) {
41+
if (args.item && args.item.id === 'download') {
42+
pdfviewer.download();
43+
}
44+
};
45+
function OnCreateSearch() {
46+
this.addIcon('prepend', 'e-icons e-search');
47+
}
48+
49+
{% endhighlight %}
50+
{% highlight js tabtitle="Server-Backed" %}
51+
52+
var toolItem1 = {
53+
prefixIcon: 'e-icons e-save',
54+
id: 'download',
55+
text: 'Save',
56+
tooltipText: 'Save button',
57+
align: 'Left'
58+
};
59+
var pdfviewer = new ej.pdfviewer.PdfViewer({
60+
documentPath:'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf',
61+
serviceUrl: 'https://services.syncfusion.com/js/production/api/pdfviewer',
62+
toolbarSettings : { toolbarItems: ['OpenOption', toolItem1, 'PageNavigationTool', 'MagnificationTool', 'PanTool', 'SelectionTool', 'SearchOption', 'PrintOption', 'UndoRedoTool', 'AnnotationEditTool', 'FormDesignerEditTool', 'CommentTool', 'SubmitForm'] }
63+
});
64+
ej.pdfviewer.PdfViewer.Inject(ej.pdfviewer.TextSelection, ej.pdfviewer.TextSearch, ej.pdfviewer.Print, ej.pdfviewer.Navigation, ej.pdfviewer.Toolbar,ej.pdfviewer.Magnification, ej.pdfviewer.Annotation, ej.pdfviewer.FormDesigner, ej.pdfviewer.FormFields);
65+
66+
//PDF Viewer control rendering starts
67+
pdfviewer.appendTo('#PdfViewer');
68+
pdfviewer.toolbarClick = function (args) {
69+
if (args.item && args.item.id === 'download') {
70+
pdfviewer.download();
71+
}
72+
};
73+
function OnCreateSearch() {
74+
this.addIcon('prepend', 'e-icons e-search');
75+
}
76+
77+
{% endhighlight %}
78+
{% endtabs %}
79+
80+
81+
N> Default value of toolbar items is ['OpenOption', 'PageNavigationTool','MagnificationTool', 'PanTool', 'SelectionTool', 'SearchOption', 'PrintOption', 'DownloadOption','UndoRedoTool', 'AnnotationEditTool', 'FormDesignerEditTool', 'CommentTool', 'SubmitForm']
82+
83+
### Align Property
84+
85+
The align property is used to specify the alignment of a `save` button-item within the toolbar.
86+
87+
`Left`: Aligns the item to the left side of the toolbar.
88+
`Right`: Aligns the item to the right side of the toolbar.
89+
90+
### Tooltip Property
91+
92+
The tooltip property is used to set the tooltip text for a `save` button-item. Tooltip provides additional information when a user hovers over the item.
93+
94+
### CssClass Property
95+
96+
The cssClass property is used to apply custom CSS classes to a `save` button-item. It allows custom styling of the `save` button-item.
97+
98+
### Prefix Property
99+
100+
The prefix property is used to set the CSS class or icon that should be added as a prefix to the existing content of the `save` button-item.
101+
102+
### ID Property
103+
104+
The id property within a CustomToolbarItemModel is a compulsory attribute that plays a vital role in toolbar customization. It serves as a unique identifier for each toolbar item, facilitating distinct references and interactions.
105+
106+
When defining or customizing toolbar items, it is mandatory to assign a specific and descriptive id to each item.
107+
These properties are commonly used when defining custom toolbar items with the `CustomToolbarItemModel`` in the context of Syncfusion PDF Viewer. When configuring the toolbar using the `ToolbarSettings`` property, you can include these properties to customize the appearance and behavior of each toolbar item.
108+
109+
N> When customizing save button-item, you have the flexibility to include either icons or text based on your design preference.
110+
111+
[View sample in GitHub](https://github.com/SyncfusionExamples/javascript-pdf-viewer-examples/tree/master/How%20to)

0 commit comments

Comments
 (0)