Skip to content

Commit d5219c8

Browse files
authored
Merge pull request #56 from SyncfusionExamples/WPF-883305
883305 - How to add digital signature in pdfviewer
2 parents d464be5 + e1d5562 commit d5219c8

17 files changed

+911
-0
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{2EAC8F00-1327-4327-8E48-E6A90D04D66F}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>AddDigitalSignature</RootNamespace>
10+
<AssemblyName>AddDigitalSignature</AssemblyName>
11+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<WarningLevel>4</WarningLevel>
15+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
16+
<Deterministic>true</Deterministic>
17+
<TargetFrameworkProfile />
18+
</PropertyGroup>
19+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
20+
<PlatformTarget>AnyCPU</PlatformTarget>
21+
<DebugSymbols>true</DebugSymbols>
22+
<DebugType>full</DebugType>
23+
<Optimize>false</Optimize>
24+
<OutputPath>bin\Debug\</OutputPath>
25+
<DefineConstants>DEBUG;TRACE</DefineConstants>
26+
<ErrorReport>prompt</ErrorReport>
27+
<WarningLevel>4</WarningLevel>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30+
<PlatformTarget>AnyCPU</PlatformTarget>
31+
<DebugType>pdbonly</DebugType>
32+
<Optimize>true</Optimize>
33+
<OutputPath>bin\Release\</OutputPath>
34+
<DefineConstants>TRACE</DefineConstants>
35+
<ErrorReport>prompt</ErrorReport>
36+
<WarningLevel>4</WarningLevel>
37+
</PropertyGroup>
38+
<ItemGroup>
39+
<PackageReference Include = "Portable.BouncyCastle" Version = "*" />
40+
<PackageReference Include="Syncfusion.PdfViewer.WPF" Version="*" />
41+
<Reference Include="System" />
42+
<Reference Include="System.Data" />
43+
<Reference Include="System.Drawing" />
44+
<Reference Include="System.Xml" />
45+
<Reference Include="Microsoft.CSharp" />
46+
<Reference Include="System.Core" />
47+
<Reference Include="System.Xml.Linq" />
48+
<Reference Include="System.Data.DataSetExtensions" />
49+
<Reference Include="System.Net.Http" />
50+
<Reference Include="System.Xaml">
51+
<RequiredTargetFramework>4.0</RequiredTargetFramework>
52+
</Reference>
53+
<Reference Include="WindowsBase" />
54+
<Reference Include="PresentationCore" />
55+
<Reference Include="PresentationFramework" />
56+
</ItemGroup>
57+
<ItemGroup>
58+
<ApplicationDefinition Include="App.xaml">
59+
<Generator>MSBuild:Compile</Generator>
60+
<SubType>Designer</SubType>
61+
</ApplicationDefinition>
62+
<Page Include="MainWindow.xaml">
63+
<Generator>MSBuild:Compile</Generator>
64+
<SubType>Designer</SubType>
65+
</Page>
66+
<Compile Include="App.xaml.cs">
67+
<DependentUpon>App.xaml</DependentUpon>
68+
<SubType>Code</SubType>
69+
</Compile>
70+
<Compile Include="ExtensionMethods.cs" />
71+
<Compile Include="MainWindow.xaml.cs">
72+
<DependentUpon>MainWindow.xaml</DependentUpon>
73+
<SubType>Code</SubType>
74+
</Compile>
75+
</ItemGroup>
76+
<ItemGroup>
77+
<Compile Include="Properties\AssemblyInfo.cs">
78+
<SubType>Code</SubType>
79+
</Compile>
80+
<Compile Include="Properties\Resources.Designer.cs">
81+
<AutoGen>True</AutoGen>
82+
<DesignTime>True</DesignTime>
83+
<DependentUpon>Resources.resx</DependentUpon>
84+
</Compile>
85+
<Compile Include="Properties\Settings.Designer.cs">
86+
<AutoGen>True</AutoGen>
87+
<DependentUpon>Settings.settings</DependentUpon>
88+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
89+
</Compile>
90+
<EmbeddedResource Include="Properties\Resources.resx">
91+
<Generator>ResXFileCodeGenerator</Generator>
92+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
93+
</EmbeddedResource>
94+
<None Include="packages.config" />
95+
<None Include="Properties\Settings.settings">
96+
<Generator>SettingsSingleFileGenerator</Generator>
97+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
98+
</None>
99+
</ItemGroup>
100+
<ItemGroup>
101+
<None Include="App.config" />
102+
</ItemGroup>
103+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
104+
</Project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35707.178 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddDigitalSignature", "AddDigitalSignature.csproj", "{2EAC8F00-1327-4327-8E48-E6A90D04D66F}"
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+
{2EAC8F00-1327-4327-8E48-E6A90D04D66F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{2EAC8F00-1327-4327-8E48-E6A90D04D66F}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{2EAC8F00-1327-4327-8E48-E6A90D04D66F}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{2EAC8F00-1327-4327-8E48-E6A90D04D66F}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>net8.0-windows</TargetFramework>
6+
<Nullable>enable</Nullable>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<UseWPF>true</UseWPF>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Portable.BouncyCastle" Version="*" />
13+
<PackageReference Include="Syncfusion.PdfViewer.WPF" Version="*" />
14+
</ItemGroup>
15+
16+
</Project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35707.178 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddDigitalSignature_NET", "AddDigitalSignature_NET.csproj", "{075D44C0-3D4B-49B7-AC77-F6CB196B12BF}"
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+
{075D44C0-3D4B-49B7-AC77-F6CB196B12BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{075D44C0-3D4B-49B7-AC77-F6CB196B12BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{075D44C0-3D4B-49B7-AC77-F6CB196B12BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{075D44C0-3D4B-49B7-AC77-F6CB196B12BF}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
5+
</startup>
6+
</configuration>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="AddDigitalSignature.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:AddDigitalSignature"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace AddDigitalSignature
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}
16.7 KB
Binary file not shown.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using System.Collections.Concurrent;
3+
using System.Collections.Generic;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace AddDigitalSignature
10+
{
11+
public static class ExtensionMethods
12+
{
13+
public static IEnumerable<string> Split(this string str, int n)
14+
{
15+
if (String.IsNullOrEmpty(str) || n < 1)
16+
{
17+
throw new ArgumentException();
18+
}
19+
20+
for (int i = 0; i < str.Length; i += n)
21+
{
22+
yield return str.Substring(i, Math.Min(n, str.Length - i));
23+
}
24+
}
25+
}
26+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Window x:Class="AddDigitalSignature.MainWindow"
2+
xmlns:PdfViewer="clr-namespace:Syncfusion.Windows.PdfViewer;assembly=Syncfusion.PdfViewer.WPF"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
xmlns:local="clr-namespace:AddDigitalSignature"
8+
mc:Ignorable="d"
9+
Title="MainWindow" WindowState="Maximized" Loaded="Window_Loaded">
10+
<Grid>
11+
<Grid.RowDefinitions>
12+
<RowDefinition Height="50"></RowDefinition>
13+
<RowDefinition ></RowDefinition>
14+
</Grid.RowDefinitions>
15+
<StackPanel Orientation="Horizontal">
16+
<Button x:Name="Draw" Content="Draw Bounds" Click="Draw_Click" Width="80" Height="20" Margin="5"/>
17+
<Button Content="Add Digital Sign" x:Name="btnAdd" HorizontalAlignment="Left" Height="20" Margin="10 0 0 0" Click="BtnAdd_Click"></Button>
18+
</StackPanel>
19+
<PdfViewer:PdfDocumentView x:Name="docView" Grid.Row="1" ShapeAnnotationChanged="docView_ShapeAnnotationChanged"></PdfViewer:PdfDocumentView>
20+
</Grid>
21+
</Window>

0 commit comments

Comments
 (0)