Skip to content

Commit a31c2e3

Browse files
authored
Merge pull request #45 from SyncfusionExamples/EJ2-931453
931453: How to reference resource URL locally in the PDF Viewer without using CDN links?
2 parents 497adc8 + 812ed21 commit a31c2e3

File tree

86 files changed

+80626
-0
lines changed

Some content is hidden

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

86 files changed

+80626
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.8.34309.116
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreSample", "CoreSample\CoreSample.csproj", "{74B177C7-8BEA-4FC2-8067-208F7A494DA3}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
Release-Xml|Any CPU = Release-Xml|Any CPU
13+
EndGlobalSection
14+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
15+
{74B177C7-8BEA-4FC2-8067-208F7A494DA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
16+
{74B177C7-8BEA-4FC2-8067-208F7A494DA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
17+
{74B177C7-8BEA-4FC2-8067-208F7A494DA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
18+
{74B177C7-8BEA-4FC2-8067-208F7A494DA3}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{74B177C7-8BEA-4FC2-8067-208F7A494DA3}.Release-Xml|Any CPU.ActiveCfg = Release|Any CPU
20+
{74B177C7-8BEA-4FC2-8067-208F7A494DA3}.Release-Xml|Any CPU.Build.0 = Release|Any CPU
21+
EndGlobalSection
22+
GlobalSection(SolutionProperties) = preSolution
23+
HideSolutionNode = FALSE
24+
EndGlobalSection
25+
GlobalSection(ExtensibilityGlobals) = postSolution
26+
SolutionGuid = {0548ECA4-3BAC-44DB-90D2-F6C447AD24CC}
27+
EndGlobalSection
28+
EndGlobal
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.8" />
11+
<PackageReference Include="Syncfusion.EJ2.AspNet.Core" Version="*" />
12+
<PackageReference Include="Syncfusion.EJ2.PdfViewer.AspNet.Core" Version="*" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<None Update="PDF_Succinctly.pdf">
17+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
18+
</None>
19+
</ItemGroup>
20+
21+
</Project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<ActiveDebugProfile>IIS Express</ActiveDebugProfile>
5+
<NameOfLastUsedPublishProfile>D:\EJ2 Materials\ASP.NET.Core\8.0\CoreSample8.01999985370\CoreSample\CoreSample\Properties\PublishProfiles\CoreSample20240719165733 - Web Deploy.pubxml</NameOfLastUsedPublishProfile>
6+
</PropertyGroup>
7+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
8+
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
9+
</PropertyGroup>
10+
</Project>
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: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
using System.Diagnostics;
4+
5+
namespace CoreSample.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+
28+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@page "{handler?}"
2+
@model IndexModel
3+
@{
4+
ViewData["Title"] = "Home page";
5+
var originUrl = $"{Request.Scheme}://{Request.Host}{Request.PathBase}";
6+
var document = originUrl + "/PDF_Succinctly.pdf";
7+
var resourceUrl = originUrl + "/ej2-pdfviewer-lib";
8+
}
9+
10+
11+
<div>
12+
<ejs-pdfviewer id="pdfviewer" style="height:600px" documentPath=@document resourceUrl=@resourceUrl>
13+
</ejs-pdfviewer>
14+
</div>
15+

0 commit comments

Comments
 (0)