Skip to content

Commit 8850797

Browse files
940507: Sample on How to add Form Design Sign in Default Toolbar
1 parent 773a4f1 commit 8850797

31 files changed

+5910
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.2.32630.192
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApplication5", "WebApplication5\WebApplication5.csproj", "{A2353414-236C-456C-A056-EA7936B2FB5D}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{A2353414-236C-456C-A056-EA7936B2FB5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{A2353414-236C-456C-A056-EA7936B2FB5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{A2353414-236C-456C-A056-EA7936B2FB5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{A2353414-236C-456C-A056-EA7936B2FB5D}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {3204AF55-01CF-43A1-82BB-D2A83742330F}
24+
EndGlobalSection
25+
EndGlobal
Binary file not shown.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
6+
</packageSources>
7+
<fallbackPackageFolders>
8+
<clear />
9+
</fallbackPackageFolders>
10+
<disabledPackageSources>
11+
<clear />
12+
</disabledPackageSources>
13+
</configuration>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@page
2+
@model ErrorModel
3+
@{
4+
ViewData["Title"] = "Error";
5+
}
6+
7+
<h1 class="text-danger">Error.</h1>
8+
<h2 class="text-danger">An error occurred while processing your request.</h2>
9+
10+
@if (Model.ShowRequestId)
11+
{
12+
<p>
13+
<strong>Request ID:</strong> <code>@Model.RequestId</code>
14+
</p>
15+
}
16+
17+
<h3>Development Mode</h3>
18+
<p>
19+
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
20+
</p>
21+
<p>
22+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
23+
It can result in displaying sensitive information from exceptions to end users.
24+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
25+
and restarting the app.
26+
</p>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
using System.Diagnostics;
4+
5+
namespace WebApplication5.Pages
6+
{
7+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
8+
[IgnoreAntiforgeryToken]
9+
public class ErrorModel : PageModel
10+
{
11+
public string? RequestId { get; set; }
12+
13+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
14+
15+
private readonly ILogger<ErrorModel> _logger;
16+
17+
public ErrorModel(ILogger<ErrorModel> logger)
18+
{
19+
_logger = logger;
20+
}
21+
22+
public void OnGet()
23+
{
24+
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
25+
}
26+
}
27+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
@page "{handler?}"
2+
@using Syncfusion.EJ2.PdfViewer;
3+
@using Syncfusion.EJ2
4+
@using System.IO;
5+
@model IndexModel
6+
@{
7+
ViewData["Title"] = "Home page";
8+
var toolItem1 = new { id = "signature", prefixIcon = "e-icons e-signature", tooltipText = "Add Signature", align = "left", template = "<ul id='signatureMenu'></ul>" };
9+
10+
// Directly create a List<object> for toolbar items
11+
List<object> toolbarItems = new List<object>
12+
{
13+
toolItem1,
14+
"OpenOption",
15+
"PageNavigationTool",
16+
"MagnificationTool",
17+
"PanTool",
18+
"SelectionTool",
19+
"SearchOption",
20+
"PrintOption",
21+
"DownloadOption",
22+
"UndoRedoTool",
23+
"AnnotationEditTool",
24+
"FormDesignerEditTool",
25+
"CommentTool",
26+
"SubmitForm"
27+
};
28+
29+
PdfViewerToolbarSettings toolbarSettings = new PdfViewerToolbarSettings()
30+
{
31+
ShowTooltip = true,
32+
ToolbarItems = toolbarItems // Assign the List<object> directly
33+
};
34+
}
35+
<br>
36+
<br>
37+
<ejs-pdfviewer id="pdfviewer" style="height:600px" toolbarSettings="toolbarSettings" documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf" documentLoad="documentLoad">
38+
</ejs-pdfviewer>
39+
<script>
40+
var isSignatureAdded = false;
41+
function documentLoad(args) {
42+
if (!isSignatureAdded) {
43+
var signatureMenuItems = [
44+
{
45+
iconCss: 'e-icons e-signature',
46+
items: [{ text: 'Add Signature' }, { text: 'Add Initial' }],
47+
},
48+
];
49+
new ej.navigations.Menu(
50+
{
51+
items: signatureMenuItems,
52+
showItemOnClick: true,
53+
select: onSignatureClick,
54+
},
55+
'#signatureMenu'
56+
);
57+
isSignatureAdded = true;
58+
}
59+
};
60+
function onSignatureClick(event) {
61+
var viewer = document.getElementById('pdfviewer').ej2_instances[0];
62+
if (event.element.innerText === 'Add Signature') {
63+
viewer.designerMode = true;
64+
viewer.formDesignerModule.setFormFieldMode("SignatureField");
65+
} else if (event.element.innerText === 'Add Initial') {
66+
viewer.designerMode = true;
67+
viewer.formDesignerModule.setFormFieldMode("InitialField");
68+
}
69+
}
70+
</script>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.Extensions.Caching.Memory;
3+
using Syncfusion.EJ2.PdfViewer;
4+
using Newtonsoft.Json;
5+
using Microsoft.AspNetCore.Mvc.RazorPages;
6+
using System.Reflection;
7+
using Syncfusion.Pdf.Parsing;
8+
//using SkiaSharp;
9+
using Syncfusion.Pdf.Graphics;
10+
using Syncfusion.Pdf.Security;
11+
using Syncfusion.Pdf;
12+
using System.Security.Cryptography.X509Certificates;
13+
using Syncfusion.Drawing;
14+
using System.IO;
15+
using Syncfusion.Pdf.Interactive;
16+
using Syncfusion.Pdf.Redaction;
17+
using System.Text.Json.Nodes;
18+
using SkiaSharp;
19+
20+
namespace WebApplication5.Pages
21+
{
22+
[IgnoreAntiforgeryToken(Order = 1001)]
23+
public class IndexModel : PageModel
24+
{
25+
private readonly IWebHostEnvironment _hostingEnvironment;
26+
private IMemoryCache _cache;
27+
public IndexModel(IWebHostEnvironment hostingEnvironment, IMemoryCache cache)
28+
{
29+
_hostingEnvironment = hostingEnvironment;
30+
_cache = cache;
31+
}
32+
33+
public class CustomToolbarItems
34+
{
35+
public CustomToolbarItems() { }
36+
public List<object> ToolbarItems { get; set; }
37+
38+
}
39+
}
40+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@page
2+
@model PrivacyModel
3+
@{
4+
ViewData["Title"] = "Privacy Policy";
5+
}
6+
<h1>@ViewData["Title"]</h1>
7+
8+
<p>Use this page to detail your site's privacy policy.</p>

0 commit comments

Comments
 (0)