Skip to content

Commit c57079e

Browse files
845073: Updated sample to client side
1 parent ab24f04 commit c57079e

File tree

103 files changed

+83049
-1126
lines changed

Some content is hidden

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

103 files changed

+83049
-1126
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.5.2.0
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PdfViewerApp", "PdfViewerApp\PdfViewerApp.csproj", "{C9CC25B9-30AB-08BE-C969-C8B6D4A156D7}"
6+
EndProject
7+
Global
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
Debug|Any CPU = Debug|Any CPU
10+
Release|Any CPU = Release|Any CPU
11+
EndGlobalSection
12+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
13+
{C9CC25B9-30AB-08BE-C969-C8B6D4A156D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
14+
{C9CC25B9-30AB-08BE-C969-C8B6D4A156D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
15+
{C9CC25B9-30AB-08BE-C969-C8B6D4A156D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
16+
{C9CC25B9-30AB-08BE-C969-C8B6D4A156D7}.Release|Any CPU.Build.0 = Release|Any CPU
17+
EndGlobalSection
18+
GlobalSection(SolutionProperties) = preSolution
19+
HideSolutionNode = FALSE
20+
EndGlobalSection
21+
GlobalSection(ExtensibilityGlobals) = postSolution
22+
SolutionGuid = {5030F3A4-2467-418B-AFDE-B27D170FAD3E}
23+
EndGlobalSection
24+
EndGlobal
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System.Diagnostics;
2+
using Microsoft.AspNetCore.Mvc;
3+
using PdfViewerApp.Models;
4+
5+
namespace PdfViewerApp.Controllers;
6+
7+
public class HomeController : Controller
8+
{
9+
private readonly ILogger<HomeController> _logger;
10+
11+
public HomeController(ILogger<HomeController> logger)
12+
{
13+
_logger = logger;
14+
}
15+
16+
public IActionResult Index()
17+
{
18+
return View();
19+
}
20+
21+
public IActionResult Privacy()
22+
{
23+
return View();
24+
}
25+
26+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
27+
public IActionResult Error()
28+
{
29+
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
30+
}
31+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace PdfViewerApp.Models;
2+
3+
public class ErrorViewModel
4+
{
5+
public string? RequestId { get; set; }
6+
7+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
8+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Syncfusion.EJ2.AspNet.Core" Version="30.1.37" />
11+
<PackageReference Include="Syncfusion.EJ2.PdfViewer.AspNet.Core" Version="30.1.37" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
var builder = WebApplication.CreateBuilder(args);
2+
3+
// Add services to the container.
4+
builder.Services.AddControllersWithViews();
5+
builder.Services.AddControllersWithViews();
6+
builder.Services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
7+
8+
var app = builder.Build();
9+
10+
// Configure the HTTP request pipeline.
11+
if (!app.Environment.IsDevelopment())
12+
{
13+
app.UseExceptionHandler("/Home/Error");
14+
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
15+
app.UseHsts();
16+
}
17+
18+
app.UseHttpsRedirection();
19+
app.UseRouting();
20+
21+
app.UseAuthorization();
22+
23+
app.MapStaticAssets();
24+
25+
app.MapControllerRoute(
26+
name: "default",
27+
pattern: "{controller=Home}/{action=Index}/{id?}")
28+
.WithStaticAssets();
29+
30+
31+
app.Run();
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "https://json.schemastore.org/launchsettings.json",
3+
"profiles": {
4+
"http": {
5+
"commandName": "Project",
6+
"dotnetRunMessages": true,
7+
"launchBrowser": true,
8+
"applicationUrl": "http://localhost:5023",
9+
"environmentVariables": {
10+
"ASPNETCORE_ENVIRONMENT": "Development"
11+
}
12+
},
13+
"https": {
14+
"commandName": "Project",
15+
"dotnetRunMessages": true,
16+
"launchBrowser": true,
17+
"applicationUrl": "https://localhost:7288;http://localhost:5023",
18+
"environmentVariables": {
19+
"ASPNETCORE_ENVIRONMENT": "Development"
20+
}
21+
}
22+
}
23+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@using Syncfusion.EJ2
2+
@{
3+
ViewBag.Title = "Home Page";
4+
}
5+
<div>
6+
<div class="button-container" style="margin-bottom: 10px;">
7+
<button id="hideBtn" class="e-btn e-primary">Hide Annotations</button>
8+
<button id="unhideBtn" class="e-btn e-primary">Show Annotations</button>
9+
</div>
10+
<div style="height:500px;width:100%;">
11+
@Html.EJS().PdfViewer("pdfviewer").DocumentPath("https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf").ResourceUrl("https://cdn.syncfusion.com/ej2/30.1.37/dist/ej2-pdfviewer-lib").Render()
12+
</div>
13+
</div>
14+
15+
<script type="text/javascript">
16+
var exportObject;
17+
// Function to hide annotations
18+
function HideAnnotations() {
19+
var pdfviewer = document.getElementById('pdfviewer').ej2_instances[0];
20+
pdfviewer.exportAnnotationsAsObject().then(function(value) {
21+
exportObject = value;
22+
pdfviewer.deleteAnnotations();
23+
});
24+
}
25+
26+
// Function to unhide annotations
27+
function UnHideAnnotations() {
28+
var pdfviewer = document.getElementById('pdfviewer').ej2_instances[0];
29+
if (exportObject) {
30+
pdfviewer.importAnnotation(JSON.parse(exportObject));
31+
}
32+
}
33+
34+
// Add event listeners to buttons
35+
document.getElementById('hideBtn').addEventListener('click', HideAnnotations);
36+
document.getElementById('unhideBtn').addEventListener('click', UnHideAnnotations);
37+
</script>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@{
2+
ViewData["Title"] = "Privacy Policy";
3+
}
4+
<h1>@ViewData["Title"]</h1>
5+
6+
<p>Use this page to detail your site's privacy policy.</p>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@model ErrorViewModel
2+
@{
3+
ViewData["Title"] = "Error";
4+
}
5+
6+
<h1 class="text-danger">Error.</h1>
7+
<h2 class="text-danger">An error occurred while processing your request.</h2>
8+
9+
@if (Model.ShowRequestId)
10+
{
11+
<p>
12+
<strong>Request ID:</strong> <code>@Model.RequestId</code>
13+
</p>
14+
}
15+
16+
<h3>Development Mode</h3>
17+
<p>
18+
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
19+
</p>
20+
<p>
21+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
22+
It can result in displaying sensitive information from exceptions to end users.
23+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
24+
and restarting the app.
25+
</p>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
@using Syncfusion.EJ2
2+
<!DOCTYPE html>
3+
<html lang="en">
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>@ViewData["Title"] - PdfViewerApp</title>
8+
<script type="importmap"></script>
9+
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
10+
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
11+
<link rel="stylesheet" href="~/PdfViewerApp.styles.css" asp-append-version="true" />
12+
<link rel="stylesheet" href="https://cdn.syncfusion.com/ej2/30.1.37/fluent.css" />
13+
<script src="https://cdn.syncfusion.com/ej2/30.1.37/dist/ej2.min.js"></script>
14+
</head>
15+
<body>
16+
<header>
17+
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
18+
<div class="container-fluid">
19+
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">PdfViewerApp</a>
20+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
21+
aria-expanded="false" aria-label="Toggle navigation">
22+
<span class="navbar-toggler-icon"></span>
23+
</button>
24+
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
25+
<ul class="navbar-nav flex-grow-1">
26+
<li class="nav-item">
27+
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
28+
</li>
29+
<li class="nav-item">
30+
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
31+
</li>
32+
</ul>
33+
</div>
34+
</div>
35+
</nav>
36+
</header>
37+
<div class="container">
38+
<main role="main" class="pb-3">
39+
@RenderBody()
40+
</main>
41+
</div>
42+
43+
<footer class="border-top footer text-muted">
44+
<div class="container">
45+
&copy; 2025 - PdfViewerApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
46+
</div>
47+
</footer>
48+
<script src="~/lib/jquery/dist/jquery.min.js"></script>
49+
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
50+
<script src="~/js/site.js" asp-append-version="true"></script>
51+
@await RenderSectionAsync("Scripts", required: false)
52+
@Html.EJS().ScriptManager()
53+
</body>
54+
</html>

0 commit comments

Comments
 (0)