diff --git a/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog.sln b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog.sln new file mode 100644 index 0000000..a98a670 --- /dev/null +++ b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33205.214 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomizeSignatureDialog", "CustomizeSignatureDialog\CustomizeSignatureDialog.csproj", "{2BA4F0EE-9267-4ECB-A85D-128F701E8174}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2BA4F0EE-9267-4ECB-A85D-128F701E8174}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2BA4F0EE-9267-4ECB-A85D-128F701E8174}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2BA4F0EE-9267-4ECB-A85D-128F701E8174}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2BA4F0EE-9267-4ECB-A85D-128F701E8174}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F57A69AC-09FE-45D4-A413-5AB3BB258580} + EndGlobalSection +EndGlobal diff --git a/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/CustomizeSignatureDialog.csproj b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/CustomizeSignatureDialog.csproj new file mode 100644 index 0000000..8d689ac --- /dev/null +++ b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/CustomizeSignatureDialog.csproj @@ -0,0 +1,14 @@ + + + + net6.0 + enable + enable + + + + + + + + diff --git a/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Data/FormDesigner.pdf b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Data/FormDesigner.pdf new file mode 100644 index 0000000..9b8f9ee Binary files /dev/null and b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Data/FormDesigner.pdf differ diff --git a/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/Index.cshtml b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/Index.cshtml new file mode 100644 index 0000000..afec7d3 --- /dev/null +++ b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/Index.cshtml @@ -0,0 +1,35 @@ +@page "{handler?}" +@model IndexModel +@{ + ViewData["Title"] = "Home page"; +} +
+
+ + +
+ + + + + \ No newline at end of file diff --git a/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/Index.cshtml.cs b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/Index.cshtml.cs new file mode 100644 index 0000000..28d7e38 --- /dev/null +++ b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/Index.cshtml.cs @@ -0,0 +1,257 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Caching.Memory; +using Syncfusion.EJ2.PdfViewer; +using Newtonsoft.Json; +using Microsoft.AspNetCore.Mvc.RazorPages; +using System.Reflection; + +namespace CustomizeSignatureDialog.Pages +{ + [IgnoreAntiforgeryToken(Order = 1001)] + public class IndexModel : PageModel + { + + private readonly Microsoft.AspNetCore.Hosting.IHostingEnvironment _hostingEnvironment; + private IMemoryCache _cache; + + public IndexModel(Microsoft.AspNetCore.Hosting.IHostingEnvironment hostingEnvironment, IMemoryCache cache) + { + _hostingEnvironment = hostingEnvironment; + _cache = cache; + } + + public IActionResult OnPostLoad([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + MemoryStream stream = new MemoryStream(); + var jsonObject = JsonConverterstring(responseData); + object jsonResult = new object(); + if (jsonObject != null && jsonObject.ContainsKey("document")) + { + if (bool.Parse(jsonObject["isFileName"])) + { + string documentPath = GetDocumentPath(jsonObject["document"]); + if (!string.IsNullOrEmpty(documentPath)) + { + byte[] bytes = System.IO.File.ReadAllBytes(documentPath); + stream = new MemoryStream(bytes); + } + else + { + return this.Content(jsonObject["document"] + " is not found"); + } + } + else + { + byte[] bytes = Convert.FromBase64String(jsonObject["document"]); + stream = new MemoryStream(bytes); + } + } + jsonResult = pdfviewer.Load(stream, jsonObject); + return Content(JsonConvert.SerializeObject(jsonResult)); + } + + public Dictionary JsonConverterstring(jsonObjects results) + { + Dictionary resultObjects = new Dictionary(); + resultObjects = results.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public) + .ToDictionary(prop => prop.Name, prop => prop.GetValue(results, null)); + var emptyObjects = (from kv in resultObjects + where kv.Value != null + select kv).ToDictionary(kv => kv.Key, kv => kv.Value); + Dictionary jsonResult = emptyObjects.ToDictionary(k => k.Key, k => k.Value.ToString()); + return jsonResult; + } + + //Post action for processing the PDF documents. + public IActionResult OnPostRenderPdfPages([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + object jsonResult = pdfviewer.GetPage(jsonObject); + return Content(JsonConvert.SerializeObject(jsonResult)); + } + + //Post action for unloading and disposing the PDF document resources + public IActionResult OnPostUnload([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + pdfviewer.ClearCache(jsonObject); + return this.Content("Document cache is cleared"); + } + + //Post action for rendering the ThumbnailImages + public IActionResult OnPostRenderThumbnailImages([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + object result = pdfviewer.GetThumbnailImages(jsonObject); + return Content(JsonConvert.SerializeObject(result)); + } + + //Post action for processing the bookmarks from the PDF documents + public IActionResult OnPostBookmarks([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + object jsonResult = pdfviewer.GetBookmarks(jsonObject); + return Content(JsonConvert.SerializeObject(jsonResult)); + } + + //Post action for rendering the annotation comments + public IActionResult OnPostRenderAnnotationComments([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + object jsonResult = pdfviewer.GetAnnotationComments(jsonObject); + return Content(JsonConvert.SerializeObject(jsonResult)); + } + + //Post action for exporting the annotations + public IActionResult OnPostExportAnnotations([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + string jsonResult = pdfviewer.ExportAnnotation(jsonObject); + return Content(jsonResult); + } + + //Post action for importing the annotations + public IActionResult OnPostImportAnnotations([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + string jsonResult = string.Empty; + object JsonResult; + if (jsonObject != null && jsonObject.ContainsKey("fileName")) + { + string documentPath = GetDocumentPath(jsonObject["fileName"]); + if (!string.IsNullOrEmpty(documentPath)) + { + jsonResult = System.IO.File.ReadAllText(documentPath); + } + else + { + return this.Content(jsonObject["document"] + " is not found"); + } + } + else + { + string extension = Path.GetExtension(jsonObject["importedData"]); + if (extension != ".xfdf") + { + JsonResult = pdfviewer.ImportAnnotation(jsonObject); + return Content(JsonConvert.SerializeObject(JsonResult)); + } + else + { + string documentPath = GetDocumentPath(jsonObject["importedData"]); + if (!string.IsNullOrEmpty(documentPath)) + { + byte[] bytes = System.IO.File.ReadAllBytes(documentPath); + jsonObject["importedData"] = Convert.ToBase64String(bytes); + JsonResult = pdfviewer.ImportAnnotation(jsonObject); + return Content(JsonConvert.SerializeObject(JsonResult)); + } + else + { + return this.Content(jsonObject["document"] + " is not found"); + } + } + } + return Content(jsonResult); + } + + //Post action for downloading the PDF documents + public IActionResult OnPostDownload([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + string documentBase = pdfviewer.GetDocumentAsBase64(jsonObject); + return Content(documentBase); + } + + //Post action for printing the PDF documents + public IActionResult OnPostPrintImages([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + object pageImage = pdfviewer.GetPrintImage(jsonObject); + return Content(JsonConvert.SerializeObject(pageImage)); + } + + //Gets the path of the PDF document + private string GetDocumentPath(string document) + { + string documentPath = string.Empty; + if (!System.IO.File.Exists(document)) + { + string basePath = _hostingEnvironment.WebRootPath; + string dataPath = string.Empty; + dataPath = basePath + "/"; + if (System.IO.File.Exists(dataPath + (document))) + documentPath = dataPath + document; + } + else + { + documentPath = document; + } + return documentPath; + } + } + + public class jsonObjects + { + public string document { get; set; } + public string password { get; set; } + public string zoomFactor { get; set; } + public string isFileName { get; set; } + public string xCoordinate { get; set; } + public string yCoordinate { get; set; } + public string pageNumber { get; set; } + public string documentId { get; set; } + public string hashId { get; set; } + public string sizeX { get; set; } + public string sizeY { get; set; } + public string startPage { get; set; } + public string endPage { get; set; } + public string stampAnnotations { get; set; } + public string textMarkupAnnotations { get; set; } + public string stickyNotesAnnotation { get; set; } + public string shapeAnnotations { get; set; } + public string measureShapeAnnotations { get; set; } + public string action { get; set; } + public string pageStartIndex { get; set; } + public string pageEndIndex { get; set; } + public string fileName { get; set; } + public string elementId { get; set; } + public string pdfAnnotation { get; set; } + public string importPageList { get; set; } + public string uniqueId { get; set; } + public string data { get; set; } + public string viewPortWidth { get; set; } + public string viewPortHeight { get; set; } + public string tilecount { get; set; } + public bool isCompletePageSizeNotReceived { get; set; } + public string freeTextAnnotation { get; set; } + public string signatureData { get; set; } + public string fieldsData { get; set; } + public string FormDesigner { get; set; } + public string inkSignatureData { get; set; } + public bool hideEmptyDigitalSignatureFields { get; set; } + public bool showDigitalSignatureAppearance { get; set; } + public bool digitalSignaturePresent { get; set; } + public string tileXCount { get; set; } + public string tileYCount { get; set; } + public string digitalSignaturePageList { get; set; } + public string annotationCollection { get; set; } + public string annotationsPageList { get; set; } + public string formFieldsPageList { get; set; } + public bool isAnnotationsExist { get; set; } + public bool isFormFieldAnnotationsExist { get; set; } + public string documentLiveCount { get; set; } + public string annotationDataFormat { get; set; } + public string importedData { get; set; } + } +} \ No newline at end of file diff --git a/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/Shared/_Layout.cshtml b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/Shared/_Layout.cshtml new file mode 100644 index 0000000..54ff1e1 --- /dev/null +++ b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/Shared/_Layout.cshtml @@ -0,0 +1,26 @@ + + + + + + + + + + + + +
+
+ @RenderBody() +
+
+ + + + + + @await RenderSectionAsync("Scripts", required: false) + + + \ No newline at end of file diff --git a/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/Shared/_Layout.cshtml.css b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/Shared/_Layout.cshtml.css new file mode 100644 index 0000000..c04d2df --- /dev/null +++ b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/Shared/_Layout.cshtml.css @@ -0,0 +1,48 @@ +/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification +for details on configuring this project to bundle and minify static web assets. */ + +a.navbar-brand { + white-space: normal; + text-align: center; + word-break: break-all; +} + +a { + color: #0077cc; +} + +.btn-primary { + color: #fff; + background-color: #1b6ec2; + border-color: #1861ac; +} + +.nav-pills .nav-link.active, .nav-pills .show > .nav-link { + color: #fff; + background-color: #1b6ec2; + border-color: #1861ac; +} + +.border-top { + border-top: 1px solid #e5e5e5; +} +.border-bottom { + border-bottom: 1px solid #e5e5e5; +} + +.box-shadow { + box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); +} + +button.accept-policy { + font-size: 1rem; + line-height: inherit; +} + +.footer { + position: absolute; + bottom: 0; + width: 100%; + white-space: nowrap; + line-height: 60px; +} diff --git a/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/_ViewImports.cshtml b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/_ViewImports.cshtml new file mode 100644 index 0000000..ba0510c --- /dev/null +++ b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/_ViewImports.cshtml @@ -0,0 +1,4 @@ +@using CustomizeSignatureDialog +@namespace CustomizeSignatureDialog.Pages +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, Syncfusion.EJ2 \ No newline at end of file diff --git a/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/_ViewStart.cshtml b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/_ViewStart.cshtml new file mode 100644 index 0000000..6e88aa3 --- /dev/null +++ b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Pages/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Program.cs b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Program.cs new file mode 100644 index 0000000..b580f44 --- /dev/null +++ b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Program.cs @@ -0,0 +1,25 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +builder.Services.AddRazorPages(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (!app.Environment.IsDevelopment()) +{ + app.UseExceptionHandler("/Error"); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); +} + +app.UseHttpsRedirection(); +app.UseStaticFiles(); + +app.UseRouting(); + +app.UseAuthorization(); + +app.MapRazorPages(); + +app.Run(); diff --git a/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Properties/launchSettings.json b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Properties/launchSettings.json new file mode 100644 index 0000000..2be47dd --- /dev/null +++ b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/Properties/launchSettings.json @@ -0,0 +1,28 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:6185", + "sslPort": 44306 + } + }, + "profiles": { + "CustomizeSignatureDialog": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7112;http://localhost:5265", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/appsettings.Development.json b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/appsettings.Development.json new file mode 100644 index 0000000..f042c67 --- /dev/null +++ b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "DetailedErrors": true, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/appsettings.json b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/appsettings.json new file mode 100644 index 0000000..4d56694 --- /dev/null +++ b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/wwwroot/favicon.ico b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/wwwroot/favicon.ico new file mode 100644 index 0000000..63e859b Binary files /dev/null and b/Form Field/Customize signature dialog/CustomizeSignatureDialog/CustomizeSignatureDialog/wwwroot/favicon.ico differ diff --git a/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields.sln b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields.sln new file mode 100644 index 0000000..4689298 --- /dev/null +++ b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33205.214 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NavigatetoSignatureFields", "NavigatetoSignatureFields\NavigatetoSignatureFields.csproj", "{F1EDAC9B-3AD4-47C8-8253-F4935DBDB4CF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F1EDAC9B-3AD4-47C8-8253-F4935DBDB4CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1EDAC9B-3AD4-47C8-8253-F4935DBDB4CF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1EDAC9B-3AD4-47C8-8253-F4935DBDB4CF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1EDAC9B-3AD4-47C8-8253-F4935DBDB4CF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4C95EB31-D38E-44CC-8925-81F6D0E486B3} + EndGlobalSection +EndGlobal diff --git a/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Data/samplePdf.pdf b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Data/samplePdf.pdf new file mode 100644 index 0000000..bd27c5e Binary files /dev/null and b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Data/samplePdf.pdf differ diff --git a/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/NavigatetoSignatureFields.csproj b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/NavigatetoSignatureFields.csproj new file mode 100644 index 0000000..e6a1fe1 --- /dev/null +++ b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/NavigatetoSignatureFields.csproj @@ -0,0 +1,12 @@ + + + + net6.0 + enable + enable + + + + + + diff --git a/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/Index.cshtml b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/Index.cshtml new file mode 100644 index 0000000..3a3148c --- /dev/null +++ b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/Index.cshtml @@ -0,0 +1,30 @@ +@page "{handler?}" +@using Syncfusion.EJ2.PdfViewer; +@model IndexModel +@{ + ViewData["Title"] = "Home page"; + +} + + +
+
+ + + + + \ No newline at end of file diff --git a/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/Index.cshtml.cs b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/Index.cshtml.cs new file mode 100644 index 0000000..1b6c67b --- /dev/null +++ b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/Index.cshtml.cs @@ -0,0 +1,257 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Caching.Memory; +using Syncfusion.EJ2.PdfViewer; +using Newtonsoft.Json; +using Microsoft.AspNetCore.Mvc.RazorPages; +using System.Reflection; + +namespace NavigatetoSignatureFields.Pages +{ + [IgnoreAntiforgeryToken(Order = 1001)] + public class IndexModel : PageModel + { + + private readonly Microsoft.AspNetCore.Hosting.IHostingEnvironment _hostingEnvironment; + private IMemoryCache _cache; + + public IndexModel(Microsoft.AspNetCore.Hosting.IHostingEnvironment hostingEnvironment, IMemoryCache cache) + { + _hostingEnvironment = hostingEnvironment; + _cache = cache; + } + + public IActionResult OnPostLoad([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + MemoryStream stream = new MemoryStream(); + var jsonObject = JsonConverterstring(responseData); + object jsonResult = new object(); + if (jsonObject != null && jsonObject.ContainsKey("document")) + { + if (bool.Parse(jsonObject["isFileName"])) + { + string documentPath = GetDocumentPath(jsonObject["document"]); + if (!string.IsNullOrEmpty(documentPath)) + { + byte[] bytes = System.IO.File.ReadAllBytes(documentPath); + stream = new MemoryStream(bytes); + } + else + { + return this.Content(jsonObject["document"] + " is not found"); + } + } + else + { + byte[] bytes = Convert.FromBase64String(jsonObject["document"]); + stream = new MemoryStream(bytes); + } + } + jsonResult = pdfviewer.Load(stream, jsonObject); + return Content(JsonConvert.SerializeObject(jsonResult)); + } + + public Dictionary JsonConverterstring(jsonObjects results) + { + Dictionary resultObjects = new Dictionary(); + resultObjects = results.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public) + .ToDictionary(prop => prop.Name, prop => prop.GetValue(results, null)); + var emptyObjects = (from kv in resultObjects + where kv.Value != null + select kv).ToDictionary(kv => kv.Key, kv => kv.Value); + Dictionary jsonResult = emptyObjects.ToDictionary(k => k.Key, k => k.Value.ToString()); + return jsonResult; + } + + //Post action for processing the PDF documents. + public IActionResult OnPostRenderPdfPages([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + object jsonResult = pdfviewer.GetPage(jsonObject); + return Content(JsonConvert.SerializeObject(jsonResult)); + } + + //Post action for unloading and disposing the PDF document resources + public IActionResult OnPostUnload([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + pdfviewer.ClearCache(jsonObject); + return this.Content("Document cache is cleared"); + } + + //Post action for rendering the ThumbnailImages + public IActionResult OnPostRenderThumbnailImages([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + object result = pdfviewer.GetThumbnailImages(jsonObject); + return Content(JsonConvert.SerializeObject(result)); + } + + //Post action for processing the bookmarks from the PDF documents + public IActionResult OnPostBookmarks([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + object jsonResult = pdfviewer.GetBookmarks(jsonObject); + return Content(JsonConvert.SerializeObject(jsonResult)); + } + + //Post action for rendering the annotation comments + public IActionResult OnPostRenderAnnotationComments([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + object jsonResult = pdfviewer.GetAnnotationComments(jsonObject); + return Content(JsonConvert.SerializeObject(jsonResult)); + } + + //Post action for exporting the annotations + public IActionResult OnPostExportAnnotations([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + string jsonResult = pdfviewer.ExportAnnotation(jsonObject); + return Content(jsonResult); + } + + //Post action for importing the annotations + public IActionResult OnPostImportAnnotations([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + string jsonResult = string.Empty; + object JsonResult; + if (jsonObject != null && jsonObject.ContainsKey("fileName")) + { + string documentPath = GetDocumentPath(jsonObject["fileName"]); + if (!string.IsNullOrEmpty(documentPath)) + { + jsonResult = System.IO.File.ReadAllText(documentPath); + } + else + { + return this.Content(jsonObject["document"] + " is not found"); + } + } + else + { + string extension = Path.GetExtension(jsonObject["importedData"]); + if (extension != ".xfdf") + { + JsonResult = pdfviewer.ImportAnnotation(jsonObject); + return Content(JsonConvert.SerializeObject(JsonResult)); + } + else + { + string documentPath = GetDocumentPath(jsonObject["importedData"]); + if (!string.IsNullOrEmpty(documentPath)) + { + byte[] bytes = System.IO.File.ReadAllBytes(documentPath); + jsonObject["importedData"] = Convert.ToBase64String(bytes); + JsonResult = pdfviewer.ImportAnnotation(jsonObject); + return Content(JsonConvert.SerializeObject(JsonResult)); + } + else + { + return this.Content(jsonObject["document"] + " is not found"); + } + } + } + return Content(jsonResult); + } + + //Post action for downloading the PDF documents + public IActionResult OnPostDownload([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + string documentBase = pdfviewer.GetDocumentAsBase64(jsonObject); + return Content(documentBase); + } + + //Post action for printing the PDF documents + public IActionResult OnPostPrintImages([FromBody] jsonObjects responseData) + { + PdfRenderer pdfviewer = new PdfRenderer(_cache); + var jsonObject = JsonConverterstring(responseData); + object pageImage = pdfviewer.GetPrintImage(jsonObject); + return Content(JsonConvert.SerializeObject(pageImage)); + } + + //Gets the path of the PDF document + private string GetDocumentPath(string document) + { + string documentPath = string.Empty; + if (!System.IO.File.Exists(document)) + { + string basePath = _hostingEnvironment.WebRootPath; + string dataPath = string.Empty; + dataPath = basePath + "/"; + if (System.IO.File.Exists(dataPath + (document))) + documentPath = dataPath + document; + } + else + { + documentPath = document; + } + return documentPath; + } + } + + public class jsonObjects + { + public string document { get; set; } + public string password { get; set; } + public string zoomFactor { get; set; } + public string isFileName { get; set; } + public string xCoordinate { get; set; } + public string yCoordinate { get; set; } + public string pageNumber { get; set; } + public string documentId { get; set; } + public string hashId { get; set; } + public string sizeX { get; set; } + public string sizeY { get; set; } + public string startPage { get; set; } + public string endPage { get; set; } + public string stampAnnotations { get; set; } + public string textMarkupAnnotations { get; set; } + public string stickyNotesAnnotation { get; set; } + public string shapeAnnotations { get; set; } + public string measureShapeAnnotations { get; set; } + public string action { get; set; } + public string pageStartIndex { get; set; } + public string pageEndIndex { get; set; } + public string fileName { get; set; } + public string elementId { get; set; } + public string pdfAnnotation { get; set; } + public string importPageList { get; set; } + public string uniqueId { get; set; } + public string data { get; set; } + public string viewPortWidth { get; set; } + public string viewPortHeight { get; set; } + public string tilecount { get; set; } + public bool isCompletePageSizeNotReceived { get; set; } + public string freeTextAnnotation { get; set; } + public string signatureData { get; set; } + public string fieldsData { get; set; } + public string FormDesigner { get; set; } + public string inkSignatureData { get; set; } + public bool hideEmptyDigitalSignatureFields { get; set; } + public bool showDigitalSignatureAppearance { get; set; } + public bool digitalSignaturePresent { get; set; } + public string tileXCount { get; set; } + public string tileYCount { get; set; } + public string digitalSignaturePageList { get; set; } + public string annotationCollection { get; set; } + public string annotationsPageList { get; set; } + public string formFieldsPageList { get; set; } + public bool isAnnotationsExist { get; set; } + public bool isFormFieldAnnotationsExist { get; set; } + public string documentLiveCount { get; set; } + public string annotationDataFormat { get; set; } + public string importedData { get; set; } + } +} \ No newline at end of file diff --git a/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/Shared/_Layout.cshtml b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/Shared/_Layout.cshtml new file mode 100644 index 0000000..f8a0e24 --- /dev/null +++ b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/Shared/_Layout.cshtml @@ -0,0 +1,23 @@ + + + + + + + + + + + + +
+
+ @RenderBody() +
+
+ + + @await RenderSectionAsync("Scripts", required: false) + + + \ No newline at end of file diff --git a/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/Shared/_Layout.cshtml.css b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/Shared/_Layout.cshtml.css new file mode 100644 index 0000000..c04d2df --- /dev/null +++ b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/Shared/_Layout.cshtml.css @@ -0,0 +1,48 @@ +/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification +for details on configuring this project to bundle and minify static web assets. */ + +a.navbar-brand { + white-space: normal; + text-align: center; + word-break: break-all; +} + +a { + color: #0077cc; +} + +.btn-primary { + color: #fff; + background-color: #1b6ec2; + border-color: #1861ac; +} + +.nav-pills .nav-link.active, .nav-pills .show > .nav-link { + color: #fff; + background-color: #1b6ec2; + border-color: #1861ac; +} + +.border-top { + border-top: 1px solid #e5e5e5; +} +.border-bottom { + border-bottom: 1px solid #e5e5e5; +} + +.box-shadow { + box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); +} + +button.accept-policy { + font-size: 1rem; + line-height: inherit; +} + +.footer { + position: absolute; + bottom: 0; + width: 100%; + white-space: nowrap; + line-height: 60px; +} diff --git a/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/_ViewImports.cshtml b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/_ViewImports.cshtml new file mode 100644 index 0000000..ad590aa --- /dev/null +++ b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/_ViewImports.cshtml @@ -0,0 +1,4 @@ +@using NavigatetoSignatureFields +@namespace NavigatetoSignatureFields.Pages +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, Syncfusion.EJ2 \ No newline at end of file diff --git a/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/_ViewStart.cshtml b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/_ViewStart.cshtml new file mode 100644 index 0000000..6e88aa3 --- /dev/null +++ b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Pages/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Program.cs b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Program.cs new file mode 100644 index 0000000..b580f44 --- /dev/null +++ b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Program.cs @@ -0,0 +1,25 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +builder.Services.AddRazorPages(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (!app.Environment.IsDevelopment()) +{ + app.UseExceptionHandler("/Error"); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); +} + +app.UseHttpsRedirection(); +app.UseStaticFiles(); + +app.UseRouting(); + +app.UseAuthorization(); + +app.MapRazorPages(); + +app.Run(); diff --git a/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Properties/launchSettings.json b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Properties/launchSettings.json new file mode 100644 index 0000000..1e66237 --- /dev/null +++ b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/Properties/launchSettings.json @@ -0,0 +1,28 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:45170", + "sslPort": 44365 + } + }, + "profiles": { + "NavigatetoSignatureFields": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7117;http://localhost:5269", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/appsettings.Development.json b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/appsettings.Development.json new file mode 100644 index 0000000..f042c67 --- /dev/null +++ b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "DetailedErrors": true, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/appsettings.json b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/appsettings.json new file mode 100644 index 0000000..4d56694 --- /dev/null +++ b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/wwwroot/favicon.ico b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/wwwroot/favicon.ico new file mode 100644 index 0000000..63e859b Binary files /dev/null and b/Form Field/Navigate to signature fields/NavigatetoSignatureFields/NavigatetoSignatureFields/wwwroot/favicon.ico differ