Skip to content

Commit 5c53512

Browse files
905903: Updated sample for Customize existing toolbar both standalone and Server-Backed
1 parent e08833d commit 5c53512

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+757
-110
lines changed

How to/Customize existing toolbar/PDFViewerSample.csproj

Lines changed: 0 additions & 14 deletions
This file was deleted.

How to/Customize existing toolbar/Pages/Shared/_Layout.cshtml

Lines changed: 0 additions & 51 deletions
This file was deleted.

How to/Customize existing toolbar/README.md

Lines changed: 0 additions & 26 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
4-
VisualStudioVersion = 17.0.32112.339
4+
VisualStudioVersion = 17.10.34607.79
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDFViewerSample", "PDFViewerSample.csproj", "{39AA1883-BB43-4C46-9892-6033EA59C990}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToolbarCustomization", "ToolbarCustomization\ToolbarCustomization.csproj", "{A03771AD-04BE-4843-8FF8-BCBC1FA49EDD}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1010
Debug|Any CPU = Debug|Any CPU
1111
Release|Any CPU = Release|Any CPU
1212
EndGlobalSection
1313
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14-
{39AA1883-BB43-4C46-9892-6033EA59C990}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{39AA1883-BB43-4C46-9892-6033EA59C990}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{39AA1883-BB43-4C46-9892-6033EA59C990}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{39AA1883-BB43-4C46-9892-6033EA59C990}.Release|Any CPU.Build.0 = Release|Any CPU
14+
{A03771AD-04BE-4843-8FF8-BCBC1FA49EDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{A03771AD-04BE-4843-8FF8-BCBC1FA49EDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{A03771AD-04BE-4843-8FF8-BCBC1FA49EDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{A03771AD-04BE-4843-8FF8-BCBC1FA49EDD}.Release|Any CPU.Build.0 = Release|Any CPU
1818
EndGlobalSection
1919
GlobalSection(SolutionProperties) = preSolution
2020
HideSolutionNode = FALSE
2121
EndGlobalSection
2222
GlobalSection(ExtensibilityGlobals) = postSolution
23-
SolutionGuid = {5F13CE16-9CC4-4755-AFB4-367F461A209C}
23+
SolutionGuid = {31245B35-82FC-4C3B-A888-4730D0AD8EE0}
2424
EndGlobalSection
2525
EndGlobal

How to/Customize existing toolbar/Pages/Error.cshtml.cs renamed to How to/Customize existing toolbar/Server-Backed/ToolbarCustomization/Pages/Error.cshtml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ public void OnGet()
2424
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
2525
}
2626
}
27-
}
27+
28+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
@page "{handler?}"
2+
@model IndexModel
3+
@using Syncfusion.EJ2.PdfViewer
4+
@using Newtonsoft.Json
5+
@{
6+
ViewData["Title"] = "Home page";
7+
CustomToolbarItems customToolbarItems = new CustomToolbarItems();
8+
var toolItem1 = new { id = "submit_form", text = "Submit Form", tooltipText = "Custom toolbar item", align = "Center", cssClass = "custom_button" };
9+
customToolbarItems.ToolbarItems = new List<object> { toolItem1, "OpenOption", "PageNavigationTool", "MagnificationTool", "PanTool", "SelectionTool", "SearchOption", "PrintOption", "DownloadOption", "UndoRedoTool", "AnnotationEditTool", "FormDesignerEditTool", "CommentTool" };
10+
PdfViewerToolbarSettings toolbarSettings = new PdfViewerToolbarSettings()
11+
{
12+
ShowTooltip = true,
13+
ToolbarItems = customToolbarItems.ToolbarItems
14+
};
15+
}
16+
17+
<br>
18+
<br>
19+
<div>
20+
<ejs-pdfviewer id="pdfviewer" style="height:600px"
21+
serviceUrl="/Index"
22+
documentPath="https://cdn.syncfusion.com/content/pdf/form-designer.pdf"
23+
toolbarClick="toolbarClick"
24+
ToolbarSettings="toolbarSettings">
25+
26+
</ejs-pdfviewer>
27+
</div>
28+
29+
<script>
30+
function toolbarClick(args) {
31+
var viewer = document.getElementById('pdfviewer').ej2_instances[0];
32+
if (args.item && args.item.id === 'submit_form') {
33+
alert('Custom button clicked!');
34+
}
35+
}
36+
</script>
37+
38+
<style>
39+
.custom_button {
40+
height: 100% !important;
41+
}
42+
</style>

0 commit comments

Comments
 (0)