Skip to content

Commit

Permalink
906190: UGDocumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincentsf4657 committed Sep 17, 2024
1 parent 022bb6e commit 2c9c5b8
Show file tree
Hide file tree
Showing 19 changed files with 658 additions and 0 deletions.
14 changes: 14 additions & 0 deletions How to/Customize print Quality/PDFViewerSample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.EJ2.AspNet.Core" Version="*" />
<PackageReference Include="Syncfusion.EJ2.PdfViewer.AspNet.Core" Version="*" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions How to/Customize print Quality/PDFViewerSample.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32112.339
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDFViewerSample", "PDFViewerSample.csproj", "{39AA1883-BB43-4C46-9892-6033EA59C990}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{39AA1883-BB43-4C46-9892-6033EA59C990}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39AA1883-BB43-4C46-9892-6033EA59C990}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39AA1883-BB43-4C46-9892-6033EA59C990}.Release|Any CPU.ActiveCfg = Release|Any CPU
{39AA1883-BB43-4C46-9892-6033EA59C990}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5F13CE16-9CC4-4755-AFB4-367F461A209C}
EndGlobalSection
EndGlobal
26 changes: 26 additions & 0 deletions How to/Customize print Quality/Pages/Error.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@page
@model ErrorModel
@{
ViewData["Title"] = "Error";
}

<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>

@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}

<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
27 changes: 27 additions & 0 deletions How to/Customize print Quality/Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Diagnostics;

namespace PDFViewerSample.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string? RequestId { get; set; }

public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);

private readonly ILogger<ErrorModel> _logger;

public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}

public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}
68 changes: 68 additions & 0 deletions How to/Customize print Quality/Pages/Index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
@page "{handler?}"
@model IndexModel
@{
ViewData["Title"] = "Home page";
}

<div>
<ejs-pdfviewer id="pdfviewer"
style="width:1350px;height:100%"
documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
resourceUrl='https://cdn.syncfusion.com/ej2/24.1.41/dist/ej2-pdfviewer-lib'
toolbarClick="toolbarClick">
</ejs-pdfviewer>
</div>

<script type="text/javascript">
window.onload = function () {
var pdfViewer = document.getElementById('pdfviewer').ej2_instances[0];
var toolItem1 = {
prefixIcon: 'e-icons e-paste',
id: 'print',
tooltipText: 'Custom toolbar item',
align: 'left'
};
var toolItem2 = {
id: 'download',
text: 'Save',
tooltipText: 'Custom toolbar item',
align: 'right'
};
var LanguageList = ['Typescript', 'Javascript', 'Angular', 'C#', 'C', 'Python'];
var toolItem3 = {
type: 'Input',
tooltipText: 'Language List',
cssClass: 'percentage',
align: 'Left',
id: 'dropdown',
template: new ej.dropdowns.ComboBox({ width: 100, value: 'TypeScript', dataSource: LanguageList, popupWidth: 85, showClearButton: false, readonly: false })
};
var toolItem4 = {
type: 'Input',
tooltipText: 'Text',
align: 'Right',
cssClass: 'find',
id: 'textbox',
template: new ej.inputs.TextBox({ width: 125, placeholder: 'Type Here', created: onCreate })
};
pdfViewer.toolbarSettings = {
showTooltip: true,
toolbarItems: [toolItem1, toolItem2, 'OpenOption', 'PageNavigationTool', 'MagnificationTool', toolItem3, 'PanTool', 'SelectionTool', 'SearchOption', 'PrintOption', 'DownloadOption', 'UndoRedoTool', 'AnnotationEditTool', 'FormDesignerEditTool', toolItem4, 'CommentTool', 'SubmitForm']
};
function onCreate() {
this.addIcon('prepend', 'e-icons e-search');
}
}
// Define the toolbarClick event handler
function toolbarClick(args) {
var pdfViewer = document.getElementById('pdfviewer').ej2_instances[0];
if (args.item && args.item.id === 'print') {
pdfViewer.printModule.print();
} else if (args.item && args.item.id === 'download') {
pdfViewer.download();
}
}
</script>
Loading

0 comments on commit 2c9c5b8

Please sign in to comment.