Browse Source

Merge commit 'bbc9a3f1809e713bf9d3a6376d7e90f20b806df1' into ComPDFKit_Rebuild

# Conflicts:
#	Demo/Examples/Annotations/Annotations.csproj
#	Demo/Examples/Annotations/MainWindow.xaml
#	Demo/Examples/Annotations/MainWindow.xaml.cs
#	Demo/Examples/Compdfkit_Tools/Compdfkit_Tools.csproj
#	Demo/Examples/PDFViewer/MainPage.xaml.cs
#	Demo/Examples/Samples/AnnotationImportExportTest/AnnotationImportExportTest.cs
zhuyi 1 year ago
parent
commit
f3a94fbcd0
100 changed files with 9742 additions and 1230 deletions
  1. 1 2
      .gitignore
  2. 38 0
      Demo/Clean.bat
  3. 31 29
      Demo/Examples/Annotations/Annotations.csproj
  4. 3 3
      Demo/Examples/Annotations/App.config
  5. 3 7
      Demo/Examples/Annotations/App.xaml
  6. 6 32
      Demo/Examples/Annotations/App.xaml.cs
  7. 32 166
      Demo/Examples/Annotations/MainWindow.xaml
  8. 238 779
      Demo/Examples/Annotations/MainWindow.xaml.cs
  9. 29 29
      Demo/Examples/Annotations/Properties/AssemblyInfo.cs
  10. 57 27
      Demo/Examples/Annotations/Properties/Resources.Designer.cs
  11. 1 1
      Demo/Examples/Annotations/Properties/Resources.resx
  12. 0 26
      Demo/Examples/Annotations/Properties/Settings.Designer.cs
  13. BIN
      Demo/Examples/Annotations/developer_guide_windows.pdf
  14. 1 1
      Demo/Examples/Annotations/packages.config
  15. BIN
      Demo/Examples/ComPDFKit.NetFramework.1.9.0.nupkg
  16. 161 0
      Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl.xaml
  17. 636 0
      Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl.xaml.cs
  18. 137 0
      Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl/AnnotationControl.xaml
  19. 779 0
      Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl/AnnotationControl.xaml.cs
  20. 1 0
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFSignatureUI.xaml.cs
  21. 1 1
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFTempStampUI.xaml.cs
  22. BIN
      Demo/Examples/Compdfkit_Tools/Asset/Resource/ComPDFKit_Logo.png
  23. BIN
      Demo/Examples/Compdfkit_Tools/Asset/Resource/Logo.png
  24. 64 0
      Demo/Examples/Compdfkit_Tools/Asset/Styles/RadioButtonStyle.xaml
  25. 47 0
      Demo/Examples/Compdfkit_Tools/Asset/Styles/TCIRadioButton.cs
  26. 35 0
      Demo/Examples/Compdfkit_Tools/Asset/Styles/TabControlStyle.xaml
  27. 42 0
      Demo/Examples/Compdfkit_Tools/Asset/Styles/TabItemStyle.xaml
  28. 81 1
      Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFBOTABarControl.xaml.cs
  29. 19 0
      Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFDigitalSignatureBarControl.xaml
  30. 168 0
      Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFDigitalSignatureBarControl.xaml.cs
  31. 0 1
      Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFPageEditBarControl.xaml
  32. 2 1
      Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFPageEditBarControl.xaml.cs
  33. 3 2
      Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFTitleBarControl.xaml
  34. 10 0
      Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFTitleBarControl.xaml.cs
  35. 17 12
      Demo/Examples/Compdfkit_Tools/Common/BarControl/FormBarControl.xaml.cs
  36. 1 6
      Demo/Examples/Compdfkit_Tools/Common/Convert/ReverseBoolConverter.cs
  37. 1 1
      Demo/Examples/Compdfkit_Tools/Common/Convert/TextLengthToVisibilityConverter.cs
  38. 42 0
      Demo/Examples/Compdfkit_Tools/Common/DeviceSerial/DeviceSerialControl.xaml
  39. 68 0
      Demo/Examples/Compdfkit_Tools/Common/DeviceSerial/DeviceSerialControl.xaml.cs
  40. 323 36
      Demo/Examples/Compdfkit_Tools/Common/Helper/CommonHelper.cs
  41. 1 1
      Demo/Examples/Compdfkit_Tools/Common/PasswordControl/PasswordDialog.xaml.cs
  42. 4 4
      Demo/Examples/Compdfkit_Tools/Common/PasswordControl/PasswordWindow.xaml.cs
  43. 2 2
      Demo/Examples/Compdfkit_Tools/Common/PropertyControl/PDFFont/CPDFFontUI.xaml.cs
  44. 193 7
      Demo/Examples/Compdfkit_Tools/Compdfkit_Tools.csproj
  45. 61 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddCertificationControl.xaml
  46. 66 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddCertificationControl.xaml.cs
  47. 15 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddCertificationDialog.xaml
  48. 133 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddCertificationDialog.xaml.cs
  49. 81 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddCustomCertificationControl.xaml
  50. 161 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddCustomCertificationControl.xaml.cs
  51. 48 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddExistedCertificationControl.xaml
  52. 91 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddExistedCertificationControl.xaml.cs
  53. 56 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/SaveCerficateControl.xaml
  54. 149 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/SaveCerficateControl.xaml.cs
  55. 78 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/CPDFSignatureListControl/CPDFSignatureListControl.xaml
  56. 226 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/CPDFSignatureListControl/CPDFSignatureListControl.xaml.cs
  57. 126 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/DigitalSignatureControl/DigitalSignatureControl.xaml
  58. 672 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/DigitalSignatureControl/DigitalSignatureControl.xaml.cs
  59. 40 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/DigitalSignatureData/DigitalSignatureData.cs
  60. 254 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/FillDigitalSignatureControl/FillDigitalSignatureControl.xaml
  61. 644 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/FillDigitalSignatureControl/FillDigitalSignatureControl.xaml.cs
  62. 14 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/FillDigitalSignatureControl/FillDigitalSignatureDialog.xaml
  63. 82 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/FillDigitalSignatureControl/FillDigitalSignatureDialog.xaml.cs
  64. 48 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/SignatureStatusBarControl/SignatureStatusBarControl.xaml
  65. 153 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/SignatureStatusBarControl/SignatureStatusBarControl.xaml.cs
  66. 53 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/VerifyDigitalSignatureControl/DigitalSignatureInfoControl.xaml
  67. 130 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/VerifyDigitalSignatureControl/DigitalSignatureInfoControl.xaml.cs
  68. 18 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/VerifyDigitalSignatureControl/DigitalSignatureValiditySummaaryControl.xaml
  69. 89 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/VerifyDigitalSignatureControl/DigitalSignatureValiditySummaaryControl.xaml.cs
  70. 23 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/VerifyDigitalSignatureControl/VerifyDigitalSignatureControl.xaml
  71. 30 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/VerifyDigitalSignatureControl/VerifyDigitalSignatureControl.xaml.cs
  72. 12 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/CertificateChainControl.xaml
  73. 28 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/CertificateChainControl.xaml.cs
  74. 110 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/CertificateDetailControl.xaml
  75. 220 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/CertificateDetailControl.xaml.cs
  76. 42 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/CertificateInfoControl.xaml
  77. 39 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/CertificateInfoControl.xaml.cs
  78. 63 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/ConfidenceControl.xaml
  79. 110 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/ConfidenceControl.xaml.cs
  80. 44 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/SummaryControl.xaml
  81. 112 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/SummaryControl.xaml.cs
  82. 49 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/ViewCertificateDialog.xaml
  83. 176 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/ViewCertificateDialog.xaml.cs
  84. 155 0
      Demo/Examples/Compdfkit_Tools/Edit/ContentEditCOntrol/ContentEditControl.xaml
  85. 602 0
      Demo/Examples/Compdfkit_Tools/Edit/ContentEditCOntrol/ContentEditControl.xaml.cs
  86. 1 1
      Demo/Examples/Compdfkit_Tools/Edit/PDFImageEdit/PDFImageEditControl/PDFImageEditControl.xaml.cs
  87. 121 0
      Demo/Examples/Compdfkit_Tools/Form/FormControl/FormControl.xaml
  88. 540 0
      Demo/Examples/Compdfkit_Tools/Form/FormControl/FormControl.xaml.cs
  89. 1 1
      Demo/Examples/Compdfkit_Tools/Form/FromPropertyControl.xaml.cs
  90. 1 3
      Demo/Examples/Compdfkit_Tools/Form/Property/CheckBoxProperty.xaml
  91. 2 1
      Demo/Examples/Compdfkit_Tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFDisplaySettingsControl.xaml
  92. 1 0
      Demo/Examples/Compdfkit_Tools/PDFView/PDFInfo/CPDFInfoControl.xaml
  93. 7 0
      Demo/Examples/Compdfkit_Tools/PDFView/PDFInfo/CPDFInfoControl.xaml.cs
  94. 7 2
      Demo/Examples/Compdfkit_Tools/PDFView/PDFThumbnail/PDFThumbnailControl/CPdfThumbnailControl.xaml.cs
  95. 1 1
      Demo/Examples/Compdfkit_Tools/PDFView/PDFThumbnail/PDFThumbnailUI/CPdfThumbnailUI.xaml
  96. 30 1
      Demo/Examples/Compdfkit_Tools/PDFView/PDFThumbnail/PDFThumbnailUI/CPdfThumbnailUI.xaml.cs
  97. 8 43
      Demo/Examples/Compdfkit_Tools/PDFView/PDFViewControl/PDFViewControl.xaml.cs
  98. 45 0
      Demo/Examples/Compdfkit_Tools/PDFView/RegularViewerControl.xaml
  99. 396 0
      Demo/Examples/Compdfkit_Tools/PDFView/RegularViewerControl.xaml.cs
  100. 0 0
      Demo/Examples/Compdfkit_Tools/PageEdit/PDFPageEdit/CPDFPageEditControl.xaml.cs

+ 1 - 2
.gitignore

@@ -234,7 +234,6 @@ ClientBin/
 *.dbmdl
 *.dbproj.schemaview
 *.jfm
-*.pfx
 *.publishsettings
 orleans.codegen.cs
 
@@ -396,4 +395,4 @@ FodyWeavers.xsd
 *.sln.iml
 
 #Output
-Output/
+Output/  

+ 38 - 0
Demo/Clean.bat

@@ -0,0 +1,38 @@
+@echo off
+setlocal
+
+set "targetFolder=%~dp0"
+
+call :DeleteFolders ".\Examples"
+call :DeleteFolders ".\Output"
+call :DeleteFolders ".\.vs"  
+
+echo Cleanup complete!
+pause
+exit
+
+:DeleteFolders
+for /d %%i in ("%1*") do (
+    if /i "%%~nxi"=="obj" (
+        echo Deleting folder "%%i"
+        rd /s /q "%%i"
+    ) else (
+        if /i "%%~nxi"=="bin" (
+            echo Deleting folder "%%i"
+            rd /s /q "%%i"
+        ) else (
+            if /i "%%~nxi"=="Output" (
+                echo Deleting folder "%%i"
+                rd /s /q "%%i"
+            ) else (
+                if /i "%%~nxi"==".vs" (  
+                    echo Deleting folder "%%i"
+                    rd /s /q "%%i"
+                ) else (
+                    call :DeleteFolders "%%i\"
+                )
+            )
+        )
+    )
+)
+exit /b

+ 31 - 29
Demo/Examples/Annotations/Annotations.csproj

@@ -1,22 +1,20 @@
 <?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{018AF31A-EDFB-42B1-A9DF-ECF950CA62B1}</ProjectGuid>
+    <ProjectGuid>{134CCE10-A4C7-4632-BDF9-631241EA6FB9}</ProjectGuid>
     <OutputType>WinExe</OutputType>
-    <RootNamespace>Annotations</RootNamespace>
+    <RootNamespace>AnnotationViewControl</RootNamespace>
     <AssemblyName>Annotations_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <WarningLevel>4</WarningLevel>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
-    <Deterministic>true</Deterministic>
     <NuGetPackageImportStamp>
     </NuGetPackageImportStamp>
-    <TargetFrameworkProfile />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -27,7 +25,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
-    <Prefer32Bit>false</Prefer32Bit>
+    <Prefer32bit>false</Prefer32bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -37,14 +35,16 @@
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup>
-    <ApplicationIcon>ComPDFKit_Logo.ico</ApplicationIcon>
+    <Prefer32bit>false</Prefer32bit>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="ComPDFKit.Desk, Version=1.9.0.0, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\ComPDFKit.NetFramework.1.9.0\lib\ComPDFKit.Desk.dll</HintPath>
+    <Reference Include="ComPDFKit.Desk, Version=1.10.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\ComPDFKit.NetFramework.1.10.0\lib\ComPDFKit.Desk.dll</HintPath>
+    </Reference>
+    <Reference Include="ComPDFKit.Viewer, Version=1.10.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\ComPDFKit.NetFramework.1.10.0\lib\ComPDFKit.Viewer.dll</HintPath>
     </Reference>
+<<<<<<< HEAD
     <Reference Include="ComPDFKit.Tool.RE, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\Compdfkit_Tools\ComPDFKit.Tool.RE.dll</HintPath>
@@ -57,16 +57,17 @@
       <HintPath>..\Compdfkit_Tools\ComPDFKit.Viewer.RE.dll</HintPath>
     </Reference>
     <Reference Include="PresentationFramework.Aero2" />
+=======
+    <Reference Include="PresentationFramework.Aero2, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\PresentationFramework.Aero2.1.0.1\lib\PresentationFramework.Aero2.dll</HintPath>
+    </Reference>
+>>>>>>> bbc9a3f1809e713bf9d3a6376d7e90f20b806df1
     <Reference Include="System" />
+    <Reference Include="System.Core" />
     <Reference Include="System.Data" />
     <Reference Include="System.Drawing" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml" />
-    <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="System.Net.Http" />
     <Reference Include="System.Xaml">
       <RequiredTargetFramework>4.0</RequiredTargetFramework>
     </Reference>
@@ -101,26 +102,23 @@
       <DesignTime>True</DesignTime>
       <DependentUpon>Resources.resx</DependentUpon>
     </Compile>
-    <Compile Include="Properties\Settings.Designer.cs">
-      <AutoGen>True</AutoGen>
-      <DependentUpon>Settings.settings</DependentUpon>
-      <DesignTimeSharedInput>True</DesignTimeSharedInput>
-    </Compile>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     </EmbeddedResource>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
     <None Include="..\TestFile\PDF32000_2008.pdf">
       <Link>PDF32000_2008.pdf</Link>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
-    <None Include="packages.config" />
-    <None Include="Properties\Settings.settings">
-      <Generator>SettingsSingleFileGenerator</Generator>
-      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
-    </None>
   </ItemGroup>
   <ItemGroup>
+<<<<<<< HEAD
     <None Include="App.config" />
   </ItemGroup>
   <ItemGroup>
@@ -132,8 +130,12 @@
     </Content>
     <Resource Include="ComPDFKit_Logo.ico" />
     <Content Include="..\license_key_win.xml">
+=======
+    <None Include="..\license_key_windows.xml">
+      <Link>license_key_windows.xml</Link>
+>>>>>>> bbc9a3f1809e713bf9d3a6376d7e90f20b806df1
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\Compdfkit_Tools\Compdfkit_Tools.csproj">
@@ -142,11 +144,11 @@
     </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <Import Project="..\packages\ComPDFKit.NetFramework.1.9.0\build\ComPDFKit.NetFramework.targets" Condition="Exists('..\packages\ComPDFKit.NetFramework.1.9.0\build\ComPDFKit.NetFramework.targets')" />
+  <Import Project="..\packages\ComPDFKit.NetFramework.1.10.0\build\ComPDFKit.NetFramework.targets" Condition="Exists('..\packages\ComPDFKit.NetFramework.1.10.0\build\ComPDFKit.NetFramework.targets')" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>
       <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
     </PropertyGroup>
-    <Error Condition="!Exists('..\packages\ComPDFKit.NetFramework.1.9.0\build\ComPDFKit.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ComPDFKit.NetFramework.1.9.0\build\ComPDFKit.NetFramework.targets'))" />
+    <Error Condition="!Exists('..\packages\ComPDFKit.NetFramework.1.10.0\build\ComPDFKit.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ComPDFKit.NetFramework.1.10.0\build\ComPDFKit.NetFramework.targets'))" />
   </Target>
 </Project>

+ 3 - 3
Demo/Examples/Annotations/App.config

@@ -1,6 +1,6 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8" ?>
 <configuration>
     <startup> 
-        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
     </startup>
-</configuration>
+</configuration>

+ 3 - 7
Demo/Examples/Annotations/App.xaml

@@ -1,13 +1,9 @@
-<Application x:Class="annotation_ctrl_demo.App"
+<Application x:Class="AnnotationViewControl.App"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:local="clr-namespace:annotation_ctrl_demo"
+             xmlns:local="clr-namespace:AnnotationViewControl"
              StartupUri="MainWindow.xaml">
     <Application.Resources>
-        <ResourceDictionary>
-            <ResourceDictionary.MergedDictionaries>
-                <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Themes/Global.xaml"></ResourceDictionary>
-            </ResourceDictionary.MergedDictionaries>
-        </ResourceDictionary>
+         
     </Application.Resources>
 </Application>

+ 6 - 32
Demo/Examples/Annotations/App.xaml.cs

@@ -1,41 +1,15 @@
-using ComPDFKit.NativeMethod;
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
+using ComPDFKit.NativeMethod;
+using Compdfkit_Tools.Helper;
 using System.Reflection;
-using System.Threading.Tasks;
 using System.Windows;
 using System.Xml;
-using static ComPDFKit.NativeMethod.CPDFSDKVerifier;
 
-namespace annotation_ctrl_demo
+namespace AnnotationViewControl
 {
-    public class SDKLicenseHelper
-    {
-        public string key = string.Empty;
-        public string secret = string.Empty;
-        public SDKLicenseHelper()
-        {
-
-            string sdkLicensePath = "license_key_win.xml";
-            Assembly assembly = Assembly.GetExecutingAssembly();
-            XmlDocument xmlDocument = new XmlDocument();
-            xmlDocument.Load(sdkLicensePath);
-            var node = xmlDocument.SelectSingleNode("License");
-            if (node != null)
-            {
-                key = node.Attributes["key"].Value;
-                secret = node.Attributes["secret"].Value;
-            }
-        }
-
-    }
     /// <summary>
-    /// App.xaml 的交互逻辑
+    /// Interaction logic for App.xaml
     /// </summary>
-    public partial class App : Application
+    public partial class App: Application
     {
         protected override void OnStartup(StartupEventArgs e)
         {
@@ -59,4 +33,4 @@ namespace annotation_ctrl_demo
             return result;
         }
     }
-}
+}

+ 32 - 166
Demo/Examples/Annotations/MainWindow.xaml

@@ -1,15 +1,19 @@
-<Window x:Class="Annotations.MainWindow"
+<Window x:Class="AnnotationViewControl.MainWindow"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-        xmlns:local="clr-namespace:Annotations"
-        xmlns:cpdftools="clr-namespace:Compdfkit_Tools.PDFControl;assembly=Compdfkit_Tools"
-        xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common;assembly=Compdfkit_Tools"
+        xmlns:local="clr-namespace:AnnotationViewControl"
+        xmlns:pdfControl="clr-namespace:Compdfkit_Tools.PDFControl;assembly=ComPDFKit_Tools"
+        xmlns:common="clr-namespace:Compdfkit_Tools.Common;assembly=ComPDFKit_Tools"
         mc:Ignorable="d"
         Loaded="MainWindow_Loaded"
+<<<<<<< HEAD
         Closed="MainWindow_Closed"
         Title="Annotations_ComPDFKit V1.9.1" Height="720" Width="1080"  WindowStartupLocation="CenterScreen">
+=======
+        Title="Annotations_ComPDFKit V1.10.0" Height="720" Width="1080"  WindowStartupLocation="CenterScreen">
+>>>>>>> bbc9a3f1809e713bf9d3a6376d7e90f20b806df1
     <Window.Resources>
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
@@ -17,94 +21,23 @@
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
             </ResourceDictionary.MergedDictionaries>
-            <!-- Shortcut -->
-            <RoutedUICommand x:Key="Open" Text="Open"/>
-            <RoutedUICommand x:Key="Save" Text="Right rotate"/>
-            <RoutedUICommand x:Key="SaveAs" Text="Delete"/>
-            <RoutedUICommand x:Key="Undo" Text="Undo"/>
-            <RoutedUICommand x:Key="Redo" Text="Redo"/>
-            <RoutedUICommand x:Key="ControlLeftPanel" Text="Control left panel"/>
-            <RoutedUICommand x:Key="ControlRightPanel" Text="Control right panel"/>
-            <RoutedUICommand x:Key="GoToBookmark" Text="Go to bookmark"></RoutedUICommand>
-            <RoutedUICommand x:Key="GoToOutline" Text="Go to outline"></RoutedUICommand>
-            <RoutedUICommand x:Key="GoToThumbnail" Text="Go to thumbnail"></RoutedUICommand>
-            <RoutedUICommand x:Key="GoToAnnotationList" Text="Go to annotation list"></RoutedUICommand>
-            <RoutedUICommand x:Key="GoToSearch" Text="Go to search"></RoutedUICommand>
-            <RoutedUICommand x:Key="ScaleAdd" Text="Scale add"></RoutedUICommand>
-            <RoutedUICommand x:Key="ScaleSubtract" Text="Scale reduce"></RoutedUICommand>
-            <RoutedUICommand x:Key="DisplaySettings" Text="Display settings"></RoutedUICommand>
-            <RoutedUICommand x:Key="DocumentInfo" Text="Document infomation"></RoutedUICommand>
-            <RoutedUICommand x:Key="Highlight" Text="Highlight"></RoutedUICommand>
-            <RoutedUICommand x:Key="Underline" Text="Underline"></RoutedUICommand>
-            <RoutedUICommand x:Key="Strikeout" Text="Strikeout"></RoutedUICommand>
-            <RoutedUICommand x:Key="Squiggly" Text="Squiggly"></RoutedUICommand>
         </ResourceDictionary>
     </Window.Resources>
- 
-    
-    
-    <Window.CommandBindings>
-        <CommandBinding Command="{StaticResource Open}" Executed="CommandBinding_Executed_Open"/>
-        <CommandBinding Command="{StaticResource Save}" Executed="CommandBinding_Executed_Save"/>
-        <CommandBinding Command="{StaticResource SaveAs}" Executed="CommandBinding_Executed_SaveAs"/>
-        <CommandBinding Command="{StaticResource Undo}" Executed="CommandBinding_Executed_Undo"/>
-        <CommandBinding Command="{StaticResource Redo}" Executed="CommandBinding_Executed_Redo"/>
-        <CommandBinding Command="{StaticResource ControlLeftPanel}" Executed="CommandBinding_Executed_ControlLeftPanel"></CommandBinding>
-        <CommandBinding Command="{StaticResource ControlRightPanel}" Executed="CommandBinding_Executed_ControlRightPanel"></CommandBinding>
-        <CommandBinding Command="{StaticResource GoToBookmark}" Executed="CommandBinding_Executed_Bookmark"></CommandBinding>
-        <CommandBinding Command="{StaticResource GoToOutline}" Executed="CommandBinding_Executed_Outline"></CommandBinding>
-        <CommandBinding Command="{StaticResource GoToThumbnail}" Executed="CommandBinding_Executed_Thumbnail"></CommandBinding>
-        <CommandBinding Command="{StaticResource GoToAnnotationList}" Executed="CommandBinding_Executed_Annotation"></CommandBinding>
-        <CommandBinding Command="{StaticResource GoToSearch}" Executed="CommandBinding_Executed_Search"></CommandBinding>
-        <CommandBinding Command="{StaticResource ScaleAdd}" Executed="CommandBinding_Executed_ScaleAdd"></CommandBinding>
-        <CommandBinding Command="{StaticResource ScaleSubtract}" Executed="CommandBinding_Executed_ScaleSubtract"></CommandBinding>
-        <CommandBinding Command="{StaticResource DisplaySettings}" Executed="CommandBinding_Executed_DisplaySettings"></CommandBinding>
-        <CommandBinding Command="{StaticResource DocumentInfo}" Executed="CommandBinding_Executed_DocumentInfo"></CommandBinding>
-        <CommandBinding Command="{StaticResource Highlight}" Executed="CommandBinding_Executed_Highlight"></CommandBinding>
-        <CommandBinding Command="{StaticResource Underline}" Executed="CommandBinding_Executed_Underline"></CommandBinding>
-        <CommandBinding Command="{StaticResource Strikeout}" Executed="CommandBinding_Executed_Strikeout"></CommandBinding>
-        <CommandBinding Command="{StaticResource Squiggly}" Executed="CommandBinding_Executed_Squiggly"></CommandBinding>
-    </Window.CommandBindings>
-
-    <Window.InputBindings>
-        <KeyBinding Key="O" Modifiers="Control" Command="{StaticResource Open}"/>
-        <KeyBinding Key="S" Modifiers="Control" Command="{StaticResource Save}"/>
-        <KeyBinding Key="S" Modifiers="Control+Shift" Command="{StaticResource SaveAs}"/>
-        <KeyBinding Key="Z" Modifiers="Control" Command="{StaticResource Undo}"/>
-        <KeyBinding Key="Y" Modifiers="Control" Command="{StaticResource Redo}"/>
-        <KeyBinding Key="F4" Command="{StaticResource ControlLeftPanel}"/>
-        <KeyBinding Key="F4" Modifiers="Control" Command="{StaticResource ControlRightPanel}"/>
-        <KeyBinding Key="B" Modifiers="Control" Command="{StaticResource GoToBookmark}"></KeyBinding>
-        <KeyBinding Key="O" Modifiers="Control+Shift" Command="{StaticResource GoToOutline}"></KeyBinding>
-        <KeyBinding Key="T" Modifiers="Control" Command="{StaticResource GoToThumbnail}"></KeyBinding>
-        <KeyBinding Key="A" Modifiers="Control" Command="{StaticResource GoToAnnotationList}"></KeyBinding>
-        <KeyBinding Key="F" Modifiers="Control" Command="{StaticResource GoToSearch}"></KeyBinding>
-        <KeyBinding Key="Add" Modifiers="Control" Command="{StaticResource ScaleAdd}"></KeyBinding>
-        <KeyBinding Key="Subtract" Modifiers="Control" Command="{StaticResource ScaleSubtract}"></KeyBinding>
-        <KeyBinding Key="D" Modifiers="Control" Command="{StaticResource DisplaySettings}"></KeyBinding>
-        <KeyBinding Key="I" Modifiers="Control" Command="{StaticResource DocumentInfo}"></KeyBinding>
-        <KeyBinding Key="H" Modifiers="Control+Alt" Command="{StaticResource Highlight}"></KeyBinding>
-        <KeyBinding Key="U" Modifiers="Control+Alt" Command="{StaticResource Underline}"></KeyBinding>
-        <KeyBinding Key="Q" Modifiers="Control+Alt" Command="{StaticResource Squiggly}"></KeyBinding>
-        <KeyBinding Key="S" Modifiers="Control+Alt" Command="{StaticResource Strikeout}"></KeyBinding>
-    </Window.InputBindings>
-
     <Grid>
         <Grid>
             <Grid.RowDefinitions>
-                <RowDefinition Height="40"></RowDefinition>
+                <RowDefinition Height="Auto"></RowDefinition>
                 <RowDefinition Height="*"></RowDefinition>
             </Grid.RowDefinitions>
- 
             <Grid>
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="auto"></ColumnDefinition>
                     <ColumnDefinition Width="*"></ColumnDefinition>
                     <ColumnDefinition Width="auto"></ColumnDefinition>
                 </Grid.ColumnDefinitions>
- 
+
                 <StackPanel Orientation="Horizontal" Height="40" Margin="20,0,0,0">
- 
+
                     <Button BorderThickness="0" VerticalContentAlignment="Center" Width="30" Height="30" Style="{StaticResource LightButtonStyle}" Background="Transparent" Click="OpenFile_Click">
                         <Button.Content>
                             <Viewbox Width="20" Height="20">
@@ -133,7 +66,7 @@
                             <ToolTip Content="Open..."></ToolTip>
                         </Button.ToolTip>
                     </Button>
- 
+
                     <Button BorderThickness="0" VerticalContentAlignment="Center" Margin="10,0,0,0" Width="30" Height="30" Style="{StaticResource LightButtonStyle}" Background="Transparent"  
                             Click="SaveFileBtn_Click"  IsEnabled="{Binding CanSave,Mode=OneWay}">
                         <Button.Content>
@@ -151,7 +84,7 @@
                         </Button.ToolTip>
                     </Button>
 
-                    <ToggleButton Name="LeftToolPanelButton" Margin="13,0,0,0" BorderThickness="0" Width="30" Height="30" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="LeftToolPanelButton_Click">
+                    <ToggleButton Name="LeftToolPanelButton" Margin="13,0,0,0" BorderThickness="0" Width="30" Height="30" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" IsChecked="{Binding LeftToolPanelButtonIsChecked, Mode=TwoWay}" Click="LeftToolPanelButton_Click">
                         <ToggleButton.Content>
                             <Path Fill="#43474D" Width="30" Height="30">
                                 <Path.Data>
@@ -165,7 +98,7 @@
                     </ToggleButton>
 
                     <Line Margin="13,0,13,0" Stroke="#E0E0E0" X1="0" Y1="5" X2="0" Y2="35"></Line>
- 
+
                     <ToggleButton BorderThickness="0" Width="30" Height="30" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" IsChecked="True" IsEnabled="False" Visibility="Collapsed">
                         <ToggleButton.Content>
                             <Path Fill="#43474D">
@@ -188,16 +121,16 @@
 
                     <Line Margin="13,0,13,0" Stroke="#E0E0E0" X1="0" Y1="5" X2="0" Y2="35"></Line>
 
-                    <cpdftools:CPDFScalingControl x:Name="CPDFSaclingControl"></cpdftools:CPDFScalingControl>
+                    <pdfControl:CPDFScalingControl x:Name="CPDFSaclingControl"></pdfControl:CPDFScalingControl>
                 </StackPanel>
 
                 <ComboBox Name="ModeComboBox" Style="{StaticResource ComboBoxStyle1}" Width="120" Height="26" Grid.Column="1" HorizontalAlignment="Center" FontSize="14" Foreground="#001A4E" SelectionChanged="ComboBox_SelectionChanged">
                     <ComboBoxItem IsSelected="True" Tag="Viewer">Viewer</ComboBoxItem>
-                    <ComboBoxItem IsSelected="True" Tag="Annotation">Annotation</ComboBoxItem>
+                    <ComboBoxItem  Tag="Annotation">Annotation</ComboBoxItem>
                 </ComboBox>
- 
+
                 <StackPanel Orientation="Horizontal" Grid.Column="2">
- 
+
                     <Button BorderThickness="0" Width="40" Height="40" Style="{StaticResource LightButtonStyle}" Background="Transparent" Click="ExpandSearchBtn_Click">
                         <Button.Content>
                             <Path Fill="#43474D">
@@ -215,7 +148,7 @@
                         </Button.ToolTip>
                     </Button>
 
-                    <ToggleButton  x:Name="RightPanelButton" BorderThickness="0" Width="40" Height="40" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="RightPanelButton_Click">
+                    <ToggleButton  x:Name="RightPanelButton" BorderThickness="0" Width="40" Height="40" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" IsChecked="{Binding RightToolPanelButtonIsChecked, Mode=TwoWay}" Click="RightPanelButton_Click">
                         <ToggleButton.Content>
                             <Path Fill="#43474D" Width="30" Height="30">
                                 <Path.Data>
@@ -227,8 +160,8 @@
                             <ToolTip Content="Properties"></ToolTip>
                         </ToggleButton.ToolTip>
                     </ToggleButton>
- 
-                    <ToggleButton Name="ViewSettingBtn" BorderThickness="0" Width="40" Height="40" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="ViewSettingBtn_Click">
+
+                    <ToggleButton Name="ViewSettingBtn" BorderThickness="0" Width="40" Height="40" Style="{StaticResource ToggleButtonStyle}" IsChecked="{Binding ViewSettingBtnIsChecked, Mode=TwoWay}" Background="Transparent" Click="ViewSettingBtn_Click">
                         <ToggleButton.Content>
                             <Path Stroke="#43474D" VerticalAlignment="Center" StrokeThickness="2">
                                 <Path.Data>
@@ -247,7 +180,7 @@
                             <ToolTip Content="Page Display"></ToolTip>
                         </ToggleButton.ToolTip>
                     </ToggleButton>
- 
+
                     <Button BorderThickness="0" Width="40" Height="40" Style="{StaticResource LightButtonStyle}" Background="Transparent" Click="PageInfoBtn_Click">
                         <Button.Content>
                             <Path Fill="#43474D" VerticalAlignment="Center">
@@ -268,12 +201,7 @@
                 </StackPanel>
 
             </Grid>
-
             <Grid Name="BodyGrid" Grid.Row="1">
-                 <Grid.RowDefinitions>
-                    <RowDefinition Height="auto"/>
-                    <RowDefinition Height="*"/>
-                </Grid.RowDefinitions> 
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="0"></ColumnDefinition>
                     <ColumnDefinition Width="0"></ColumnDefinition>
@@ -281,65 +209,7 @@
                     <ColumnDefinition Width="auto"></ColumnDefinition>
                 </Grid.ColumnDefinitions>
 
-                <Border x:Name="ToolBarContainer" Height="45" Visibility="Visible"  BorderThickness="1" BorderBrush="#1A000000" Background="#F2F3F5" Grid.ColumnSpan="4">
-                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
-                        <cpdftools:CPDFAnnotationBarControl x:Name="AnnotationBarControl" Loaded="AnnotationBarControl_Loaded" Unloaded="AnnotationBarControl_Unloaded" Height="44"/>
-                        <Line Height="40" Stroke="#D5D6D8" StrokeThickness="2" X1="0" Y1="10" X2="0" Y2="30" Margin="8,0,8,0" /> 
-                        <Button Name="UndoBtn" Style="{StaticResource LightButtonStyle}" BorderThickness="0"  Width="40" Height="40" IsEnabled="{Binding CanUndo,Mode=OneWay}"  Click="UndoButton_Click"
-                                    Background="Transparent">
-                            <Path x:Name="UndoPath" IsEnabled="{Binding CanUndo,Mode=OneWay}">
-                                <Path.Style>
-                                    <Style TargetType="Path">
-                                        <Style.Triggers>
-                                            <Trigger Property="IsEnabled" Value="False">
-                                                <Setter Property="Fill" Value="LightGray"/>
-                                            </Trigger>
-                                            <Trigger Property="IsEnabled" Value="True">
-                                                <Setter Property="Fill" Value="#43474D"/>
-                                            </Trigger>
-                                        </Style.Triggers>
-                                    </Style>
-                                </Path.Style>
-                                <Path.Data>
-                                    M1.03033 3.62131L0.5 4.15164L1.03033 4.68197L4.65164 8.30328L5.7123 7.24261L3.37132 4.90164H10.0607C11.5794 4.90164 12.8107 6.13285 12.8107 
-                                7.65164C12.8107 9.17042 11.5794 10.4016 10.0607 10.4016H2.56066V11.9016H10.0607C12.4079 11.9016 14.3107 9.99885 14.3107 7.65164C14.3107 
-                                5.30443 12.4079 3.40164 10.0607 3.40164H3.37132L5.7123 1.06066L4.65164 0L1.03033 3.62131Z
-                                </Path.Data>
-                            </Path>
-                            <Button.ToolTip>
-                                <ToolTip Content="Undo"></ToolTip>
-                            </Button.ToolTip>
-                        </Button> 
-                        <Button Style="{StaticResource LightButtonStyle}" BorderThickness="0" Width="40" Height="40" Margin="10,0,0,0"  IsEnabled="{Binding CanRedo,Mode=OneWay}" Click="RedoButton_Click"
-                                    Background="Transparent">
-                            <Path IsEnabled="{Binding CanRedo,Mode=OneWay}">
-                                <Path.Resources>
-                                    <Style TargetType="Path">
-                                        <Style.Triggers>
-                                            <Trigger Property="IsEnabled" Value="False">
-                                                <Setter Property="Fill" Value="LightGray"/>
-                                            </Trigger>
-                                            <Trigger Property="IsEnabled" Value="True">
-                                                <Setter Property="Fill" Value="#43474D"/>
-                                            </Trigger>
-                                        </Style.Triggers>
-                                    </Style>
-                                </Path.Resources>
-                                <Path.Data>
-                                    M13.7802 3.62131L14.3105 4.15164L13.7802 4.68197L10.1589 8.30328L9.09825 7.24261L11.4392 4.90164H4.74989C3.2311 4.90164 1.99989 6.13285 
-                                1.99989 7.65164C1.99989 9.17042 3.2311 10.4016 4.74989 10.4016H12.2499V11.9016H4.74989C2.40268 11.9016 0.499887 9.99885 0.499887 
-                                7.65164C0.499887 5.30443 2.40268 3.40164 4.74989 3.40164H11.4392L9.09825 1.06066L10.1589 0L13.7802 3.62131Z
-                                </Path.Data>
-                            </Path>
-                            <Button.ToolTip>
-                                <ToolTip Content="Redo"></ToolTip>
-                            </Button.ToolTip>
-                        </Button>
-                    </StackPanel>
-                </Border>
-                   
-                <cpdftools:CPDFBOTABarControl Grid.Row="1" Visibility="Collapsed" Name="BotaSideTool"/> 
-                <GridSplitter  Grid.Row="1" Name="Splitter" Grid.Column="1" Width="15" ResizeBehavior="PreviousAndNext" Visibility="Collapsed">
+                <GridSplitter  Name="Splitter" Grid.Column="1" Width="15" ResizeBehavior="PreviousAndNext" Visibility="Collapsed">
                     <GridSplitter.Template>
                         <ControlTemplate TargetType="{x:Type GridSplitter}">
                             <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
@@ -355,30 +225,26 @@
                     </GridSplitter.Template>
                 </GridSplitter>
 
-                <Grid  Grid.Row="1" Grid.Column="2" >
+                <Grid Grid.Column="2" >
                     <Grid.RowDefinitions>
                         <RowDefinition Height="auto"/>
                         <RowDefinition Height="*"/>
                     </Grid.RowDefinitions>
-                   
-                   
+
                     <Grid Grid.Row="1">
                         <Grid.ColumnDefinitions>
                             <ColumnDefinition></ColumnDefinition>
                             <ColumnDefinition Width="auto"></ColumnDefinition>
-                        </Grid.ColumnDefinitions> 
-                        <Border x:Name="PDFGrid" Background="#CECECE"></Border> 
-                        <Border Grid.Column="1" Grid.RowSpan="2" Name="PropertyContainer" Visibility="Collapsed"></Border>
+                        </Grid.ColumnDefinitions>
+                        <Border x:Name="PDFGrid" Background="#CECECE"></Border>
                     </Grid>
- 
-                    <cpdfcommon:PageNumberControl Grid.Row="1" Name="FloatPageTool" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,20"></cpdfcommon:PageNumberControl>
+
                 </Grid>
             </Grid>
         </Grid>
-
         <Border Name="PopupBorder" Background="#A0000000" Visibility="Collapsed">
             <Grid>
- 
+
                 <Grid Name="FileInfoUI"  Width="422" Height="680" HorizontalAlignment="Center" VerticalAlignment="Center" Background="White" Visibility="Collapsed">
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="*"></ColumnDefinition>
@@ -399,10 +265,10 @@
                             </Path>
                         </Button.Content>
                     </Button>
-                    <cpdftools:CPDFInfoControl Grid.Row="1" Margin="25,10,25,0" Grid.ColumnSpan="2" Name="FileInfoControl"></cpdftools:CPDFInfoControl>
+                    <pdfControl:CPDFInfoControl Grid.Row="1" Margin="25,10,25,0" Grid.ColumnSpan="2" Name="FileInfoControl"></pdfControl:CPDFInfoControl>
                 </Grid>
- 
-                <cpdfcommon:PasswordDialog x:Name="PasswordUI" Visibility="Collapsed"></cpdfcommon:PasswordDialog>
+
+                <common:PasswordDialog x:Name="PasswordUI" Visibility="Collapsed"></common:PasswordDialog>
             </Grid>
 
         </Border>

File diff suppressed because it is too large
+ 238 - 779
Demo/Examples/Annotations/MainWindow.xaml.cs


+ 29 - 29
Demo/Examples/Annotations/Properties/AssemblyInfo.cs

@@ -1,55 +1,55 @@
-using System.Reflection;
+using System.Reflection;
 using System.Resources;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Windows;
 
-// 有关程序集的一般信息由以下
-// 控制。更改这些特性值可修改
-// 与程序集关联的信息。
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
 [assembly: AssemblyTitle("Annotations_ComPDFKit")]
 [assembly: AssemblyDescription("")]
 [assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
+[assembly: AssemblyCompany("PDF Tecnologies, Inc.")]
 [assembly: AssemblyProduct("Annotations_ComPDFKit")]
 [assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
-// 将 ComVisible 设置为 false 会使此程序集中的类型
-//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
-//请将此类型的 ComVisible 特性设置为 true。
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components.  If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
 [assembly: ComVisible(false)]
 
-//若要开始生成可本地化的应用程序,请设置
-//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
-//例如,如果您在源文件中使用的是美国英语,
-//使用的是美国英语,请将 <UICulture> 设置为 en-US。  然后取消
-//对以下 NeutralResourceLanguage 特性的注释。  更新
-//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
+//In order to begin building localizable applications, set
+//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
+//inside a <PropertyGroup>.  For example, if you are using US english
+//in your source files, set the <UICulture> to en-US.  Then uncomment
+//the NeutralResourceLanguage attribute below.  Update the "en-US" in
+//the line below to match the UICulture setting in the project file.
 
 //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
 
 
 [assembly: ThemeInfo(
-    ResourceDictionaryLocation.None, //主题特定资源词典所处位置
-                                     //(未在页面中找到资源时使用,
-                                     //或应用程序资源字典中找到时使用)
-    ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
-                                              //(未在页面中找到资源时使用,
-                                              //、应用程序或任何主题专用资源字典中找到时使用)
+    ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+    //(used if a resource is not found in the page,
+    // or application resource dictionaries)
+    ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+    //(used if a resource is not found in the page,
+    // app, or any theme specific resource dictionaries)
 )]
 
 
-// 程序集的版本信息由下列四个值组成: 
+// Version information for an assembly consists of the following four values:
 //
-//      主版本
-//      次版本
-//      生成号
-//      修订号
+//      Major Version
+//      Minor Version
+//      Build Number
+//      Revision
 //
-//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
-//通过使用 "*",如下所示:
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.9.0.0")]
-[assembly: AssemblyFileVersion("1.9.0.0")]
+[assembly: AssemblyVersion("1.10.0.0")]
+[assembly: AssemblyFileVersion("1.10.0.0")]

+ 57 - 27
Demo/Examples/Annotations/Properties/Resources.Designer.cs

@@ -1,39 +1,69 @@
- namespace Annotations.Properties {
-    using System;
-    
-     
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace AnnotationViewControl.Properties
+{
+    /// <summary>
+    ///   A strongly-typed resource class, for looking up localized strings, etc.
+    /// </summary>
+    // This class was auto-generated by the StronglyTypedResourceBuilder
+    // class via a tool like ResGen or Visual Studio.
+    // To add or remove a member, edit your .ResX file then rerun ResGen
+    // with the /str option, or rebuild your VS project.
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder",
+        "4.0.0.0")]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    internal class Resources {
-        
+    internal class Resources
+    {
         private static global::System.Resources.ResourceManager resourceMan;
-        
+
         private static global::System.Globalization.CultureInfo resourceCulture;
-        
-        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
-        internal Resources() {
+
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance",
+            "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources()
+        {
         }
-         
-        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
-        internal static global::System.Resources.ResourceManager ResourceManager {
-            get {
-                if (object.ReferenceEquals(resourceMan, null)) {
-                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Annotations.Properties.Resources", typeof(Resources).Assembly);
+
+        /// <summary>
+        ///   Returns the cached ResourceManager instance used by this class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState
+            .Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager
+        {
+            get
+            {
+                if ((resourceMan == null))
+                {
+                    global::System.Resources.ResourceManager temp =
+                        new global::System.Resources.ResourceManager("Annotations.Properties.Resources",
+                            typeof(Resources).Assembly);
                     resourceMan = temp;
                 }
+
                 return resourceMan;
             }
         }
-         
-        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
-        internal static global::System.Globalization.CultureInfo Culture {
-            get {
-                return resourceCulture;
-            }
-            set {
-                resourceCulture = value;
-            }
+
+        /// <summary>
+        ///   Overrides the current thread's CurrentUICulture property for all
+        ///   resource lookups using this strongly typed resource class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState
+            .Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture
+        {
+            get { return resourceCulture; }
+            set { resourceCulture = value; }
         }
     }
-}
+}

+ 1 - 1
Demo/Examples/Annotations/Properties/Resources.resx

@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <root>
   <!-- 
     Microsoft ResX Schema 

+ 0 - 26
Demo/Examples/Annotations/Properties/Settings.Designer.cs

@@ -1,26 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-//     此代码由工具生成。
-//     运行时版本:4.0.30319.42000
-//
-//     对此文件的更改可能会导致不正确的行为,并且如果
-//     重新生成代码,这些更改将会丢失。
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Annotations.Properties {
-    
-    
-    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
-    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-        
-        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-        
-        public static Settings Default {
-            get {
-                return defaultInstance;
-            }
-        }
-    }
-}

BIN
Demo/Examples/Annotations/developer_guide_windows.pdf


+ 1 - 1
Demo/Examples/Annotations/packages.config

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="ComPDFKit.NetFramework" version="1.9.0" targetFramework="net461" />
+  <package id="ComPDFKit.NetFramework" version="1.10.0" targetFramework="net461" />
   <package id="PresentationFramework.Aero2" version="1.0.1" targetFramework="net461" />
 </packages>

BIN
Demo/Examples/ComPDFKit.NetFramework.1.9.0.nupkg


+ 161 - 0
Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl.xaml

@@ -0,0 +1,161 @@
+<UserControl x:Class="Compdfkit_Tools.PDFControl.AnnotationControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             mc:Ignorable="d"
+             xmlns:cpdftools="clr-namespace:Compdfkit_Tools.PDFControl"
+             xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common"
+             Loaded="MainWindow_Loaded"
+             d:DesignHeight="720" d:DesignWidth="1080">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ToggleButtonStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
+            </ResourceDictionary.MergedDictionaries>
+        </ResourceDictionary>
+    </UserControl.Resources>
+    <Grid>
+        <Grid>
+            <Grid.RowDefinitions>
+                <RowDefinition Height="*"></RowDefinition>
+            </Grid.RowDefinitions>
+            <Grid Name="BodyGrid" Grid.Row="1">
+                 <Grid.RowDefinitions>
+                    <RowDefinition Height="auto"/>
+                    <RowDefinition Height="*"/>
+                </Grid.RowDefinitions> 
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="0"></ColumnDefinition>
+                    <ColumnDefinition Width="0"></ColumnDefinition>
+                    <ColumnDefinition Width="*"></ColumnDefinition>
+                    <ColumnDefinition Width="auto"></ColumnDefinition>
+                </Grid.ColumnDefinitions>
+
+                <Border x:Name="ToolBarContainer" Height="45" Visibility="Visible"  BorderThickness="1" BorderBrush="#1A000000" Background="#F2F3F5" Grid.ColumnSpan="4">
+                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
+                        <cpdftools:CPDFAnnotationBarControl x:Name="AnnotationBarControl" Loaded="AnnotationBarControl_Loaded" Unloaded="AnnotationBarControl_Unloaded" Height="44"/>
+                        <Line Height="40" Stroke="#D5D6D8" StrokeThickness="2" X1="0" Y1="10" X2="0" Y2="30" Margin="8,0,8,0" /> 
+                        <Button Name="UndoBtn" Style="{StaticResource LightButtonStyle}" BorderThickness="0"  Width="40" Height="40" IsEnabled="{Binding CanUndo,Mode=OneWay}"  Click="UndoButton_Click"
+                                    Background="Transparent">
+                            <Path x:Name="UndoPath" IsEnabled="{Binding CanUndo,Mode=OneWay}">
+                                <Path.Style>
+                                    <Style TargetType="Path">
+                                        <Style.Triggers>
+                                            <Trigger Property="IsEnabled" Value="False">
+                                                <Setter Property="Fill" Value="LightGray"/>
+                                            </Trigger>
+                                            <Trigger Property="IsEnabled" Value="True">
+                                                <Setter Property="Fill" Value="#43474D"/>
+                                            </Trigger>
+                                        </Style.Triggers>
+                                    </Style>
+                                </Path.Style>
+                                <Path.Data>
+                                    M1.03033 3.62131L0.5 4.15164L1.03033 4.68197L4.65164 8.30328L5.7123 7.24261L3.37132 4.90164H10.0607C11.5794 4.90164 12.8107 6.13285 12.8107 
+                                7.65164C12.8107 9.17042 11.5794 10.4016 10.0607 10.4016H2.56066V11.9016H10.0607C12.4079 11.9016 14.3107 9.99885 14.3107 7.65164C14.3107 
+                                5.30443 12.4079 3.40164 10.0607 3.40164H3.37132L5.7123 1.06066L4.65164 0L1.03033 3.62131Z
+                                </Path.Data>
+                            </Path>
+                            <Button.ToolTip>
+                                <ToolTip Content="Undo"></ToolTip>
+                            </Button.ToolTip>
+                        </Button> 
+                        <Button Style="{StaticResource LightButtonStyle}" BorderThickness="0" Width="40" Height="40" Margin="10,0,0,0"  IsEnabled="{Binding CanRedo,Mode=OneWay}" Click="RedoButton_Click"
+                                    Background="Transparent">
+                            <Path IsEnabled="{Binding CanRedo,Mode=OneWay}">
+                                <Path.Resources>
+                                    <Style TargetType="Path">
+                                        <Style.Triggers>
+                                            <Trigger Property="IsEnabled" Value="False">
+                                                <Setter Property="Fill" Value="LightGray"/>
+                                            </Trigger>
+                                            <Trigger Property="IsEnabled" Value="True">
+                                                <Setter Property="Fill" Value="#43474D"/>
+                                            </Trigger>
+                                        </Style.Triggers>
+                                    </Style>
+                                </Path.Resources>
+                                <Path.Data>
+                                    M13.7802 3.62131L14.3105 4.15164L13.7802 4.68197L10.1589 8.30328L9.09825 7.24261L11.4392 4.90164H4.74989C3.2311 4.90164 1.99989 6.13285 
+                                1.99989 7.65164C1.99989 9.17042 3.2311 10.4016 4.74989 10.4016H12.2499V11.9016H4.74989C2.40268 11.9016 0.499887 9.99885 0.499887 
+                                7.65164C0.499887 5.30443 2.40268 3.40164 4.74989 3.40164H11.4392L9.09825 1.06066L10.1589 0L13.7802 3.62131Z
+                                </Path.Data>
+                            </Path>
+                            <Button.ToolTip>
+                                <ToolTip Content="Redo"></ToolTip>
+                            </Button.ToolTip>
+                        </Button>
+                    </StackPanel>
+                </Border>
+                   <Border Grid.Row="1" Visibility="Collapsed" Name="BotaContainer">
+                   </Border>
+                <GridSplitter  Grid.Row="1" Name="Splitter" Grid.Column="1" Width="15" ResizeBehavior="PreviousAndNext" Visibility="Collapsed">
+                    <GridSplitter.Template>
+                        <ControlTemplate TargetType="{x:Type GridSplitter}">
+                            <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
+                        BorderBrush="{TemplateBinding Border.BorderBrush}"
+                        Background="{TemplateBinding Panel.Background}" >
+                                <Path Fill="Gray" VerticalAlignment="Center">
+                                    <Path.Data>
+                                        M15 3.75H1V2.25H15V3.75ZM15 8.75H1V7.25H15V8.75ZM1 13.75H15V12.25H1V13.75Z
+                                    </Path.Data>
+                                </Path>
+                            </Border>
+                        </ControlTemplate>
+                    </GridSplitter.Template>
+                </GridSplitter>
+
+                <Grid  Grid.Row="1" Grid.Column="2" >
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="auto"/>
+                        <RowDefinition Height="*"/>
+                    </Grid.RowDefinitions>
+                    
+                    <Grid Grid.Row="1">
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition></ColumnDefinition>
+                            <ColumnDefinition Width="auto"></ColumnDefinition>
+                        </Grid.ColumnDefinitions> 
+                        <Border x:Name="PDFGrid" Background="#CECECE"></Border> 
+                        <Border Grid.Column="1" Grid.RowSpan="2" Name="PropertyContainer" Visibility="Collapsed"></Border>
+                    </Grid>
+ 
+                    <cpdfcommon:PageNumberControl Grid.Row="1" x:Name="FloatPageTool" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,20"></cpdfcommon:PageNumberControl>
+                </Grid>
+            </Grid>
+        </Grid>
+
+        <Border Name="PopupBorder" Background="#A0000000" Visibility="Collapsed">
+            <Grid> 
+                <Grid Name="FileInfoUI"  Width="422" Height="680" HorizontalAlignment="Center" VerticalAlignment="Center" Background="White" Visibility="Collapsed">
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="*"></ColumnDefinition>
+                        <ColumnDefinition Width="*"></ColumnDefinition>
+                    </Grid.ColumnDefinitions>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="auto"></RowDefinition>
+                        <RowDefinition Height="*"></RowDefinition>
+                    </Grid.RowDefinitions>
+
+                    <TextBlock Width="50" Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left">FileInfo:</TextBlock>
+                    <Button Grid.Column="1" Width="16" Height="16" HorizontalAlignment="Right" Margin="0,8,8,0" BorderThickness="0" Click="FileInfoCloseBtn_Click">
+                        <Button.Content>
+                            <Path Fill="Black">
+                                <Path.Data>
+                                    M6.69495 6L11.5 1.19495L10.805 0.5L6 5.30505L1.19495 0.5L0.5 1.19495L5.30505 6L0.5 10.805L1.19495 11.5L6 6.69495L10.805 11.5L11.5 10.805L6.69495 6Z
+                                </Path.Data>
+                            </Path>
+                        </Button.Content>
+                    </Button>
+                    <cpdftools:CPDFInfoControl Grid.Row="1" Margin="25,10,25,0" Grid.ColumnSpan="2" x:Name="FileInfoControl"></cpdftools:CPDFInfoControl>
+                </Grid>
+ 
+                <cpdfcommon:PasswordDialog x:Name="PasswordUI" Visibility="Collapsed"></cpdfcommon:PasswordDialog>
+            </Grid>
+
+        </Border>
+    </Grid>
+</UserControl>

File diff suppressed because it is too large
+ 636 - 0
Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl.xaml.cs


+ 137 - 0
Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl/AnnotationControl.xaml

@@ -0,0 +1,137 @@
+<UserControl x:Class="Compdfkit_Tools.PDFControl.AnnotationControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             mc:Ignorable="d"
+             xmlns:cpdftools="clr-namespace:Compdfkit_Tools.PDFControl"
+             xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common"
+             Loaded="UserControl_Loaded"
+             Unloaded="UserControl_Unloaded"
+             d:DesignHeight="720" d:DesignWidth="1080">
+    
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="../../Asset/Styles/ToggleButtonStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="../../Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="../../Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
+            </ResourceDictionary.MergedDictionaries>
+            <RoutedUICommand x:Key="Undo" Text="Undo"></RoutedUICommand>
+            <RoutedUICommand x:Key="Redo" Text="Redo"></RoutedUICommand>
+            <RoutedUICommand x:Key="Highlight" Text="Highlight"></RoutedUICommand>
+            <RoutedUICommand x:Key="Underline" Text="Underline"></RoutedUICommand>
+            <RoutedUICommand x:Key="Strikeout" Text="Strikeout"></RoutedUICommand>
+            <RoutedUICommand x:Key="Squiggly" Text="Squiggly"></RoutedUICommand>
+        </ResourceDictionary>
+    </UserControl.Resources>
+
+    <UserControl.InputBindings>
+        <KeyBinding Key="Z" Modifiers="Control" Command="{StaticResource Undo}"/>
+        <KeyBinding Key="Y" Modifiers="Control" Command="{StaticResource Redo}"/>
+        <KeyBinding Key="H" Modifiers="Control+Alt" Command="{StaticResource Highlight}"></KeyBinding>
+        <KeyBinding Key="U" Modifiers="Control+Alt" Command="{StaticResource Underline}"></KeyBinding>
+        <KeyBinding Key="Q" Modifiers="Control+Alt" Command="{StaticResource Squiggly}"></KeyBinding>
+        <KeyBinding Key="S" Modifiers="Control+Alt" Command="{StaticResource Strikeout}"></KeyBinding>
+    </UserControl.InputBindings>
+    
+    <UserControl.CommandBindings>
+        <CommandBinding Command="{StaticResource Undo}" Executed="CommandBinding_Executed_Undo"/>
+        <CommandBinding Command="{StaticResource Redo}" Executed="CommandBinding_Executed_Redo"/>
+        <CommandBinding Command="{StaticResource Highlight}" Executed="CommandBinding_Executed_Highlight"></CommandBinding>
+        <CommandBinding Command="{StaticResource Underline}" Executed="CommandBinding_Executed_Underline"></CommandBinding>
+        <CommandBinding Command="{StaticResource Strikeout}" Executed="CommandBinding_Executed_Strikeout"></CommandBinding>
+        <CommandBinding Command="{StaticResource Squiggly}" Executed="CommandBinding_Executed_Squiggly"></CommandBinding>
+    </UserControl.CommandBindings>
+
+    <Grid Name="BodyGrid">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="auto"/>
+            <RowDefinition Height="*"/>
+        </Grid.RowDefinitions>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="0"></ColumnDefinition>
+            <ColumnDefinition Width="0"></ColumnDefinition>
+            <ColumnDefinition Width="*"></ColumnDefinition>
+            <ColumnDefinition Width="auto"></ColumnDefinition>
+        </Grid.ColumnDefinitions>
+
+        <Border x:Name="ToolBarContainer" Height="45" Visibility="Visible"  BorderThickness="1" BorderBrush="#1A000000" Background="#F2F3F5" Grid.ColumnSpan="4">
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
+                <cpdftools:CPDFAnnotationBarControl x:Name="AnnotationBarControl" Loaded="AnnotationBarControl_Loaded" Unloaded="AnnotationBarControl_Unloaded" Height="44"/>
+                <Line Height="40" Stroke="#D5D6D8" StrokeThickness="2" X1="0" Y1="10" X2="0" Y2="30" Margin="8,0,8,0" />
+                <Button Name="UndoBtn" Style="{StaticResource LightButtonStyle}" BorderThickness="0"  Width="40" Height="40" IsEnabled="{Binding CanUndo,Mode=OneWay}"  Click="UndoButton_Click"
+                                    Background="Transparent">
+                    <Path x:Name="UndoPath" IsEnabled="{Binding CanUndo,Mode=OneWay}">
+                        <Path.Style>
+                            <Style TargetType="Path">
+                                <Style.Triggers>
+                                    <Trigger Property="IsEnabled" Value="False">
+                                        <Setter Property="Fill" Value="LightGray"/>
+                                    </Trigger>
+                                    <Trigger Property="IsEnabled" Value="True">
+                                        <Setter Property="Fill" Value="#43474D"/>
+                                    </Trigger>
+                                </Style.Triggers>
+                            </Style>
+                        </Path.Style>
+                        <Path.Data>
+                            M1.03033 3.62131L0.5 4.15164L1.03033 4.68197L4.65164 8.30328L5.7123 7.24261L3.37132 4.90164H10.0607C11.5794 4.90164 12.8107 6.13285 12.8107 
+                                7.65164C12.8107 9.17042 11.5794 10.4016 10.0607 10.4016H2.56066V11.9016H10.0607C12.4079 11.9016 14.3107 9.99885 14.3107 7.65164C14.3107 
+                                5.30443 12.4079 3.40164 10.0607 3.40164H3.37132L5.7123 1.06066L4.65164 0L1.03033 3.62131Z
+                        </Path.Data>
+                    </Path>
+                    <Button.ToolTip>
+                        <ToolTip Content="Undo"></ToolTip>
+                    </Button.ToolTip>
+                </Button>
+                <Button Style="{StaticResource LightButtonStyle}" BorderThickness="0" Width="40" Height="40" Margin="10,0,0,0"  IsEnabled="{Binding CanRedo,Mode=OneWay}" Click="RedoButton_Click"
+                                    Background="Transparent">
+                    <Path IsEnabled="{Binding CanRedo,Mode=OneWay}">
+                        <Path.Resources>
+                            <Style TargetType="Path">
+                                <Style.Triggers>
+                                    <Trigger Property="IsEnabled" Value="False">
+                                        <Setter Property="Fill" Value="LightGray"/>
+                                    </Trigger>
+                                    <Trigger Property="IsEnabled" Value="True">
+                                        <Setter Property="Fill" Value="#43474D"/>
+                                    </Trigger>
+                                </Style.Triggers>
+                            </Style>
+                        </Path.Resources>
+                        <Path.Data>
+                            M13.7802 3.62131L14.3105 4.15164L13.7802 4.68197L10.1589 8.30328L9.09825 7.24261L11.4392 4.90164H4.74989C3.2311 4.90164 1.99989 6.13285 
+                                1.99989 7.65164C1.99989 9.17042 3.2311 10.4016 4.74989 10.4016H12.2499V11.9016H4.74989C2.40268 11.9016 0.499887 9.99885 0.499887 
+                                7.65164C0.499887 5.30443 2.40268 3.40164 4.74989 3.40164H11.4392L9.09825 1.06066L10.1589 0L13.7802 3.62131Z
+                        </Path.Data>
+                    </Path>
+                    <Button.ToolTip>
+                        <ToolTip Content="Redo"></ToolTip>
+                    </Button.ToolTip>
+                </Button>
+            </StackPanel>
+        </Border>
+        <Border Grid.Row="1" Visibility="Collapsed" Name="BotaContainer">
+        </Border>
+        <GridSplitter Grid.Row="1" Name="Splitter" Grid.Column="1" Width="15" ResizeBehavior="PreviousAndNext" Visibility="Collapsed">
+            <GridSplitter.Template>
+                <ControlTemplate TargetType="{x:Type GridSplitter}">
+                    <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
+                        BorderBrush="{TemplateBinding Border.BorderBrush}"
+                        Background="{TemplateBinding Panel.Background}" >
+                        <Path Fill="Gray" VerticalAlignment="Center">
+                            <Path.Data>
+                                M15 3.75H1V2.25H15V3.75ZM15 8.75H1V7.25H15V8.75ZM1 13.75H15V12.25H1V13.75Z
+                            </Path.Data>
+                        </Path>
+                    </Border>
+                </ControlTemplate>
+            </GridSplitter.Template>
+        </GridSplitter>
+        <Border x:Name="PDFGrid" Background="#CECECE" Grid.Row="1" Grid.Column="2"></Border>
+        <Border Grid.Column="3" Name="PropertyContainer" Grid.Row="1" Visibility="Collapsed" ></Border>
+        <cpdfcommon:PageNumberControl  Grid.Column="2" Grid.Row="1" x:Name="FloatPageTool" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,20"></cpdfcommon:PageNumberControl>
+
+    </Grid>
+</UserControl>

+ 779 - 0
Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl/AnnotationControl.xaml.cs

@@ -0,0 +1,779 @@
+using System.Windows.Controls;
+using Compdfkit_Tools.Data;
+using ComPDFKitViewer;
+using ComPDFKitViewer.AnnotEvent;
+using ComPDFKitViewer.PdfViewer;
+using Microsoft.Win32;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Drawing;
+using System.IO;
+using System.Runtime.CompilerServices;
+using System.Windows;
+using System.Windows.Controls.Primitives;
+using System.Windows.Input;
+using System.Windows.Media.Imaging;
+using Compdfkit_Tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI;
+using Compdfkit_Tools.Helper;
+using ComPDFKit.DigitalSign;
+using ComPDFKit.PDFAnnotation.Form;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    public partial class AnnotationControl : UserControl, INotifyPropertyChanged
+    {
+        #region Property
+        private bool isFirstLoad = true;
+        public PDFViewControl PDFViewControl = new PDFViewControl();
+        public CPDFAnnotationControl PDFAnnotationControl = null;
+        private CPDFDisplaySettingsControl displaySettingsControl = null;
+
+        private PanelState panelState = PanelState.GetInstance();
+
+        private double[] zoomLevelList = { 1f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
+
+        public event PropertyChangedEventHandler PropertyChanged;
+        public ICommand CloseTabCommand;
+        public ICommand ExpandPropertyPanelCommand;
+
+        public bool CanUndo
+        {
+            get
+            {
+                if (PDFViewControl != null && PDFViewControl.PDFView != null)
+                {
+                    return PDFViewControl.PDFView.UndoManager.CanUndo;
+                }
+                return false;
+            }
+        }
+
+        public bool CanRedo
+        {
+            get
+            {
+                if (PDFViewControl != null && PDFViewControl.PDFView != null)
+                {
+                    return PDFViewControl.PDFView.UndoManager.CanRedo;
+                }
+
+                return false;
+            }
+        }
+
+        private bool CanSave
+        {
+            get
+            {
+                if (PDFViewControl != null && PDFViewControl.PDFView != null)
+                {
+                    return PDFViewControl.PDFView.UndoManager.CanSave;
+                }
+
+                return false;
+            }
+        }
+
+        public event EventHandler<bool> OnCanSaveChanged;
+        public event EventHandler OnAnnotEditHandler;
+
+        #endregion
+
+        public AnnotationControl()
+        {
+            InitializeComponent();
+            DataContext = this;
+            PDFAnnotationControl = new CPDFAnnotationControl();
+            CPDFAnnotationType[] annotationProperties =
+            {
+                    CPDFAnnotationType.Highlight, CPDFAnnotationType.Underline, CPDFAnnotationType.Strikeout,
+                    CPDFAnnotationType.Squiggly, CPDFAnnotationType.Freehand, CPDFAnnotationType.FreeText,
+                    CPDFAnnotationType.Note, CPDFAnnotationType.Circle, CPDFAnnotationType.Square,
+                    CPDFAnnotationType.Arrow, CPDFAnnotationType.Line, CPDFAnnotationType.Image,
+                    CPDFAnnotationType.Stamp, CPDFAnnotationType.Signature, CPDFAnnotationType.Link,
+                    CPDFAnnotationType.Audio
+            };
+            AnnotationBarControl.InitAnnotationBar(annotationProperties);
+            panelState.PropertyChanged -= PanelState_PropertyChanged;
+            panelState.PropertyChanged += PanelState_PropertyChanged;
+        }
+
+        #region Init PDFViewer
+        public void InitWithPDFViewer(CPDFViewer pdfViewer)
+        {
+            PDFViewControl.PDFView = pdfViewer;
+            PDFGrid.Child = PDFViewControl;
+            FloatPageTool.InitWithPDFViewer(pdfViewer);
+            InitialPDFViewControl(PDFViewControl);
+        }
+        #endregion
+
+        #region Public Method
+
+        public void ClearViewerControl()
+        {
+            PDFGrid.Child = null;
+            BotaContainer.Child = null;
+            PropertyContainer.Child = null;
+            displaySettingsControl = null;
+        }
+        
+        public void SetBOTAContainer(CPDFBOTABarControl botaControl)
+        {
+            this.BotaContainer.Child = botaControl;
+        }
+
+        public void SetDisplaySettingsControl(CPDFDisplaySettingsControl displaySettingsControl)
+        {
+            this.displaySettingsControl = displaySettingsControl;
+        }
+
+        public void ClearAllToolState()
+        {
+            this.AnnotationBarControl.ClearAllToolState();
+        }
+
+        public void SetToolBarContainerVisibility(Visibility visibility)
+        {
+            this.ToolBarContainer.Visibility = visibility;
+        }
+
+        #endregion
+
+        #region Load Unload custom control
+
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            InitialPDFViewControl(PDFViewControl);
+        }
+
+        private void UserControl_Unloaded(object sender, RoutedEventArgs e)
+        {
+            PDFViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
+            PDFViewControl.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
+        }
+
+
+        private void AnnotationBarControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            AnnotationBarControl.AnnotationPropertyChanged += AnnotationBarControl_AnnotationPropertyChanged;
+            AnnotationBarControl.AnnotationCancel += AnnotationBarControl_AnnotationCancel;
+        }
+
+        private void AnnotationBarControl_Unloaded(object sender, RoutedEventArgs e)
+        {
+            AnnotationBarControl.AnnotationPropertyChanged -= AnnotationBarControl_AnnotationPropertyChanged;
+            AnnotationBarControl.AnnotationCancel -= AnnotationBarControl_AnnotationCancel;
+
+        }
+
+        #endregion
+
+        #region Annotation
+
+        public void InitialPDFViewControl(PDFViewControl newPDFViewer)
+        {
+            PDFAnnotationControl.SetPDFViewer(newPDFViewer.PDFView);
+            PDFAnnotationControl.AnnotationCancel();
+            AnnotationBarControl.ClearAllToolState();
+            ExpandRightPropertyPanel(null, Visibility.Collapsed);
+            PDFAnnotationControl.ClearAnnotationBar -= PdfAnnotationControl_ClearAnnotationBar;
+            PDFAnnotationControl.ClearAnnotationBar += PdfAnnotationControl_ClearAnnotationBar;
+            PDFViewControl.PDFView.AnnotEditHandler -= PDFView_AnnotEditHandler;
+            PDFViewControl.PDFView.AnnotEditHandler += PDFView_AnnotEditHandler;
+            PDFViewControl.PDFView.UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
+            PDFViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
+            PDFViewControl.PDFView.AnnotActiveHandler -= PDFView_AnnotActiveHandler;
+            PDFViewControl.PDFView.AnnotActiveHandler += PDFView_AnnotActiveHandler;
+            
+            PDFViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
+            PDFViewControl.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
+            PDFViewControl.PDFView.AnnotCommandHandler += PDFView_AnnotCommandHandler;
+            PDFViewControl.PDFView.WidgetClickHandler += PDFView_WidgetClickHandler;
+        }
+
+        public void UnloadEvent()
+        {
+            PDFViewControl.PDFView.AnnotEditHandler -= PDFView_AnnotEditHandler;
+            PDFViewControl.PDFView.AnnotActiveHandler -= PDFView_AnnotActiveHandler;
+            //panelState.PropertyChanged -= PanelState_PropertyChanged;
+        }
+
+        private void PdfAnnotationControl_ClearAnnotationBar(object sender, EventArgs e)
+        {
+            AnnotationBarControl.ClearAllToolState();
+        }
+
+        public void SetViewSettings(Visibility visibility, CPDFDisplaySettingsControl displaySettingsControl = null)
+        {
+            this.PropertyContainer.Child = displaySettingsControl;
+            this.PropertyContainer.Visibility = visibility;
+        }
+        #endregion
+
+        #region Expand and collapse Panel
+
+        public void ExpandRightPropertyPanel(UIElement propertytPanel, Visibility visible)
+        {
+            PropertyContainer.Width = 260;
+            PropertyContainer.Child = propertytPanel;
+            PropertyContainer.Visibility = visible;
+        }
+
+        public void ExpandLeftPanel(bool isExpand)
+        {
+            BotaContainer.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
+            Splitter.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
+            if (isExpand)
+            {
+                BodyGrid.ColumnDefinitions[0].Width = new GridLength(320);
+                BodyGrid.ColumnDefinitions[1].Width = new GridLength(15);
+            }
+            else
+            {
+                BodyGrid.ColumnDefinitions[0].Width = new GridLength(0);
+                BodyGrid.ColumnDefinitions[1].Width = new GridLength(0);
+            }
+        }
+
+        #endregion
+
+        #region Context menu
+
+        private void PDFView_AnnotCommandHandler(object sender, AnnotCommandArgs e)
+        {
+            switch (e.CommandType)
+            {
+                case CommandType.Context:
+                    e.Handle = true;
+                    if (e.CommandTarget == TargetType.Annot)
+                    {
+                        e.Handle = true;
+                        e.PopupMenu = new ContextMenu();
+                        if (e.PressOnLink && AnnotationBarControl.CurrentMode == "Link")
+                        {
+                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
+                            MenuItem propertyMenu = new MenuItem();
+                            propertyMenu = new MenuItem();
+                            propertyMenu.Header = "Edit";
+                            WeakEventManager<MenuItem, RoutedEventArgs>.AddHandler(propertyMenu, "Click", EditLink_Click);
+                            propertyMenu.CommandParameter = e;
+                            e.PopupMenu.Items.Add(propertyMenu);
+                        }
+                        else if (e.PressOnAnnot)
+                        {
+                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
+                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
+                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
+                        }
+                        else if (e.PressOnMedia || e.PressOnSound)
+                        {
+                            e.Handle = true;
+                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Play", Command = MediaCommands.Play, CommandTarget = (UIElement)sender, CommandParameter = e });
+                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
+                        }
+                        else if (e.PressOnSelectedText)
+                        {
+                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
+                            MenuItem highLightMenu = new MenuItem();
+                            highLightMenu.Header = "HighLight";
+                            highLightMenu.Click += (o, p) =>
+                            {
+                                TextHighlightAnnotArgs highLightArgs = new TextHighlightAnnotArgs();
+                                MouseModes oldMode = PDFViewControl.PDFView.MouseMode;
+
+                                if (PDFAnnotationControl != null)
+                                {
+                                    highLightArgs.Color = System.Windows.Media.Colors.Red;
+                                    highLightArgs.Transparency = 1;
+                                    PDFViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
+                                    PDFViewControl.PDFView.SetToolParam(highLightArgs);
+                                    PDFViewControl.PDFView.SetMouseMode(oldMode);
+                                }
+
+                            };
+
+                            e.PopupMenu.Items.Add(highLightMenu);
+
+                            MenuItem underlineMenu = new MenuItem();
+                            underlineMenu.Header = "UnderLine";
+                            underlineMenu.Click += (o, p) =>
+                            {
+                                TextUnderlineAnnotArgs underlineArgs = new TextUnderlineAnnotArgs();
+                                MouseModes oldMode = PDFViewControl.PDFView.MouseMode;
+
+                                if (PDFAnnotationControl != null)
+                                {
+                                    underlineArgs.Color = System.Windows.Media.Colors.Red;
+                                    underlineArgs.Transparency = 1;
+                                    PDFViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
+                                    PDFViewControl.PDFView.SetToolParam(underlineArgs);
+                                    PDFViewControl.PDFView.SetMouseMode(oldMode);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(underlineMenu);
+
+                            MenuItem strikeOutMenu = new MenuItem();
+                            strikeOutMenu.Header = "StrikeOut";
+                            strikeOutMenu.Click += (o, p) =>
+                            {
+                                TextStrikeoutAnnotArgs strikeoutAnnotArgs = new TextStrikeoutAnnotArgs();
+                                MouseModes oldMode = PDFViewControl.PDFView.MouseMode;
+
+                                if (PDFAnnotationControl != null)
+                                {
+                                    strikeoutAnnotArgs.Color = System.Windows.Media.Colors.Red;
+                                    strikeoutAnnotArgs.Transparency = 1;
+                                    PDFViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
+                                    PDFViewControl.PDFView.SetToolParam(strikeoutAnnotArgs);
+                                    PDFViewControl.PDFView.SetMouseMode(oldMode);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(strikeOutMenu);
+
+                            MenuItem SquiggleMenu = new MenuItem();
+                            SquiggleMenu.Header = "Squiggle";
+                            SquiggleMenu.Click += (o, p) =>
+                            {
+                                TextSquigglyAnnotArgs squigglyAnnotArgs = new TextSquigglyAnnotArgs();
+                                MouseModes oldMode = PDFViewControl.PDFView.MouseMode;
+
+                                if (PDFAnnotationControl != null)
+                                {
+                                    squigglyAnnotArgs.Color = System.Windows.Media.Colors.Red;
+                                    squigglyAnnotArgs.Transparency = 1;
+                                    PDFViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
+                                    PDFViewControl.PDFView.SetToolParam(squigglyAnnotArgs);
+                                    PDFViewControl.PDFView.SetMouseMode(oldMode);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(SquiggleMenu);
+                        }
+                        else
+                        {
+                            e.Handle = true;
+                            e.PopupMenu = new ContextMenu();
+                           
+                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
+                            e.PopupMenu.Items.Add(new Separator());
+
+                            MenuItem fitWidthMenu = new MenuItem();
+                            fitWidthMenu.Header = "Automatically Resize";
+                            fitWidthMenu.Click += (o, p) =>
+                            {
+                                if (PDFViewControl != null)
+                                {
+                                    PDFViewControl.PDFView?.ChangeFitMode(FitMode.FitWidth);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(fitWidthMenu);
+
+                            MenuItem fitSizeMenu = new MenuItem();
+                            fitSizeMenu.Header = "Actual Size";
+                            fitSizeMenu.Click += (o, p) =>
+                            {
+                                if (PDFViewControl != null)
+                                {
+                                    PDFViewControl.PDFView?.ChangeFitMode(FitMode.FitSize);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(fitSizeMenu);
+
+                            MenuItem zoomInMenu = new MenuItem();
+                            zoomInMenu.Header = "Zoom In";
+                            zoomInMenu.Click += (o, p) =>
+                            {
+                                if (PDFViewControl != null)
+                                {
+                                    double newZoom = CheckZoomLevel(PDFViewControl.PDFView.ZoomFactor + 0.01, true);
+                                    PDFViewControl.PDFView?.Zoom(newZoom);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(zoomInMenu);
+
+                            MenuItem zoomOutMenu = new MenuItem();
+                            zoomOutMenu.Header = "Zoom Out";
+                            zoomOutMenu.Click += (o, p) =>
+                            {
+                                if (PDFViewControl != null)
+                                {
+                                    double newZoom = CheckZoomLevel(PDFViewControl.PDFView.ZoomFactor - 0.01, false);
+                                    PDFViewControl.PDFView?.Zoom(newZoom);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(zoomOutMenu);
+                            e.PopupMenu.Items.Add(new Separator());
+
+                            MenuItem singleView = new MenuItem();
+                            singleView.Header = "Single Page";
+                            singleView.Click += (o, p) =>
+                            {
+                                if (PDFViewControl != null)
+                                {
+                                    PDFViewControl.PDFView?.ChangeViewMode(ViewMode.Single);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(singleView);
+
+                            MenuItem singleContinuousView = new MenuItem();
+                            singleContinuousView.Header = "Single Page Continuous";
+                            singleContinuousView.Click += (o, p) =>
+                            {
+                                if (PDFViewControl != null)
+                                {
+                                    PDFViewControl.PDFView?.ChangeViewMode(ViewMode.SingleContinuous);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(singleContinuousView);
+
+                            MenuItem doubleView = new MenuItem();
+                            doubleView.Header = "Two Pages";
+                            doubleView.Click += (o, p) =>
+                            {
+                                if (PDFViewControl != null)
+                                {
+                                    PDFViewControl.PDFView?.ChangeViewMode(ViewMode.Double);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(doubleView);
+
+                            MenuItem doubleContinuousView = new MenuItem();
+                            doubleContinuousView.Header = "Two Pages Continuous";
+                            doubleContinuousView.Click += (o, p) =>
+                            {
+                                if (PDFViewControl != null)
+                                {
+                                    PDFViewControl.PDFView?.ChangeViewMode(ViewMode.DoubleContinuous);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(doubleContinuousView);
+
+                            MenuItem resetFormMenu = new MenuItem();
+                            resetFormMenu.Header = "Reset Forms";
+                            resetFormMenu.Click += (o, p) =>
+                            {
+                                if (PDFViewControl != null)
+                                {
+                                    PDFViewControl.PDFView?.ResetForm(null);
+                                }
+                            };
+                            e.PopupMenu.Items.Add(new Separator());
+                            e.PopupMenu.Items.Add(resetFormMenu);
+
+                        }
+                    }
+
+                    else if (e.CommandTarget == TargetType.ImageSelection)
+                    {
+                        if (PDFViewControl != null && PDFViewControl.PDFView != null && PDFViewControl.PDFView.GetSelectImageCount() > 0)
+                        {
+                            e.Handle = true;
+                            e.PopupMenu = new ContextMenu();
+
+                            MenuItem imageCopyMenu = new MenuItem();
+                            imageCopyMenu = new MenuItem();
+                            imageCopyMenu.Header = "Copy Images";
+                            WeakEventManager<MenuItem, RoutedEventArgs>.AddHandler(imageCopyMenu, "Click", CopyImage_Click);
+                            imageCopyMenu.CommandParameter = e;
+                            e.PopupMenu.Items.Add(imageCopyMenu);
+
+                            MenuItem imageExtraMenu = new MenuItem();
+                            imageExtraMenu = new MenuItem();
+                            imageExtraMenu.Header = "Extract Images";
+                            WeakEventManager<MenuItem, RoutedEventArgs>.AddHandler(imageExtraMenu, "Click", ExtraImage_Click);
+                            imageExtraMenu.CommandParameter = e;
+                            e.PopupMenu.Items.Add(imageExtraMenu);
+                        }
+                    }
+                    break;
+                case CommandType.Copy:
+                    e.DoCommand();
+                    break;
+                case CommandType.Cut:
+                case CommandType.Paste:
+                case CommandType.Delete:
+                    e.DoCommand();
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        private void CopyImage_Click(object sender, RoutedEventArgs e)
+        {
+            try
+            {
+                Dictionary<int, List<Bitmap>> imageDict = PDFViewControl.PDFView?.GetSelectedImages();
+
+                if (imageDict != null && imageDict.Count > 0)
+                {
+                    foreach (int pageIndex in imageDict.Keys)
+                    {
+                        List<Bitmap> imageList = imageDict[pageIndex];
+                        foreach (Bitmap image in imageList)
+                        {
+                            MemoryStream ms = new MemoryStream();
+                            image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
+                            BitmapImage imageData = new BitmapImage();
+                            imageData.BeginInit();
+                            imageData.StreamSource = ms;
+                            imageData.CacheOption = BitmapCacheOption.OnLoad;
+                            imageData.EndInit();
+                            imageData.Freeze();
+                            Clipboard.SetImage(imageData);
+                            break;
+                        }
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+
+            }
+        }
+
+        private void ExtraImage_Click(object sender, RoutedEventArgs e)
+        {
+            System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
+            if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                string choosePath = folderDialog.SelectedPath;
+                string openPath = choosePath;
+                try
+                {
+                    Dictionary<int, List<Bitmap>> imageDict = PDFViewControl.PDFView?.GetSelectedImages();
+
+                    if (imageDict != null && imageDict.Count > 0)
+                    {
+                        foreach (int pageIndex in imageDict.Keys)
+                        {
+                            List<Bitmap> imageList = imageDict[pageIndex];
+                            foreach (Bitmap image in imageList)
+                            {
+                                string savePath = Path.Combine(choosePath, Guid.NewGuid() + ".jpg");
+                                image.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg);
+                                openPath = savePath;
+                            }
+                        }
+                    }
+                    Process.Start("explorer", "/select,\"" + openPath + "\"");
+                }
+                catch (Exception ex)
+                {
+
+                }
+            }
+        }
+
+        #endregion
+
+        #region UI
+
+        private double CheckZoomLevel(double zoom, bool IsGrowth)
+        {
+            double standardZoom = 100;
+            if (zoom <= 0.01)
+            {
+                return 0.01;
+            }
+            if (zoom >= 10)
+            {
+                return 10;
+            }
+
+            zoom *= 100;
+            for (int i = 0; i < zoomLevelList.Length - 1; i++)
+            {
+                if (zoom > zoomLevelList[i] && zoom <= zoomLevelList[i + 1] && IsGrowth)
+                {
+                    standardZoom = zoomLevelList[i + 1];
+                    break;
+                }
+                if (zoom >= zoomLevelList[i] && zoom < zoomLevelList[i + 1] && !IsGrowth)
+                {
+                    standardZoom = zoomLevelList[i];
+                    break;
+                }
+            }
+            return standardZoom / 100;
+        }
+
+        private void ToolExpand_Click(object sender, RoutedEventArgs e)
+        {
+            ToggleButton expandBtn = sender as ToggleButton;
+            if (expandBtn != null)
+            {
+                bool isExpand = expandBtn.IsChecked == true;
+                ExpandLeftPanel(isExpand);
+            }
+        }
+
+        private void EditLink_Click(object sender, RoutedEventArgs e)
+        {
+            PropertyContainer.Visibility = Visibility.Visible;
+        }
+
+        private void UndoButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (PDFViewControl != null && PDFViewControl.PDFView != null)
+            {
+                PDFViewControl.PDFView.UndoManager?.Undo();
+            }
+        }
+
+        private void RedoButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (PDFViewControl != null && PDFViewControl.PDFView != null)
+            {
+                PDFViewControl.PDFView.UndoManager?.Redo();
+            }
+        }
+
+        #endregion
+
+        #region Property changed
+        protected void OnPropertyChanged([CallerMemberName] string name = null)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
+        }
+
+
+        private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
+        {
+            OnPropertyChanged(e.PropertyName);
+            if (e.PropertyName == "CanSave")
+            {
+                OnCanSaveChanged?.Invoke(this, CanSave);
+            }
+        }
+        
+        private void PanelState_PropertyChanged(object sender, PropertyChangedEventArgs e)
+        {
+            if (e.PropertyName == nameof(PanelState.IsLeftPanelExpand))
+            {
+                ExpandLeftPanel(panelState.IsLeftPanelExpand);
+            }
+            else if (e.PropertyName == nameof(PanelState.RightPanel))
+            {
+                if (panelState.RightPanel == PanelState.RightPanelState.PropertyPanel)
+                {
+                    ExpandRightPropertyPanel(PDFAnnotationControl, Visibility.Visible);
+                }
+                else if (panelState.RightPanel == PanelState.RightPanelState.ViewSettings)
+                {
+                    ExpandRightPropertyPanel(displaySettingsControl, Visibility.Visible);
+                }
+                else
+                {
+                    ExpandRightPropertyPanel(null, Visibility.Collapsed);
+                }
+            }
+        }
+        #endregion
+
+        #region Event handle
+        private void AnnotationBarControl_AnnotationCancel(object sender, EventArgs e)
+        {
+            PDFAnnotationControl.AnnotationCancel();
+            if (panelState.RightPanel == PanelState.RightPanelState.PropertyPanel)
+            {
+                panelState.RightPanel = PanelState.RightPanelState.None;
+            }
+        }
+
+        private void AnnotationBarControl_AnnotationPropertyChanged(object sender, CPDFAnnotationType e)
+        {
+            PDFAnnotationControl.LoadAnnotationPanel(e);
+            if (e != CPDFAnnotationType.Audio && e != CPDFAnnotationType.Image)
+            {
+                panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
+            }
+        }
+
+        private void PDFView_AnnotActiveHandler(object sender, AnnotAttribEvent e)
+        {
+            PropertyContainer.Child = PDFAnnotationControl;
+            PDFAnnotationControl.SetAnnotEventData(e);
+        }
+        
+        private void PDFView_WidgetClickHandler(object sender, WidgetArgs e)
+        {
+            if ((e is WidgetSignArgs args))
+            {
+                var signatureWidget = args.Sign;
+                if(signatureWidget != null)
+                {
+                    CPDFSignature sig = signatureWidget.GetSignature(PDFViewControl.PDFView.Document);
+                    if (signatureWidget.IsSigned() && sig!=null && sig?.SignerList.Count > 0)
+                    {
+                        return;
+                    }
+                }
+                
+                if (args.WidgetType == C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS)
+                {
+                    panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
+                    CPDFSignatureUI signatureProperty = new CPDFSignatureUI();
+                    signatureProperty.SetFormProperty(args, PDFViewControl.PDFView);
+                    PropertyContainer.Child = signatureProperty;
+                }
+            }
+        }
+
+        private void PDFView_AnnotEditHandler(object sender, List<AnnotEditEvent> e)
+        {
+            OnAnnotEditHandler.Invoke(this, null);
+        }
+
+        private void CommandBinding_Executed_Undo(object sender, ExecutedRoutedEventArgs e)
+        {
+            if (PDFViewControl != null && PDFViewControl.PDFView != null && CanUndo)
+            {
+                PDFViewControl.PDFView.UndoManager?.Undo();
+            }
+        }
+
+        private void CommandBinding_Executed_Redo(object sender, ExecutedRoutedEventArgs e)
+        {
+            if (PDFViewControl != null && PDFViewControl.PDFView != null && CanRedo)
+            {
+                PDFViewControl.PDFView.UndoManager?.Redo();
+            }
+        }
+
+        private void CommandBinding_Executed_Highlight(object sender, ExecutedRoutedEventArgs e)
+        {
+            AnnotationBarControl.SetAnnotationType(CPDFAnnotationType.Highlight);
+        }
+
+        private void CommandBinding_Executed_Underline(object sender, ExecutedRoutedEventArgs e)
+        {
+            AnnotationBarControl.SetAnnotationType(CPDFAnnotationType.Underline);
+        }
+
+        private void CommandBinding_Executed_Strikeout(object sender, ExecutedRoutedEventArgs e)
+        {
+            AnnotationBarControl.SetAnnotationType(CPDFAnnotationType.Strikeout);
+        }
+
+        private void CommandBinding_Executed_Squiggly(object sender, ExecutedRoutedEventArgs e)
+        {
+            AnnotationBarControl.SetAnnotationType(CPDFAnnotationType.Squiggly);
+        }
+        #endregion
+        
+    }
+}

+ 1 - 0
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFSignatureUI.xaml.cs

@@ -90,6 +90,7 @@ namespace Compdfkit_Tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI
                         frame.CopyPixels(ImageArray, frame.PixelWidth * 4, 0);
                         widgetSignArgs?.UpdateApWithImage(ImageArray, ImageWidth, ImageHeight, C_Scale_Type.fitCenter, 0);
                         pdfViewer?.ReloadVisibleAnnots();
+                        pdfViewer.UndoManager.CanSave = true;
                     }
                 }
             }

+ 1 - 1
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFTempStampUI.xaml.cs

@@ -6,7 +6,7 @@ using System.Windows.Media.Imaging;
 namespace Compdfkit_Tools.PDFControlUI
 {
     /// <summary>
-    /// CPDFImageUI.xaml 的交互逻辑
+    /// Interaction logic for CPDFImageUI.xaml
     /// </summary>
     public partial class CPDFTempStampUI : UserControl
     {

BIN
Demo/Examples/Compdfkit_Tools/Asset/Resource/ComPDFKit_Logo.png


BIN
Demo/Examples/Compdfkit_Tools/Asset/Resource/Logo.png


+ 64 - 0
Demo/Examples/Compdfkit_Tools/Asset/Styles/RadioButtonStyle.xaml

@@ -0,0 +1,64 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                    xmlns:local="clr-namespace:Compdfkit_Tools.Asset.Styles">
+    <Style x:Key="TCIRadioButtonStyle" TargetType="RadioButton">
+        <Setter Property="Background" Value="Red"></Setter>
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type local:TCIRadioButton}">
+                    <Grid HorizontalAlignment="Left">
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition Width="40"></ColumnDefinition>
+                            <ColumnDefinition Width="auto"></ColumnDefinition>
+                        </Grid.ColumnDefinitions>
+
+                        <Grid Grid.RowSpan="2">
+                            <Ellipse x:Name="RadioEllipse"
+                                         Width="20"
+                                         Height="20"
+                                         Fill="White"
+                                         Stroke="{TemplateBinding BorderBrush}"
+                                         StrokeThickness="1"/>
+                            <Ellipse x:Name="InnerEllipse"
+                                         Width="15"
+                                         Height="15"
+                                         Fill="Black"
+                                         Opacity="0"/>
+                        </Grid>
+                        <Border x:Name="Border" BorderBrush="#1A000000" BorderThickness="1" Grid.Column="1" CornerRadius="1" Padding="10" HorizontalAlignment="Stretch" Background="Transparent">
+                            <Grid>
+                                <Grid.ColumnDefinitions>
+                                    <ColumnDefinition></ColumnDefinition>
+                                    <ColumnDefinition></ColumnDefinition>
+                                </Grid.ColumnDefinitions>
+                                <!-- 这里是 ContentPresenter -->
+                                <Grid x:Name="PART_IconGrid" Width="32" Margin="0,0,10,0">
+                                    <ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
+                                </Grid>
+
+                                <Grid Name="TextGd" Grid.Column="1"  Width="{TemplateBinding TextWidth}" VerticalAlignment="Center">
+                                    <Grid.RowDefinitions>
+                                        <RowDefinition Height="25"></RowDefinition>
+                                        <RowDefinition></RowDefinition>
+                                    </Grid.RowDefinitions>
+                                    <TextBlock Text="{TemplateBinding Title}" TextWrapping="Wrap" FontSize="14" FontWeight="Bold" FontFamily="Segoe UI"></TextBlock>
+                                    <TextBlock Grid.Row="1" Text="{TemplateBinding Description}" TextWrapping="Wrap" FontSize="12" FontWeight="Normal" FontFamily="Segoe UI"></TextBlock>
+                                </Grid>
+                            </Grid>
+                        </Border>
+                    </Grid>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsChecked" Value="True">
+                            <Setter TargetName="InnerEllipse" Property="Opacity" Value="1"/>
+                        </Trigger>
+                        <Trigger Property="IsMouseOver" Value="True">
+                            <Setter TargetName="RadioEllipse" Property="Stroke" Value="DodgerBlue"/>
+                            <Setter TargetName="InnerEllipse" Property="Stroke" Value="DodgerBlue"/>
+                            <Setter TargetName="Border" Property="Background" Value="AliceBlue"></Setter>
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+</ResourceDictionary>

+ 47 - 0
Demo/Examples/Compdfkit_Tools/Asset/Styles/TCIRadioButton.cs

@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace Compdfkit_Tools.Asset.Styles
+{
+    public class TCIRadioButton : RadioButton
+    {
+        public static readonly DependencyProperty TitleProperty =
+            DependencyProperty.Register("Title", typeof(string), typeof(TCIRadioButton), new PropertyMetadata(string.Empty));
+
+        public string Title
+        {
+            get => (string)GetValue(TitleProperty);
+            set => SetValue(TitleProperty, value);
+        }
+
+        public static readonly DependencyProperty DescriptionProperty =
+            DependencyProperty.Register("Description", typeof(string), typeof(TCIRadioButton), new PropertyMetadata(string.Empty));
+
+        public string Description
+        {
+            get => (string)GetValue(DescriptionProperty);
+            set => SetValue(DescriptionProperty, value);
+        }
+
+        public static readonly DependencyProperty TextWidthProperty =
+    DependencyProperty.Register("TextWidth", typeof(double), typeof(TCIRadioButton), new PropertyMetadata());
+
+        public double TextWidth
+        {
+            get => (double)GetValue(TextWidthProperty);
+            set => SetValue(TextWidthProperty, value);
+        }
+
+        static TCIRadioButton()
+        {
+            DefaultStyleKeyProperty.OverrideMetadata(typeof(TCIRadioButton), new FrameworkPropertyMetadata(typeof(TCIRadioButton)));
+        }
+
+
+    }
+}

+ 35 - 0
Demo/Examples/Compdfkit_Tools/Asset/Styles/TabControlStyle.xaml

@@ -63,6 +63,41 @@
                     </ControlTemplate.Triggers>
                 </ControlTemplate>
             </Setter.Value>
+        </Setter> 
+    </Style>
+
+    <Style x:Key="LineTabControlStyle" TargetType="{x:Type TabControl}">
+        <Setter Property="Background" Value="#ffffff"></Setter>
+        <Setter Property="BorderThickness" Value="0"></Setter>
+        <Setter Property="BorderBrush" Value="Transparent"></Setter>
+        <Setter Property="Padding" Value="5"></Setter>
+        <Setter Property="VerticalAlignment" Value="Center"></Setter>
+        <Setter Property="HorizontalAlignment" Value="Center"></Setter>
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type TabControl}">
+                    <Grid>
+                        <Grid.RowDefinitions>
+                            <RowDefinition Height="50"></RowDefinition>
+                            <RowDefinition Height="*"></RowDefinition>
+                        </Grid.RowDefinitions>
+                        <TabPanel Grid.Row="0"
+                                  Panel.ZIndex="1" 
+                                  Background="Transparent"
+                                  IsItemsHost="True"
+                                  HorizontalAlignment="Center"></TabPanel>
+                        <Border Grid.Row="1" 
+                                    CornerRadius="5"
+                                    BorderThickness="{TemplateBinding BorderThickness}"
+                                    BorderBrush="{TemplateBinding BorderBrush}"
+                                    Background="{TemplateBinding Background}">
+                            <ContentPresenter ContentSource="SelectedContent"
+                                                  SnapsToDevicePixels="True"
+                                                  Margin="{TemplateBinding Padding}"></ContentPresenter>
+                        </Border>
+                    </Grid>
+                </ControlTemplate>
+            </Setter.Value>
         </Setter>
     </Style>
 </ResourceDictionary>

+ 42 - 0
Demo/Examples/Compdfkit_Tools/Asset/Styles/TabItemStyle.xaml

@@ -207,4 +207,46 @@
             </Setter.Value>
         </Setter>
     </Style>
+
+    <Style x:Key="LineTabItemStyle" TargetType="{x:Type TabItem}">
+        <Setter Property="Background" Value="Transparent"/>
+        <Setter Property="Foreground" Value="#666666"/>
+        <Setter Property="BorderThickness" Value="0"/>
+        <Setter Property="BorderBrush" Value="Transparent"/>
+        <Setter Property="Width" Value="100"/>
+        <Setter Property="Margin" Value="6,0,6,0"></Setter>
+        <Setter Property="FontWeight" Value="Normal"/>
+        <Setter Property="VerticalAlignment" Value="Center"/>
+        <Setter Property="HorizontalAlignment" Value="Center"/>
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="TabItem">
+                    <Grid SnapsToDevicePixels="False"
+                      Background="{TemplateBinding Background}"
+                      Margin="{TemplateBinding Margin}">
+                        <Grid.RowDefinitions>
+                            <RowDefinition Height="25"/>
+                            <RowDefinition Height="auto"/>
+                        </Grid.RowDefinitions>
+                        <ContentPresenter HorizontalAlignment="Center"
+                                              VerticalAlignment="Center"
+                                              SnapsToDevicePixels="True"
+                                              RecognizesAccessKey="True"
+                                              Margin="{TemplateBinding Padding}"
+                                              ContentSource="Header"
+                                              Focusable="False"/>
+                        <Rectangle Grid.Row="1" x:Name="TabLine" Fill="#348EF6" Height="2" VerticalAlignment="Bottom" Opacity="0" Grid.ColumnSpan="2"/>
+                    </Grid>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsMouseOver" Value="True">
+                            <Setter Property="Background" Value="#EFF2FF"/>
+                        </Trigger>
+                        <Trigger Property="IsSelected" Value="True">
+                            <Setter TargetName="TabLine" Property="Opacity" Value="1"/>
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
 </ResourceDictionary>

File diff suppressed because it is too large
+ 81 - 1
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFBOTABarControl.xaml.cs


+ 19 - 0
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFDigitalSignatureBarControl.xaml

@@ -0,0 +1,19 @@
+<UserControl x:Class="Compdfkit_Tools.Common.CPDFDigitalSignatureBarControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             mc:Ignorable="d" 
+             Loaded="UserControl_Loaded"
+             d:DesignHeight="40" d:DesignWidth="1280">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="../../Asset/Styles/ToggleButtonStyle.xaml"></ResourceDictionary>
+            </ResourceDictionary.MergedDictionaries>
+        </ResourceDictionary>
+    </UserControl.Resources>
+    <Border Background="#F2F3F5" Padding="0,2,0,2">
+        <Grid  Name="DigitalSignBarGrid" Width="0"></Grid>
+    </Border>
+</UserControl>

File diff suppressed because it is too large
+ 168 - 0
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFDigitalSignatureBarControl.xaml.cs


+ 0 - 1
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFPageEditBarControl.xaml

@@ -5,7 +5,6 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
              mc:Ignorable="d" 
-             Loaded="UserControl_Loaded"
              d:DesignHeight="40" d:DesignWidth="1280">
     <UserControl.Resources>
         <ResourceDictionary>

+ 2 - 1
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFPageEditBarControl.xaml.cs

@@ -49,9 +49,10 @@ namespace Compdfkit_Tools.PDFControl
         public CPDFPageEditBarControl()
         {
             InitializeComponent();
+            CreateButton();
         }
 
-        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        private void CreateButton()
         {
             foreach (KeyValuePair<string, string> data in ButtonDict)
             {

+ 3 - 2
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFTitleBarControl.xaml

@@ -31,7 +31,8 @@
                         <MenuItem Header="About Us" Style="{StaticResource Sub_MenuItem}" Click="AboutUsItem_Click"></MenuItem>
                         <MenuItem Header="Contact Us" Style="{StaticResource Sub_MenuItem}" Click="ContactUs_Click"></MenuItem>
                         <MenuItem Header="Privacy Agreement" Style="{StaticResource Sub_MenuItem}" Click="PrivacyAgreement_Click"></MenuItem>
-                        <MenuItem Header="ServiceTerms" Style="{StaticResource Sub_MenuItem}" Click="ServiceTerms_Click"></MenuItem>
+                        <MenuItem Header="Service Terms" Style="{StaticResource Sub_MenuItem}" Click="ServiceTerms_Click"></MenuItem>
+                        <MenuItem Header="Developer Device ID" Style="{StaticResource Sub_MenuItem}" Click="DeviceSerial_Click"></MenuItem>
                     </MenuItem>
                 </Menu>
 
@@ -60,7 +61,7 @@
                     <MenuItem Header="Help" Style="{StaticResource Dropdown_MenuItem}">
                         <MenuItem Header="Guide" Style="{StaticResource Sub_MenuItem }"></MenuItem>
                         <MenuItem Header="Api Reference" Style="{StaticResource Sub_MenuItem }"></MenuItem>
-                        <MenuItem Header="Contect us" Style="{StaticResource Sub_MenuItem }"></MenuItem>
+                        <MenuItem Header="Contact us" Style="{StaticResource Sub_MenuItem }"></MenuItem>
                     </MenuItem>
                 </Menu>
             </StackPanel>

+ 10 - 0
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFTitleBarControl.xaml.cs

@@ -71,5 +71,15 @@ namespace Compdfkit_Tools.PDFControl
         {
             System.Diagnostics.Process.Start("https://www.compdf.com/terms-of-service");
         }
+
+        private void DeviceSerial_Click(object sender, RoutedEventArgs e)
+        {
+            var parentWindow = Window.GetWindow(this);
+            DeviceSerialControl deviceSerialControl = new DeviceSerialControl()
+            {
+                Owner = parentWindow
+            };
+            deviceSerialControl.ShowDialog();
+        }
     }
 }

+ 17 - 12
Demo/Examples/Compdfkit_Tools/Common/BarControl/FormBarControl.xaml.cs

@@ -24,6 +24,7 @@ namespace Compdfkit_Tools.PDFControl
 {
     public partial class CPDFFormBarControl : UserControl, INotifyPropertyChanged
     {
+        private bool isFirstLoad = true;
         enum FromType
         {
             UnKnown = -1,
@@ -71,20 +72,24 @@ namespace Compdfkit_Tools.PDFControl
 
         private void UserControl_Loaded(object sender, RoutedEventArgs e)
         {
-            foreach (KeyValuePair<string, string> data in ButtonDict)
+            if (isFirstLoad)
             {
-                string Path = data.Value;
-                string name = data.Key;
-
-                Geometry annotationGeometry = Geometry.Parse(Path);
-                Path path = new Path
+                foreach (KeyValuePair<string, string> data in ButtonDict)
                 {
-                    Width = 20,
-                    Height = 20,
-                    Data = annotationGeometry,
-                    Fill = new SolidColorBrush(Color.FromRgb(0x43, 0x47, 0x4D))
-                };
-                CreateButtonForPath(path, name);
+                    string Path = data.Value;
+                    string name = data.Key;
+
+                    Geometry annotationGeometry = Geometry.Parse(Path);
+                    Path path = new Path
+                    {
+                        Width = 20,
+                        Height = 20,
+                        Data = annotationGeometry,
+                        Fill = new SolidColorBrush(Color.FromRgb(0x43, 0x47, 0x4D))
+                    };
+                    CreateButtonForPath(path, name);
+                }
+                isFirstLoad = false;
             }
         }
 

+ 1 - 6
Demo/Examples/Compdfkit_Tools/Common/Convert/ReverseBoolConverter.cs

@@ -10,12 +10,7 @@ namespace Compdfkit_Tools.Common
     {
         public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
         {
-            if ((bool)value == true)
-            {
-                return false;
-            }
-            else
-                return true;
+            return (bool)value != true;
         }
 
         public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

+ 1 - 1
Demo/Examples/Compdfkit_Tools/Common/Convert/TextLengthToVisibilityConverter.cs

@@ -24,7 +24,7 @@ namespace Compdfkit_Tools.Common
                         return Visibility.Collapsed;
                     }
                 }
-               return Visibility.Visible;
+                return Visibility.Visible;
             }
         }
 

+ 42 - 0
Demo/Examples/Compdfkit_Tools/Common/DeviceSerial/DeviceSerialControl.xaml

@@ -0,0 +1,42 @@
+<Window x:Class="Compdfkit_Tools.PDFControl.DeviceSerialControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
+             mc:Ignorable="d"
+             Title="Device ID"
+             Height="100"
+             Width="360"
+             WindowStartupLocation="CenterScreen"
+             ResizeMode="NoResize"
+             ShowInTaskbar="False">
+    <Grid>
+        <StackPanel
+            Orientation="Horizontal"
+            VerticalAlignment="Center"
+            HorizontalAlignment="Center">
+            <TextBox
+                Name="BoardText"
+                Width="260"
+                IsReadOnly="True"
+                VerticalContentAlignment="Center"
+                HorizontalContentAlignment="Center" />
+            <Button
+                Margin="10,0,0,0"
+                Padding="10,5,10,5"
+                Click="CopyBtn_Click">Copy</Button>
+        </StackPanel>
+        <Border
+            Name="CopyTips"
+            Background="#A0000000"
+            Visibility="Collapsed">
+            <TextBlock
+                VerticalAlignment="Center"
+                HorizontalAlignment="Center"
+                Margin="-50,0,0,0"
+                Foreground="#FFFFFFFF"
+                FontSize="14">Copy Success !</TextBlock>
+        </Border>
+    </Grid>
+</Window>

+ 68 - 0
Demo/Examples/Compdfkit_Tools/Common/DeviceSerial/DeviceSerialControl.xaml.cs

@@ -0,0 +1,68 @@
+using System;
+using System.Management;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media.Imaging;
+using System.Windows.Threading;
+using ComPDFKit.NativeMethod;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    public partial class DeviceSerialControl : Window
+    {
+        public DeviceSerialControl()
+        {
+            InitializeComponent();
+            Loaded += MainWindow_Loaded;
+            Icon = new BitmapImage(new Uri("pack://application:,,,/Compdfkit_Tools;component/ComPDFKit_Logo.ico"));
+        }
+        
+        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
+		{
+			try
+			{
+				BoardText.Text = CPDFSDKVerifier.GetDeviceId();
+			}
+			catch (Exception)
+			{
+				
+			}
+		}
+
+		private void CopyBtn_Click(object sender, RoutedEventArgs e)
+		{
+			try
+			{
+				if (BoardText != null && BoardText.Text != string.Empty)
+				{
+					Clipboard.SetText(BoardText.Text);
+					CopyTips.Visibility = Visibility.Visible;
+					DispatcherTimer dispatcherTimer = new DispatcherTimer();
+					dispatcherTimer.Tick += this.StartTimer_Tick;
+					dispatcherTimer.IsEnabled = false;
+					dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 1);
+					dispatcherTimer.Start();
+				}
+			}
+			catch (Exception)
+			{
+			}
+		}
+
+		private void StartTimer_Tick(object sender, EventArgs e)
+		{
+			try
+			{
+				CopyTips.Visibility = Visibility.Collapsed;
+				DispatcherTimer dispatcherTimer = sender as DispatcherTimer;
+				if (dispatcherTimer != null)
+				{
+					dispatcherTimer.Stop();
+				}
+			}
+			catch (Exception)
+			{
+			}
+		}
+    }
+}

+ 323 - 36
Demo/Examples/Compdfkit_Tools/Common/Helper/CommonHelper.cs

@@ -3,16 +3,97 @@ using ComPDFKit.PDFDocument;
 using Microsoft.Win32;
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Drawing;
 using System.IO;
+using System.Linq;
 using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Text.RegularExpressions;
 using System.Windows;
 using System.Windows.Controls;
+using System.Windows.Interop;
 using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Xml;
+using ComPDFKit.DigitalSign;
+using ComPDFKit.PDFAnnotation.Form;
+using Point = System.Windows.Point;
+using Size = System.Windows.Size;
 
 namespace Compdfkit_Tools.Helper
 {
+    public class SDKLicenseHelper
+    {
+        public string key = string.Empty;
+        public string secret = string.Empty;
+        public SDKLicenseHelper()
+        {
+            string sdkLicensePath = "license_key_windows.xml";
+            XmlDocument xmlDocument = new XmlDocument();
+            xmlDocument.Load(sdkLicensePath);
+
+            XmlNode keyNode = xmlDocument.SelectSingleNode("/license/key");
+            XmlNode secretNode = xmlDocument.SelectSingleNode("/license/secret");
+
+            if (keyNode != null && secretNode != null)
+            {
+                key = keyNode.InnerText;
+                secret = secretNode.InnerText;
+            }
+            else
+            {
+                Console.WriteLine("Key or secret element not found in the XML.");
+            }
+        }
+    }
+
     public static class CommonHelper
     {
+        public static int GetBitmapPointer(Bitmap bitmap)
+        {
+            IntPtr hBitmap = bitmap.GetHbitmap();
+            int bitmapPointer = hBitmap.ToInt32();
+
+            return bitmapPointer;
+        }
+
+        public static string EmailPattern = @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$";
+
+        public static bool IsValidEmail(string email)
+        {
+            string emailPattern = @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$";
+            return Regex.IsMatch(email, emailPattern);
+        }
+
+        public static string GetExactDateFromString(string dateString)
+        {
+            DateTime dateTime = GetDateTimeFromString(dateString);
+            return dateTime.ToString("yyyy/MM/dd HH:mm:ss");
+        }
+
+        public static DateTime GetDateTimeFromString(string dateString)
+        {
+            int start = 0;
+            for (int i = 0; i < dateString.Length; i++)
+            {
+                if (char.IsNumber(dateString[i]))
+                {
+                    start = i;
+                    break;
+                }
+            }
+            string date = dateString.Substring(start, 14);
+            string year = date.Substring(0, 4);
+            string month = date.Substring(4, 2);
+            string day = date.Substring(6, 2);
+            string hour = date.Substring(8, 2);
+            string minute = date.Substring(10, 2);
+            string second = date.Substring(12, 2);
+            return new DateTime(int.Parse(year), int.Parse(month), int.Parse(day), int.Parse(hour), int.Parse(minute), int.Parse(second));
+        }
+        
         /// <summary>
         /// Returns the file size based on the specified file path, with the smallest unit being bytes (B).
         /// </summary>
@@ -22,52 +103,42 @@ namespace Compdfkit_Tools.Helper
         /// </returns>
         public static string GetFileSize(string filePath)
         {
-            FileInfo fileInfo = null;
             try
             {
-                fileInfo = new FileInfo(filePath);
+                long fileSize = new FileInfo(filePath).Length;
+                string[] sizes = { "B", "KB", "MB", "GB" };
+                int order = 0;
+
+                while (fileSize >= 1024 && order < sizes.Length - 1)
+                {
+                    fileSize /= 1024;
+                    order++;
+                }
+
+                return $"{fileSize} {sizes[order]}";
             }
             catch
             {
                 return "0B";
             }
-            if (fileInfo != null && fileInfo.Exists)
-            {
-                double fileSize = fileInfo.Length;
-                if (fileSize > 1024)
-                {
-                    fileSize = Math.Round(fileSize / 1024, 2);
-                    if (fileSize > 1024)
-                    {
-                        fileSize = Math.Round(fileSize / 1024, 2);
-                        if (fileSize > 1024)
-                        {
-                            fileSize = Math.Round(fileSize / 1024, 2);
-                            return fileSize + " GB";
-                        }
-                        else
-                        {
-                            return fileSize + " MB";
-                        }
-                    }
-                    else
-                    {
-                        return fileSize + " KB";
-                    }
-                }
-                else
-                {
-                    return fileSize + " B";
-                }
-            }
-            return "0B";
         }
          
-        public static string GetFilePathOrEmpty()
+        public static string GetExistedPathOrEmpty(string filter = "PDF files (*.pdf)|*.pdf")
         {
             string selectedFilePath = string.Empty;
-            OpenFileDialog openFileDialog = new OpenFileDialog();
-            openFileDialog.Filter = "PDF files (*.pdf)|*.pdf";
+            OpenFileDialog openFileDialog;
+            try
+            {
+                openFileDialog = new OpenFileDialog
+                {
+                    Filter = filter
+                };
+            }
+            catch
+            {
+                return string.Empty;
+            };
+
 
             if (openFileDialog.ShowDialog() == true)
             {
@@ -75,7 +146,22 @@ namespace Compdfkit_Tools.Helper
             }
             return selectedFilePath;
         }
-         
+          
+        public static string GetGeneratePathOrEmpty(string filter, string defaultFileName = "")
+        {
+            string selectedFilePath = string.Empty;
+            SaveFileDialog saveFileDialog = new SaveFileDialog
+            {
+                Filter = filter,
+                FileName = defaultFileName
+            };
+            if (saveFileDialog.ShowDialog() == true)
+            {
+                selectedFilePath = saveFileDialog.FileName;
+            }
+            return selectedFilePath;
+        }
+
         public static bool GetPagesInRange(ref List<int> pageList, string pageRange, int count, char[] enumerationSeparator, char[] rangeSeparator, bool inittag = false)
         {
             string[] rangeSplit = pageRange.Split(enumerationSeparator); 
@@ -755,4 +841,205 @@ namespace Compdfkit_Tools.Helper
             }
         }
     }
+
+    public class PanelState
+    {
+        private static PanelState instance;
+
+        public enum RightPanelState
+        {
+            None,
+            PropertyPanel,
+            ViewSettings
+        }
+
+        private bool _isLeftPanelExpand;
+        public bool IsLeftPanelExpand
+        {
+            get { return _isLeftPanelExpand; }
+            set
+            {
+                if (_isLeftPanelExpand != value)
+                {
+                    _isLeftPanelExpand = value;
+                    OnPropertyChanged();
+                }
+            }
+        }
+
+        private RightPanelState _rightPanel;
+        public RightPanelState RightPanel
+        {
+            get { return _rightPanel; }
+            set
+            {
+                if (_rightPanel != value)
+                {
+                    _rightPanel = value;
+                    OnPropertyChanged();
+                }
+            }
+        }
+
+        private PanelState() { }
+
+        public static PanelState GetInstance()
+        {
+            if (instance == null)
+            {
+                instance = new PanelState();
+            }
+            return instance;
+        }
+
+        public event PropertyChangedEventHandler PropertyChanged;
+        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+        }
+    }
+
+    public class SaveHelper
+    {
+        private static SaveHelper instance;
+        private bool _canSave;
+        public bool CanSave
+        {
+            get { return _canSave; }
+            set
+            {
+                if (_canSave != value)
+                {
+                    _canSave = value;
+                    OnPropertyChanged();
+                }
+            }
+        }
+
+        public event PropertyChangedEventHandler PropertyChanged;
+        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+        }
+    }
+
+    public class CommandHelper
+    {
+        public static void CopyImage_Click(Dictionary<int, List<Bitmap>> imageDict)
+        {
+            try
+            {
+                if (imageDict != null && imageDict.Count > 0)
+                {
+                    foreach (int pageIndex in imageDict.Keys)
+                    {
+                        List<Bitmap> imageList = imageDict[pageIndex];
+                        foreach (Bitmap image in imageList)
+                        {
+                            MemoryStream ms = new MemoryStream();
+                            image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
+                            BitmapImage imageData = new BitmapImage();
+                            imageData.BeginInit();
+                            imageData.StreamSource = ms;
+                            imageData.CacheOption = BitmapCacheOption.OnLoad;
+                            imageData.EndInit();
+                            imageData.Freeze();
+                            Clipboard.SetImage(imageData);
+                            break;
+                        }
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+
+            }
+        }
+
+        public static void ExtraImage_Click(Dictionary<int,List<Bitmap>> imageDict)
+        {
+            System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
+            if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                string choosePath = folderDialog.SelectedPath;
+                string openPath = choosePath;
+                try
+                {
+                    if (imageDict != null && imageDict.Count > 0)
+                    {
+                        foreach (int pageIndex in imageDict.Keys)
+                        {
+                            List<Bitmap> imageList = imageDict[pageIndex];
+                            foreach (Bitmap image in imageList)
+                            {
+                                string savePath = Path.Combine(choosePath, Guid.NewGuid() + ".jpg");
+                                image.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg);
+                                openPath = savePath;
+                            }
+                        }
+                    }
+                    Process.Start("explorer", "/select,\"" + openPath + "\"");
+                }
+                catch (Exception ex)
+                {
+
+                }
+            }
+        }
+        
+        public static double CheckZoomLevel(double[] zoomLevelList, double zoom, bool IsGrowth)
+        {
+            double standardZoom = 100;
+            if (zoom <= 0.01)
+            {
+                return 0.01;
+            }
+            if (zoom >= 10)
+            {
+                return 10;
+            }
+
+            zoom *= 100;
+            for (int i = 0; i < zoomLevelList.Length - 1; i++)
+            {
+                if (zoom > zoomLevelList[i] && zoom <= zoomLevelList[i + 1] && IsGrowth)
+                {
+                    standardZoom = zoomLevelList[i + 1];
+                    break;
+                }
+                if (zoom >= zoomLevelList[i] && zoom < zoomLevelList[i + 1] && !IsGrowth)
+                {
+                    standardZoom = zoomLevelList[i];
+                    break;
+                }
+            }
+            return standardZoom / 100;
+        }
+    }
+
+    public class SignatureHelper
+    {
+        public static List<CPDFSignature> SignatureList;
+        
+        public static void InitEffectiveSignatureList(CPDFDocument document)
+        {
+            SignatureList = document.GetSignatureList();
+            for(int index = SignatureList.Count - 1; index >= 0; index--)
+            {
+                if (SignatureList[index].SignerList.Count <= 0)
+                {
+                    SignatureList.RemoveAt(index);
+                }
+            }
+        }
+
+        public static void VerifySignatureList(CPDFDocument document)
+        {
+            foreach (var sig in SignatureList)
+            {
+                sig.VerifySignatureWithDocument(document);
+            }
+            
+        }
+    }
 }

+ 1 - 1
Demo/Examples/Compdfkit_Tools/Common/PasswordControl/PasswordDialog.xaml.cs

@@ -5,7 +5,7 @@ using System.Windows.Controls;
 namespace Compdfkit_Tools.Common
 {
     /// <summary>
-    /// PasswordDialog.xaml 的交互逻辑
+    /// Interaction logic for PasswordDialog.xaml
     /// </summary>
     public partial class PasswordDialog : UserControl
     {

+ 4 - 4
Demo/Examples/Compdfkit_Tools/Common/PasswordControl/PasswordWindow.xaml.cs

@@ -5,7 +5,7 @@ using System.Windows;
 namespace Compdfkit_Tools.Common
 {
     /// <summary>
-    /// PasswordWindow.xaml 的交互逻辑
+    /// Interaction logic for PasswordWindow.xaml
     /// </summary>
     public partial class PasswordWindow : Window
     {
@@ -67,13 +67,13 @@ namespace Compdfkit_Tools.Common
             CloseWindow(passwordEventArgs);
         }
 
-        // 弹窗关闭时的处理逻辑
+        // The processing logic when the pop-up window is closed
         private void CloseWindow(PasswordEventArgs dialogResult)
         {
-            // 触发关闭事件,并传递返回值
+            // Trigger the close event and pass the return value
             DialogClosed?.Invoke(this, dialogResult);
 
-            // 关闭窗口
+            // Close the pop-up window
             Close();
         }
     }

+ 2 - 2
Demo/Examples/Compdfkit_Tools/Common/PropertyControl/PDFFont/CPDFFontUI.xaml.cs

@@ -157,7 +157,7 @@ namespace Compdfkit_Tools.Common
 
             List<string> fontStyleList = new List<string>()
             {
-                {"Common" },
+                {"Regular" },
                 {"Bold" },
                 {"Italic" },
                 {"Bold and Italic" }
@@ -200,7 +200,7 @@ namespace Compdfkit_Tools.Common
         private void FontStyleComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
             FontStyleTextBox.Text = (sender as ComboBox).SelectedItem.ToString();
-            if (FontStyleTextBox.Text == "Common")
+            if (FontStyleTextBox.Text == "Regular")
             {
                 IsBold = false;
                 IsItalic = false;

+ 193 - 7
Demo/Examples/Compdfkit_Tools/Compdfkit_Tools.csproj

@@ -44,15 +44,23 @@
     <ApplicationIcon>ComPDFKit_Logo.ico</ApplicationIcon>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="ComPDFKit.Desk, Version=1.9.0.0, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\ComPDFKit.NetFramework.1.9.0\lib\ComPDFKit.Desk.dll</HintPath>
+    <Reference Include="ComPDFKit.Desk, Version=1.10.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\ComPDFKit.NetFramework.1.10.0\lib\ComPDFKit.Desk.dll</HintPath>
     </Reference>
+<<<<<<< HEAD
     <Reference Include="ComPDFKit.Tool.RE, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>.\ComPDFKit.Tool.RE.dll</HintPath>
     </Reference>
     <Reference Include="ComPDFKit.Viewer, Version=1.9.0.0, Culture=neutral, processorArchitecture=MSIL">
       <HintPath>..\packages\ComPDFKit.NetFramework.1.9.0\lib\ComPDFKit.Viewer.dll</HintPath>
+=======
+    <Reference Include="ComPDFKit.Viewer, Version=1.10.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\ComPDFKit.NetFramework.1.10.0\lib\ComPDFKit.Viewer.dll</HintPath>
+    </Reference>
+    <Reference Include="Nager.Country, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Nager.Country.4.0.0\lib\netstandard2.0\Nager.Country.dll</HintPath>
+>>>>>>> bbc9a3f1809e713bf9d3a6376d7e90f20b806df1
     </Reference>
     <Reference Include="ComPDFKit.Viewer.RE, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
@@ -64,6 +72,7 @@
     <Reference Include="System" />
     <Reference Include="System.Data" />
     <Reference Include="System.Drawing" />
+    <Reference Include="System.Management" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml" />
     <Reference Include="Microsoft.CSharp" />
@@ -82,6 +91,9 @@
     <Reference Include="PresentationFramework" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Annotation\AnnotationControl\AnnotationControl.xaml.cs">
+      <DependentUpon>AnnotationControl.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Annotation\CPDFAnnotationPreviewerControl.xaml.cs">
       <DependentUpon>CPDFAnnotationPreviewerControl.xaml</DependentUpon>
     </Compile>
@@ -112,6 +124,10 @@
     <Compile Include="Annotation\PDFAnnotationPanel\PDFAnnotationUI\CPDFDeleteDialog.xaml.cs">
       <DependentUpon>CPDFDeleteDialog.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Asset\Styles\TCIRadioButton.cs" />
+    <Compile Include="Common\BarControl\CPDFDigitalSignatureBarControl.xaml.cs">
+      <DependentUpon>CPDFDigitalSignatureBarControl.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Common\BarControl\CPDFPageEditBarControl.xaml.cs">
       <DependentUpon>CPDFPageEditBarControl.xaml</DependentUpon>
     </Compile>
@@ -125,6 +141,9 @@
     <Compile Include="Common\Convert\ReverseVisibilityConverter.cs" />
     <Compile Include="Common\Convert\WindowStateToPathConverter.cs" />
     <Compile Include="Common\Convert\WindowStateToThicknessConverter.cs" />
+    <Compile Include="Common\DeviceSerial\DeviceSerialControl.xaml.cs">
+      <DependentUpon>DeviceSerialControl.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Common\PasswordControl\PasswordDialog.xaml.cs">
       <DependentUpon>PasswordDialog.xaml</DependentUpon>
     </Compile>
@@ -208,6 +227,67 @@
     <Compile Include="Common\PropertyControl\WritableComboBoxControl.xaml.cs">
       <DependentUpon>WritableComboBoxControl.xaml</DependentUpon>
     </Compile>
+    <Compile Include="DigitalSignature\AddCertificationControl\AddCertificationControl.xaml.cs">
+      <DependentUpon>AddCertificationControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\AddCertificationControl\AddCertificationDialog.xaml.cs">
+      <DependentUpon>AddCertificationDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\AddCertificationControl\AddCustomCertificationControl.xaml.cs">
+      <DependentUpon>AddCustomCertificationControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\AddCertificationControl\AddExistedCertificationControl.xaml.cs">
+      <DependentUpon>AddExistedCertificationControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\AddCertificationControl\SaveCerficateControl.xaml.cs">
+      <DependentUpon>SaveCerficateControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\CPDFSignatureListControl\CPDFSignatureListControl.xaml.cs">
+      <DependentUpon>CPDFSignatureListControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\DigitalSignatureControl\DigitalSignatureControl.xaml.cs">
+      <DependentUpon>DigitalSignatureControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\FillDigitalSignatureControl\FillDigitalSignatureDialog.xaml.cs">
+      <DependentUpon>FillDigitalSignatureDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\DigitalSignatureData\DigitalSignatureData.cs" />
+    <Compile Include="DigitalSignature\FillDigitalSignatureControl\FillDigitalSignatureControl.xaml.cs">
+      <DependentUpon>FillDigitalSignatureControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\ViewCertificationControl\CertificateChainControl.xaml.cs">
+      <DependentUpon>CertificateChainControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\ViewCertificationControl\CertificateDetailControl.xaml.cs">
+      <DependentUpon>CertificateDetailControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\ViewCertificationControl\CertificateInfoControl.xaml.cs">
+      <DependentUpon>CertificateInfoControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\ViewCertificationControl\ConfidenceControl.xaml.cs">
+      <DependentUpon>ConfidenceControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\ViewCertificationControl\SummaryControl.xaml.cs">
+      <DependentUpon>SummaryControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\ViewCertificationControl\ViewCertificateDialog.xaml.cs">
+      <DependentUpon>ViewCertificateDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\SignatureStatusBarControl\SignatureStatusBarControl.xaml.cs">
+      <DependentUpon>SignatureStatusBarControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\VerifyDigitalSignatureControl\DigitalSignatureInfoControl.xaml.cs">
+      <DependentUpon>DigitalSignatureInfoControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\VerifyDigitalSignatureControl\DigitalSignatureValiditySummaaryControl.xaml.cs">
+      <DependentUpon>DigitalSignatureValiditySummaaryControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="DigitalSignature\VerifyDigitalSignatureControl\VerifyDigitalSignatureControl.xaml.cs">
+      <DependentUpon>VerifyDigitalSignatureControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Edit\ContentEditControl\ContentEditControl.xaml.cs">
+      <DependentUpon>ContentEditControl.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Edit\PDFContentEditControl.xaml.cs">
       <DependentUpon>PDFContentEditControl.xaml</DependentUpon>
     </Compile>
@@ -233,6 +313,9 @@
     <Compile Include="Common\BarControl\FormBarControl.xaml.cs">
       <DependentUpon>FormBarControl.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Form\FormControl\FormControl.xaml.cs">
+      <DependentUpon>FormControl.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Form\FromPropertyControl.xaml.cs">
       <DependentUpon>FromPropertyControl.xaml</DependentUpon>
     </Compile>
@@ -257,6 +340,9 @@
     <Compile Include="Form\Property\TextFieldProperty.xaml.cs">
       <DependentUpon>TextFieldProperty.xaml</DependentUpon>
     </Compile>
+    <Compile Include="PageEdit\PageEditControl\PageEditControl.xaml.cs">
+      <DependentUpon>PageEditControl.xaml</DependentUpon>
+    </Compile>
     <Compile Include="PageEdit\PDFPageEdit\CPDFPageEditControl.xaml.cs">
       <DependentUpon>CPDFPageEditControl.xaml</DependentUpon>
     </Compile>
@@ -329,6 +415,9 @@
     <Compile Include="PDFView\PDFViewControl\PDFViewControl.xaml.cs">
       <DependentUpon>PDFViewControl.xaml</DependentUpon>
     </Compile>
+    <Compile Include="PDFView\RegularViewerControl.xaml.cs">
+      <DependentUpon>RegularViewerControl.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Properties\AssemblyInfo.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -389,21 +478,25 @@
     <Resource Include="Asset\Resource\Color_btn_ic.png" />
     <Resource Include="Asset\Resource\Transparent_btn_ic.png" />
     <Resource Include="Asset\Resource\warn.png" />
-    <Resource Include="Asset\Resource\ComPDFKit_Logo.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Resource>
     <Resource Include="ComPDFKit_Logo.ico" />
+<<<<<<< HEAD
     <Content Include="ComPDFKit.Tool.RE.dll">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
     <Content Include="ComPDFKit.Viewer.RE.dll">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
+=======
+    <Resource Include="Asset\Resource\Logo.png" />
+>>>>>>> bbc9a3f1809e713bf9d3a6376d7e90f20b806df1
     <Content Include="VirtualizingWrapPanel.dll">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
   </ItemGroup>
   <ItemGroup>
+    <Page Include="Annotation\AnnotationControl\AnnotationControl.xaml">
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="Annotation\CPDFAnnotationPreviewerControl.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -460,6 +553,10 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Asset\Styles\RadioButtonStyle.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Asset\Styles\SliderStyle.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -488,6 +585,10 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Common\BarControl\CPDFDigitalSignatureBarControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Common\BarControl\CPDFPageEditBarControl.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -496,6 +597,7 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Common\DeviceSerial\DeviceSerialControl.xaml" />
     <Page Include="Common\PasswordControl\PasswordDialog.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -604,6 +706,71 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="DigitalSignature\AddCertificationControl\AddCertificationControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="DigitalSignature\AddCertificationControl\AddCertificationDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="DigitalSignature\AddCertificationControl\AddCustomCertificationControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="DigitalSignature\AddCertificationControl\AddExistedCertificationControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="DigitalSignature\AddCertificationControl\SaveCerficateControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="DigitalSignature\CPDFSignatureListControl\CPDFSignatureListControl.xaml" />
+    <Page Include="DigitalSignature\DigitalSignatureControl\DigitalSignatureControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="DigitalSignature\FillDigitalSignatureControl\FillDigitalSignatureDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="DigitalSignature\FillDigitalSignatureControl\FillDigitalSignatureControl.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="DigitalSignature\ViewCertificationControl\CertificateChainControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="DigitalSignature\ViewCertificationControl\CertificateDetailControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="DigitalSignature\ViewCertificationControl\CertificateInfoControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="DigitalSignature\ViewCertificationControl\ConfidenceControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="DigitalSignature\ViewCertificationControl\SummaryControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="DigitalSignature\ViewCertificationControl\ViewCertificateDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="DigitalSignature\SignatureStatusBarControl\SignatureStatusBarControl.xaml" />
+    <Page Include="DigitalSignature\VerifyDigitalSignatureControl\DigitalSignatureInfoControl.xaml" />
+    <Page Include="DigitalSignature\VerifyDigitalSignatureControl\DigitalSignatureValiditySummaaryControl.xaml" />
+    <Page Include="DigitalSignature\VerifyDigitalSignatureControl\VerifyDigitalSignatureControl.xaml" />
+    <Page Include="Edit\ContentEditControl\ContentEditControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Edit\PDFContentEditControl.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -636,6 +803,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Form\FormControl\FormControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Form\FromPropertyControl.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -668,6 +839,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="PageEdit\PageEditControl\PageEditControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="PageEdit\PDFPageEdit\CPDFPageEditControl.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -776,13 +951,24 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="PDFView\RegularViewerControl.xaml" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\..\compdfkit\ComPDFKit\ComPDFKitCSharp\ComPDFKit.Desk.csproj">
+      <Project>{56e518ad-c126-4b48-9a09-0a64c87020e4}</Project>
+      <Name>ComPDFKit.Desk</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\..\compdfkit\ComPDFKit\ComPDFKitDesktop\ComPDFKit.Viewer\ComPDFKit.Viewer.csproj">
+      <Project>{18ec356d-8130-49d4-b4e6-ac290e1065b7}</Project>
+      <Name>ComPDFKit.Viewer</Name>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <Import Project="..\packages\ComPDFKit.NetFramework.1.9.0\build\ComPDFKit.NetFramework.targets" Condition="Exists('..\packages\ComPDFKit.NetFramework.1.9.0\build\ComPDFKit.NetFramework.targets')" />
+  <Import Project="..\packages\ComPDFKit.NetFramework.1.10.0\build\ComPDFKit.NetFramework.targets" Condition="Exists('..\packages\ComPDFKit.NetFramework.1.10.0\build\ComPDFKit.NetFramework.targets')" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>
       <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
     </PropertyGroup>
-    <Error Condition="!Exists('..\packages\ComPDFKit.NetFramework.1.9.0\build\ComPDFKit.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ComPDFKit.NetFramework.1.9.0\build\ComPDFKit.NetFramework.targets'))" />
+    <Error Condition="!Exists('..\packages\ComPDFKit.NetFramework.1.10.0\build\ComPDFKit.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ComPDFKit.NetFramework.1.10.0\build\ComPDFKit.NetFramework.targets'))" />
   </Target>
 </Project>

File diff suppressed because it is too large
+ 61 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddCertificationControl.xaml


+ 66 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddCertificationControl.xaml.cs

@@ -0,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace Compdfkit_Tools.PDFControl
+{ 
+    public partial class AddCertificationControl : UserControl, INotifyPropertyChanged
+    {
+        public Dictionary<bool, CreateCertificationMode> getCreateCertificationMode = new Dictionary<bool, CreateCertificationMode>()
+        {
+            {true, CreateCertificationMode.AddExistedCertification},
+            {false, CreateCertificationMode.AddCustomCertification}
+        };
+
+        private bool _addExistedCertification = true;
+        public bool AddExistedCertification
+        {
+            get => _addExistedCertification;
+            set => UpdateProper(ref _addExistedCertification, value);
+        }
+
+        private bool _addCustomCertification;
+        public bool AddCustomCertification
+        {
+            get => _addCustomCertification;
+            set => UpdateProper(ref _addCustomCertification, value);
+        }
+
+        public event EventHandler<CreateCertificationMode> ContinueEvent;
+        public event EventHandler CancelEvent;
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        public AddCertificationControl()
+        {
+            InitializeComponent();
+            DataContext = this;
+        }
+
+        private void ContinueBtn_Click(object sender, RoutedEventArgs e)
+        {
+            ContinueEvent?.Invoke(this, getCreateCertificationMode[AddExistedCertification]);
+        }
+
+        private void CancelBtn_Click(object sender, RoutedEventArgs e)
+        {
+            CancelEvent?.Invoke(this, EventArgs.Empty);
+        }
+
+        protected void UpdateProper<T>(ref T properValue,
+                       T newValue,
+                       [CallerMemberName] string properName = "")
+        {
+            if (object.Equals(properValue, newValue))
+                return;
+
+            properValue = newValue;
+            OnPropertyChanged(properName);
+        }
+
+        protected void OnPropertyChanged([CallerMemberName] string propertyName = "") =>
+    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+    }
+}

+ 15 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddCertificationDialog.xaml

@@ -0,0 +1,15 @@
+<Window x:Class="Compdfkit_Tools.PDFControl.AddCertificationDialog"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
+        mc:Ignorable="d"
+        ResizeMode="NoResize"
+        ShowInTaskbar="False"
+        Title="AddCertificationDialog" Height="505" Width="482"
+        Loaded="Window_Loaded">
+    <Border x:Name="BodyBd">
+        
+    </Border>
+</Window>

+ 133 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddCertificationDialog.xaml.cs

@@ -0,0 +1,133 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    /// <summary>
+    /// Interaction logic for AddCertificationDialog.xaml
+    /// </summary>
+    public partial class AddCertificationDialog : Window
+    {
+        private AddCertificationControl addCertificationControl = null;
+        private AddCustomCertificationControl addCustomCertificationControl = null;
+        private AddExistedCertificationControl addExistedCertificationControl = null;
+        private SaveCerficateControl saveCerficateControl = null;
+
+        private string addCertificationControlTitle = "Add Digital Signatures";
+        private string addExistedCertificationControlTitle = "Add A Digital ID";
+        private string addCustomCertificationControlTitle = "Customize the Signature";
+        private string saveCerficateControlTitle = "Save the Self-Signed Digital ID to A File";
+        
+        public event EventHandler<CertificateAccess> FillSignatureEvent;
+
+
+        public AddCertificationDialog()
+        {
+            InitializeComponent();
+            addCertificationControl = new AddCertificationControl();
+            BodyBd.Child = addCertificationControl;
+            Title = addCertificationControlTitle;
+        }
+
+        private void Window_Loaded(object sender, RoutedEventArgs e)
+        {
+            addCertificationControl.ContinueEvent -= ContinueEvent;
+            addCertificationControl.ContinueEvent += ContinueEvent;
+            addCertificationControl.CancelEvent -= CloseEvent;
+            addCertificationControl.CancelEvent += CloseEvent;
+        }
+
+        private void ContinueEvent(object sender, CreateCertificationMode e)
+        {
+            if(e == CreateCertificationMode.AddExistedCertification)
+            {
+                addExistedCertificationControl = new AddExistedCertificationControl();
+                BodyBd.Child = addExistedCertificationControl;
+                Title = addExistedCertificationControlTitle;
+                this.Height = addExistedCertificationControl.Height + 35;
+                this.Width = addExistedCertificationControl.Width + 20;
+                 
+                addExistedCertificationControl.CancelEvent += CancelEvent;
+                addExistedCertificationControl.FillSignatureEvent -= FillSignature;
+                addExistedCertificationControl.FillSignatureEvent += FillSignature;
+
+
+            }
+            else if(e == CreateCertificationMode.AddCustomCertification)
+            {
+                addCustomCertificationControl = new AddCustomCertificationControl();
+                BodyBd.Child = addCustomCertificationControl;
+                Title = addCustomCertificationControlTitle;
+                this.Height = addCustomCertificationControl.Height + 35;
+                this.Width = addCustomCertificationControl.Width + 20;
+
+                addCustomCertificationControl.ContinueEvent -= ContinueEvent;
+                addCustomCertificationControl.ContinueEvent += ContinueEvent;
+
+                addCustomCertificationControl.CancelEvent -= CancelEvent;
+                addCustomCertificationControl.CancelEvent += CancelEvent;
+            }
+            else if (e == CreateCertificationMode.SaveCertificate)
+            {
+                saveCerficateControl = new SaveCerficateControl();
+                saveCerficateControl.CertificateInfo = addCustomCertificationControl.CertificateInfo;
+                BodyBd.Child = saveCerficateControl;
+                Title = saveCerficateControlTitle;
+                
+                this.Height = saveCerficateControl.Height + 20;
+                this.Width = saveCerficateControl.Width + 20;
+                saveCerficateControl.FillSignatureEvent -= FillSignature;
+                saveCerficateControl.FillSignatureEvent += FillSignature;
+                saveCerficateControl.CancelSaveEvent -= CancelSaveEvent;
+                saveCerficateControl.CancelSaveEvent += CancelSaveEvent;
+            }
+        }
+
+        private void FillSignature(object sender, CertificateAccess e)
+        {
+            Close();
+            FillSignatureEvent?.Invoke(sender, e);
+        }
+
+        private void CancelEvent(object sender, EventArgs e)
+        {
+            addCertificationControl = new AddCertificationControl();
+            BodyBd.Child = addCertificationControl;
+            Title = addCertificationControlTitle;
+            this.Height = addCertificationControl.Height + 35;
+            this.Width = addCertificationControl.Width + 20;
+            addCertificationControl.ContinueEvent -= ContinueEvent;
+            addCertificationControl.ContinueEvent += ContinueEvent;
+            addCertificationControl.CancelEvent -= CloseEvent;
+            addCertificationControl.CancelEvent += CloseEvent;
+        }
+        
+        private void CancelSaveEvent(object sender, EventArgs e)
+        {
+            BodyBd.Child = addCustomCertificationControl;
+            Title = addCustomCertificationControlTitle;
+            this.Height = addCustomCertificationControl.Height + 35;
+            this.Width = addCustomCertificationControl.Width + 20;
+            addCustomCertificationControl.ContinueEvent -= ContinueEvent;
+            addCustomCertificationControl.ContinueEvent += ContinueEvent;
+            addCustomCertificationControl.CancelEvent -= CancelEvent;
+            addCustomCertificationControl.CancelEvent += CancelEvent;
+        }
+
+        private void CloseEvent(object sender, EventArgs e)
+        {
+            Close();
+        }
+    }
+}

+ 81 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddCustomCertificationControl.xaml

@@ -0,0 +1,81 @@
+<UserControl x:Class="Compdfkit_Tools.PDFControl.AddCustomCertificationControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
+              xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common"
+             mc:Ignorable="d" 
+             Height="350" Width="403">
+    <UserControl.Resources>
+        <cpdfcommon:TextLengthToVisibilityConverter x:Key="TextLengthToVisibilityConverter"></cpdfcommon:TextLengthToVisibilityConverter>
+        <cpdfcommon:BoolToCollapsedConverter x:Key="BoolToCollapsedConverter"></cpdfcommon:BoolToCollapsedConverter>
+    </UserControl.Resources>
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="280"></RowDefinition>
+            <RowDefinition></RowDefinition>
+            <RowDefinition></RowDefinition>
+        </Grid.RowDefinitions>
+        <Grid Background="#ffffff"  Margin="20,0,0,0"  Panel.ZIndex="1" Height="20" HorizontalAlignment="Left" VerticalAlignment="Top">
+            <TextBlock Text="Signature Information" FontWeight="Bold" FontSize="16"></TextBlock>
+        </Grid>
+        <Border Margin="12" BorderBrush="#33000000" BorderThickness="1">
+            <Grid Margin="10">
+                <Grid.RowDefinitions>
+                    <RowDefinition></RowDefinition>
+                    <RowDefinition></RowDefinition>
+                    <RowDefinition></RowDefinition>
+                    <RowDefinition></RowDefinition>
+                    <RowDefinition></RowDefinition>
+                    <RowDefinition></RowDefinition>
+                </Grid.RowDefinitions>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="*"></ColumnDefinition>
+                    <ColumnDefinition Width="2*"></ColumnDefinition>
+                </Grid.ColumnDefinitions>
+                <StackPanel Orientation="Horizontal">
+                    <TextBlock Text="Grantor Name" VerticalAlignment="Center"></TextBlock>
+                    <TextBlock Text="*" Foreground="Red" VerticalAlignment="Center"></TextBlock>
+                </StackPanel>
+                <Grid Grid.Column="1">
+                    <TextBox Height="28" x:Name="GrantorNameTxt" VerticalContentAlignment="Center" VerticalAlignment="Center" Text="{Binding GrantorName}"/>
+                    <TextBlock Text="Please Enter Grantor Name" VerticalAlignment="Center"  Margin="10,0,0,0" Visibility="{Binding ElementName=GrantorNameTxt, Path=Text, Converter={StaticResource TextLengthToVisibilityConverter}}" IsHitTestVisible="False"  Foreground="#BBB"></TextBlock>
+                </Grid>
+                <TextBlock Grid.Row="1" Text="Organizational Unit" VerticalAlignment="Center"></TextBlock>
+                <Grid Grid.Column="1" Grid.Row="1">
+                    <TextBox Height="28" x:Name="OrganizationalUnitTxt" VerticalContentAlignment="Center" Text="{Binding OrganizationalUnit}" VerticalAlignment="Center"/>
+                    <TextBlock Text="Please Enter Organizational Unit" VerticalAlignment="Center"  Margin="10,0,0,0" Visibility="{Binding ElementName=OrganizationalUnitTxt, Path=Text, Converter={StaticResource TextLengthToVisibilityConverter}}" IsHitTestVisible="False"  Foreground="#BBB"></TextBlock>
+                </Grid>
+                <TextBlock Grid.Row="2" Text="Organization" VerticalAlignment="Center"></TextBlock>
+                <Grid Grid.Column="1" Grid.Row="2">
+                    <TextBox Height="28" x:Name="OrganizationTxt" VerticalContentAlignment="Center" Text="{Binding Organization}" VerticalAlignment="Center"/>
+                    <TextBlock Text="Please Enter Organization" VerticalAlignment="Center"  Margin="10,0,0,0" Visibility="{Binding ElementName=OrganizationTxt, Path=Text, Converter={StaticResource TextLengthToVisibilityConverter}}" IsHitTestVisible="False"  Foreground="#BBB"></TextBlock>
+                </Grid>
+                <StackPanel Grid.Row="3" Orientation="Horizontal">
+                    <TextBlock Text="Email" VerticalAlignment="Center"></TextBlock>
+                    <TextBlock Text="*" Foreground="Red" VerticalAlignment="Center"></TextBlock>
+                </StackPanel>
+                <Grid Grid.Column="1" Grid.Row="3">
+                    <TextBox Height="28" x:Name="EmailTxt" VerticalContentAlignment="Center" Text="{Binding Email}" VerticalAlignment="Center"/>
+                    <TextBlock Text="Please Enter Email" VerticalAlignment="Center"  Margin="10,0,0,0" Visibility="{Binding ElementName=EmailTxt, Path=Text, Converter={StaticResource TextLengthToVisibilityConverter}}" IsHitTestVisible="False"  Foreground="#BBB"></TextBlock>
+                </Grid>
+                <TextBlock Grid.Row="4" Text="Country/Area" VerticalAlignment="Center"></TextBlock>
+                <Grid Grid.Column="1" Grid.Row="4">
+                    <ComboBox Margin="0,5,0,5" Name="AreaCmb" SelectedIndex="0" SelectionChanged="AreaCmb_SelectionChanged"></ComboBox>
+                </Grid>
+                <TextBlock Grid.Row="5" Text="Purpose" VerticalAlignment="Center"></TextBlock>
+                <Grid Grid.Column="1" Grid.Row="5">
+                    <ComboBox Margin="0,5,0,5" Name="PurposeCmb" SelectedIndex="0" SelectionChanged="PurposeCmb_SelectionChanged"></ComboBox>
+                </Grid>
+            </Grid>
+        </Border>
+        <TextBlock Grid.Row="1" Name="ErrorTipsText" Foreground="Red" Margin="15,0,24,14"></TextBlock>
+        <Grid Grid.Row="2">
+            <StackPanel Margin="0,-10,24,12" VerticalAlignment="Bottom" Orientation="Horizontal" HorizontalAlignment="Right">
+                <Button x:Name="CancelBtn" Height="32" Width="112" Margin="0,0,8,0" Content="Cancel" Click="CancelBtn_Click"></Button>
+                <Button x:Name="SaveBtn" Height="32" Width="112" Content="Save" Click="SaveBtn_Click"></Button>
+            </StackPanel>   
+        </Grid>
+    </Grid>
+</UserControl>

+ 161 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddCustomCertificationControl.xaml.cs

@@ -0,0 +1,161 @@
+using ComPDFKit.DigitalSign;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKit.PDFDocument;
+using Compdfkit_Tools.Helper;
+using Nager.Country;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Compdfkit_Tools.PDFControl
+{
+
+
+    /// <summary>
+    /// Interaction logic for AddCustomCertificationControl.xaml
+    /// </summary>
+    public partial class AddCustomCertificationControl : UserControl
+    {
+        public event EventHandler SaveEvent;
+        public event EventHandler CancelEvent;
+        public CertificateInfo CertificateInfo = new CertificateInfo();
+
+        private string _grantorName = string.Empty;
+        public string GrantorName
+        {
+            get => _grantorName;
+            set
+            {
+                _grantorName = value;
+                CertificateInfo.GrantorName = value;
+            }
+        }
+
+        private string _email = string.Empty;
+        public string Email
+        {
+            get => _email;
+            set
+            {
+                _email = value;
+                CertificateInfo.Email = value;
+            }
+        }
+
+        private string _organization = string.Empty;
+        public string Organization
+        {
+            get => _organization;
+            set
+            {
+                _organization = value;
+                CertificateInfo.Organization = value;
+            }
+        }
+
+        private string _organizationalUnit = string.Empty;
+        public string OrganizationalUnit
+        {
+            get => _organizationalUnit;
+            set
+            {
+                _organizationalUnit = value;
+                CertificateInfo.OrganizationUnit = value;
+            }
+        }
+
+        private readonly CountryProvider countryProvider = new CountryProvider();
+        private readonly List<string> countryNames = new List<string>();
+        
+        public event EventHandler<CreateCertificationMode> ContinueEvent;
+
+        public AddCustomCertificationControl()
+        {
+            InitializeComponent();
+            this.DataContext = this;
+            FillComboBox();
+        }
+
+        private void FillComboBox()
+        {
+            FillComboBoxWithCountries();
+            FillComboBoxWithPropose();
+        }
+
+        private void FillComboBoxWithPropose()
+        {
+            PurposeCmb.Items.Clear();
+            PurposeCmb.Items.Add("Digital Signatures");
+            PurposeCmb.Items.Add("Data Encryption");
+            PurposeCmb.Items.Add("Digital Signatures and Data Encryption");
+
+        }
+
+        private void FillComboBoxWithCountries()
+        {
+            var countries = countryProvider.GetCountries();
+            foreach (var country in countries)
+            {
+                var formattedName = $"{country.Alpha2Code} - {country.CommonName}";
+                countryNames.Add(formattedName);
+            }
+
+            AreaCmb.ItemsSource = countryNames;
+        }
+
+        private void CancelBtn_Click(object sender, RoutedEventArgs e)
+        {
+            CancelEvent?.Invoke(this, EventArgs.Empty);
+        }
+
+        private void SaveBtn_Click(object sender, RoutedEventArgs e)
+        {
+
+            if (CertificateInfo.GrantorName == string.Empty)
+            {
+                ErrorTipsText.Text = "Please input Grantor Name";
+                return;
+            }
+            if(CertificateInfo.Email == string.Empty)
+            {
+                ErrorTipsText.Text = "Please input Email";
+                return;
+            }
+            if (!CommonHelper.IsValidEmail(CertificateInfo.Email))
+            {
+                ErrorTipsText.Text = "Email format is not correct";
+                return;
+            }
+            ContinueEvent?.Invoke(this, CreateCertificationMode.SaveCertificate);
+        }
+
+        private void AreaCmb_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            if (AreaCmb.SelectedItem != null)
+            {
+                string selectedText = AreaCmb.SelectedItem.ToString();
+                string[] parts = selectedText.Split('-');
+                CertificateInfo.Area = parts[0].Trim(); // Extract the Alpha2Code 
+            }
+        }
+
+        private void PurposeCmb_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            if (PurposeCmb.SelectedItem != null)
+            {
+                CertificateInfo.PurposeType = (CPDFCertUsage)PurposeCmb.SelectedIndex + 1;
+            }
+        }
+    }
+}

+ 48 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddExistedCertificationControl.xaml

@@ -0,0 +1,48 @@
+<UserControl x:Class="Compdfkit_Tools.PDFControl.AddExistedCertificationControl"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
+        xmlns:common="clr-namespace:Compdfkit_Tools.Common"
+        mc:Ignorable="d"
+        Height="277" Width="470">
+    <UserControl.Resources>
+        <common:TextLengthToVisibilityConverter x:Key="TextLengthToVisibilityConverter"></common:TextLengthToVisibilityConverter>
+    </UserControl.Resources>
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="auto"></RowDefinition>
+            <RowDefinition Height="auto"></RowDefinition>
+            <RowDefinition Height="auto"></RowDefinition>
+            <RowDefinition></RowDefinition>
+        </Grid.RowDefinitions>
+        <TextBlock TextWrapping="Wrap" FontSize="14" Foreground="#000000" Margin="10,20,10,20" Height="40"
+                   Text="Browse a digital ID file. Digital ID cards are password-protected. If you do not know the password, you cannot obtain a digital ID card.">
+        </TextBlock>
+        <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="10,0,10,8">
+            <TextBlock Text="Certificate File" Foreground="#43474D" FontSize="14" VerticalAlignment="Center" Margin="10,0,10,0" HorizontalAlignment="Left" Width="88" FontFamily="Segoe UI"></TextBlock>
+            <Grid IsEnabled="{Binding InputEnable}">
+                <TextBox Width="238" Height="28"  x:Name="FileNameTxt" VerticalContentAlignment="Center" VerticalAlignment="Center" IsReadOnly="True" TextChanged="FileNameTxt_OnTextChanged"/>
+                <TextBlock Text="Select a file" Margin="8" VerticalAlignment="Center"   Visibility="{Binding ElementName=FileNameTxt, Path=Text, Converter={StaticResource TextLengthToVisibilityConverter}}" IsHitTestVisible="False"  Foreground="#BBB"></TextBlock>
+            </Grid>
+            <Button x:Name="SelectFileBtn" Content="Upload" Width="90" Height="28" FontSize="14" FontFamily="Segoe UI" Margin="8,0,0,0" Click="SelectFileBtn_Click"></Button>
+        </StackPanel>
+        <StackPanel Grid.Row="2" Orientation="Horizontal"  Margin="10,0,0,8">
+            <TextBlock Foreground="#43474D" Width="88" FontSize="14" FontFamily="Segoe UI" Text="Password" VerticalAlignment="Top" Margin="10,5,10,0"></TextBlock>
+            <StackPanel  Margin="0,0,0,0">
+                <Grid>
+                    <PasswordBox Name="PasswordBoxTxt" Padding="5,0,0,0" Width="238" Height="28"  VerticalContentAlignment="Center" VerticalAlignment="Center" PasswordChanged="PasswordBoxTxt_OnPasswordChanged"></PasswordBox>
+                    <TextBlock x:Name="PasswordTextBlock" Text="Please enter your password" Margin="8" VerticalAlignment="Center" IsHitTestVisible="False" Foreground="#BBB"></TextBlock>
+                </Grid>
+                <TextBlock Name="ErrorTipsText" Foreground="Red" Margin="0,4,0,0"></TextBlock>
+            </StackPanel>
+        </StackPanel>
+        <Grid Grid.Row="4">
+            <StackPanel  Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="24"> 
+                <Button x:Name="CancelBtn" Content="Cancel"  Margin="0,0,10,0" Width="112" Height="32" BorderThickness="1" Click="CancelBtn_Click"></Button>
+                <Button x:Name="DoneBtn" Content="OK" Width="112" Height="32" BorderThickness="1" IsEnabled="{Binding CanContinue}" Click="DoneBtn_Click"></Button>
+            </StackPanel>
+        </Grid> 
+    </Grid>
+</UserControl>

+ 91 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddExistedCertificationControl.xaml.cs

@@ -0,0 +1,91 @@
+using ComPDFKit.DigitalSign;
+using Compdfkit_Tools.Helper;
+using System;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    public partial class AddExistedCertificationControl : UserControl,INotifyPropertyChanged
+    {
+        public event EventHandler SaveEvent;
+        public event EventHandler CancelEvent;
+        public event EventHandler<CertificateAccess> FillSignatureEvent;
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        private bool _canContinue;
+        public bool CanContinue
+        {
+            get => _canContinue;
+            set => UpdateProper(ref _canContinue, value);
+        }
+
+        public AddExistedCertificationControl()
+        {
+            InitializeComponent();
+            DataContext = this;
+        }
+
+        private void CancelBtn_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            CancelEvent?.Invoke(this, EventArgs.Empty);
+        }
+
+        private void DoneBtn_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            if (!CPDFPKCS12CertHelper.CheckPKCS12Password(FileNameTxt.Text, PasswordBoxTxt.Password))
+            {
+                ErrorTipsText.Text = "Invalid Password.";
+                return;
+            }
+
+            FillSignatureEvent?.Invoke(sender, new CertificateAccess { filePath = FileNameTxt.Text, password = PasswordBoxTxt.Password });
+
+        }
+
+        private void SelectFileBtn_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            string filePath = CommonHelper.GetExistedPathOrEmpty("PFX Files(*.pfx) | *.pfx|P12 Files(*.p12) | *.p12");
+            if (filePath != string.Empty)
+            {
+                FileNameTxt.Text = filePath;
+            }
+        }
+
+        private void PasswordBoxTxt_OnPasswordChanged(object sender, RoutedEventArgs e)
+        {
+            PasswordBox passwordBox = (PasswordBox)sender;
+
+            if (passwordBox.Password.Length > 0)
+            {
+                PasswordTextBlock.Visibility = Visibility.Hidden;
+            }
+            else
+            {
+                PasswordTextBlock.Visibility = Visibility.Visible;
+            }
+            CanContinue = FileNameTxt.Text.Length > 0 && PasswordBoxTxt.Password.Length > 0;
+        }
+        
+        private void FileNameTxt_OnTextChanged(object sender, TextChangedEventArgs e)
+        {
+            CanContinue = FileNameTxt.Text.Length > 0 && PasswordBoxTxt.Password.Length > 0;
+        }
+
+        protected void UpdateProper<T>(ref T properValue,
+            T newValue,
+            [CallerMemberName] string properName = "")
+        {
+            if (object.Equals(properValue, newValue))
+                return;
+
+            properValue = newValue;
+            OnPropertyChanged(properName);
+        }
+
+        protected void OnPropertyChanged([CallerMemberName] string propertyName = "") =>
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+    }
+}

+ 56 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/SaveCerficateControl.xaml

@@ -0,0 +1,56 @@
+<UserControl x:Class="Compdfkit_Tools.PDFControl.SaveCerficateControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
+             xmlns:common="clr-namespace:Compdfkit_Tools.Common"
+             mc:Ignorable="d"
+             Height="310" Width="550">
+    <UserControl.Resources>
+        <common:TextLengthToVisibilityConverter x:Key="TextLengthToVisibilityConverter"></common:TextLengthToVisibilityConverter>
+    </UserControl.Resources>
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="auto"></RowDefinition>
+            <RowDefinition Height="auto"></RowDefinition>
+            <RowDefinition Height="auto"></RowDefinition>
+            <RowDefinition Height="auto"></RowDefinition>
+            <RowDefinition Height="auto"></RowDefinition>
+            <RowDefinition></RowDefinition>
+        </Grid.RowDefinitions>
+        <TextBlock TextWrapping="Wrap" FontSize="14" Foreground="#000000" Margin="10,20,10,20" Height="40"
+                   Text="Save the Self-Signed Digital ID to A File">
+        </TextBlock>
+        <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="10,0,0,8">
+            <TextBlock Text="Save Location" Foreground="#43474D" FontSize="14" VerticalAlignment="Center" Margin="10,0,10,0" HorizontalAlignment="Left" Width="135" FontFamily="Segoe UI"></TextBlock>
+            <Grid>
+                <TextBox Width="258" Height="28"  x:Name="FileNameText" VerticalContentAlignment="Center" VerticalAlignment="Center" IsReadOnly="True" Text="{Binding FilePath, Mode =TwoWay}"/>
+                <TextBlock Text="Select a file" Margin="8" VerticalAlignment="Center"   Visibility="{Binding ElementName=FileNameText, Path=Text, Converter={StaticResource TextLengthToVisibilityConverter}}" IsHitTestVisible="False"  Foreground="#BBB"></TextBlock>
+            </Grid>
+            <Button x:Name="SelectFileBtn" Content="Browse" Width="90" Height="28" FontSize="14" FontFamily="Segoe UI" Margin="8,0,0,0" Click="SelectFileBtn_Click"></Button>
+        </StackPanel>
+        <StackPanel Grid.Row="2" Orientation="Horizontal"  Margin="10,0,0,8">
+            <TextBlock Foreground="#43474D" Width="135" FontSize="14" FontFamily="Segoe UI" Text="Set A Password" VerticalAlignment="Top" Margin="10,5,10,0"></TextBlock>
+            <Grid>
+                <PasswordBox Name="SetPasswordPbx" Padding="5,0,0,0" Width="258" Height="28" VerticalContentAlignment="Center" VerticalAlignment="Center" PasswordChanged="SetPasswordPbx_OnPasswordChanged"></PasswordBox>
+                <TextBlock x:Name="PasswordTextBlock" Text="Please enter your password" Margin="8" VerticalAlignment="Center" IsHitTestVisible="False" Foreground="#BBB"></TextBlock>
+            </Grid>
+
+        </StackPanel>
+        <StackPanel Grid.Row="3" Orientation="Horizontal"  Margin="10,0,0,8">
+            <TextBlock Foreground="#43474D" Width="135" FontSize="14" FontFamily="Segoe UI" Text="Confirm the Password" VerticalAlignment="Top" Margin="10,5,10,0"></TextBlock>
+            <Grid>
+                <PasswordBox Name="ConfirmPasswordPbx" Padding="5,0,0,0" Width="258" Height="28"  VerticalContentAlignment="Center" VerticalAlignment="Center" PasswordChanged="ConfirmPasswordPbx_OnPasswordChanged"></PasswordBox>
+                <TextBlock x:Name="ConfirmPasswordTextBlock" Text="Enter the password again" Margin="8" VerticalAlignment="Center" IsHitTestVisible="False" Foreground="#BBB"></TextBlock>
+            </Grid>
+        </StackPanel>
+        <TextBlock Name="ErrorTipsText" Foreground="Red" Margin="167,4,0,0" Grid.Row="4"></TextBlock>
+        <Grid Grid.Row="5">
+            <StackPanel  Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="24">
+                <Button x:Name="CancelBtn" Content="Cancel"  Margin="0,0,10,0" Width="112" Height="32" BorderThickness="1" Click="CancelBtn_Click"></Button>
+                <Button x:Name="DoneBtn" Content="Finish" Width="112" Height="32" BorderThickness="1" Click="DoneBtn_Click"></Button>
+            </StackPanel>
+        </Grid>
+    </Grid>
+</UserControl>

+ 149 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/SaveCerficateControl.xaml.cs

@@ -0,0 +1,149 @@
+using ComPDFKit.DigitalSign;
+using Compdfkit_Tools.Helper;
+using System;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Security; 
+using System.Windows;
+using System.Windows.Controls;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    /// <summary>
+    /// Interaction logic for SaveCertificateControlControl.xaml
+    /// </summary>
+    public partial class SaveCerficateControl : UserControl, INotifyPropertyChanged
+    {
+        public CertificateInfo CertificateInfo;
+        
+        public event EventHandler CancelSaveEvent; 
+
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        public event EventHandler<CertificateAccess> FillSignatureEvent;
+
+        private string _filePath;
+        public string FilePath
+        {
+            get => _filePath;
+            set => UpdateProper(ref _filePath, value);
+        }
+
+        public SaveCerficateControl()
+        {
+            InitializeComponent();
+            this.DataContext = this;
+        }
+
+        private void SelectFileBtn_Click(object sender, RoutedEventArgs e)
+        {
+            string filePath = CommonHelper.GetGeneratePathOrEmpty("PFX Files(*.pfx) | *.pfx|P12 Files(*.p12) | *.p12");
+            if (filePath != string.Empty)
+            {
+                FilePath = filePath;
+            } 
+        }
+         
+        private void DoneBtn_Click(object sender, RoutedEventArgs e)
+        {
+            if(string.IsNullOrEmpty(FilePath))
+            {
+                ErrorTipsText.Text = "Please select a file path";
+                return;
+            }
+
+            if (string.IsNullOrEmpty(SetPasswordPbx.Password))
+            {
+                ErrorTipsText.Text = "Please enter a password";
+                return;
+            }
+
+            if (SetPasswordPbx.Password == ConfirmPasswordPbx.Password)
+            {
+                CertificateInfo.Password = SetPasswordPbx.Password;
+            }
+            else
+            {
+                ErrorTipsText.Text = "Password and confirm password does not match";
+                return;
+            }
+
+            string certificateInfo = "/";
+            certificateInfo += "C=" + CertificateInfo.Area;
+            if (CertificateInfo.OrganizationUnit != string.Empty)
+            {
+                certificateInfo += "/OU=" + CertificateInfo.OrganizationUnit;
+            }
+            if (CertificateInfo.Organization != string.Empty)
+            {
+                certificateInfo += "/O=" + CertificateInfo.Organization;
+            }
+            if (CertificateInfo.OrganizationUnit != string.Empty)
+            {
+                certificateInfo += "/D=" + CertificateInfo.OrganizationUnit;
+            }
+            certificateInfo += "/CN=" + CertificateInfo.GrantorName;
+            certificateInfo += "/emailAddress=" + CertificateInfo.Email;
+            bool is_2048 = CertificateInfo.AlgorithmType == AlgorithmType.RSA2048bit;
+            if(CPDFPKCS12CertHelper.GeneratePKCS12Cert(certificateInfo, CertificateInfo.Password, FilePath, CertificateInfo.PurposeType, is_2048))
+            {
+                CertificateAccess certificateAccess = new CertificateAccess()
+                {
+                    filePath = FilePath,
+                    password = CertificateInfo.Password
+                };
+                FillSignatureEvent?.Invoke(sender, certificateAccess);
+            } 
+        }
+        
+        
+        private void CancelBtn_Click(object sender, RoutedEventArgs e)
+        {
+            CancelSaveEvent?.Invoke(this, EventArgs.Empty);
+        }
+
+        protected void UpdateProper<T>(ref T properValue,
+                      T newValue,
+                      [CallerMemberName] string properName = "")
+        {
+            if (object.Equals(properValue, newValue))
+                return;
+
+            properValue = newValue;
+            OnPropertyChanged(properName);
+        }
+         
+        protected void OnPropertyChanged([CallerMemberName] string propertyName = "") =>
+    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+
+        private void SetPasswordPbx_OnPasswordChanged(object sender, RoutedEventArgs e)
+        {
+            PasswordBox passwordBox = (PasswordBox)sender;
+            TextBlock textBlock = PasswordTextBlock;
+
+            if (passwordBox.Password.Length > 0)
+            {
+                textBlock.Visibility = Visibility.Hidden;
+            }
+            else
+            {
+                textBlock.Visibility = Visibility.Visible;
+            }
+        }
+
+        private void ConfirmPasswordPbx_OnPasswordChanged(object sender, RoutedEventArgs e)
+        {
+            PasswordBox passwordBox = (PasswordBox)sender;
+            TextBlock textBlock = ConfirmPasswordTextBlock;
+
+            if (passwordBox.Password.Length > 0)
+            {
+                textBlock.Visibility = Visibility.Hidden;
+            }
+            else
+            {
+                textBlock.Visibility = Visibility.Visible;
+            }
+        }
+    }
+}

File diff suppressed because it is too large
+ 78 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/CPDFSignatureListControl/CPDFSignatureListControl.xaml


+ 226 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/CPDFSignatureListControl/CPDFSignatureListControl.xaml.cs

@@ -0,0 +1,226 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Input;
+using Compdfkit_Tools.Helper;
+using Compdfkit_Tools.PDFControl;
+using Compdfkit_Tools.PDFControlUI;
+using ComPDFKit.DigitalSign;
+using ComPDFKit.Import;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKit.PDFAnnotation.Form;
+using ComPDFKitViewer.PdfViewer;
+using ContextMenu = System.Windows.Controls.ContextMenu;
+using MenuItem = System.Windows.Controls.MenuItem;
+using MessageBox = System.Windows.MessageBox;
+using UserControl = System.Windows.Controls.UserControl;
+
+namespace Compdfkit_Tools.DigitalSignature.CPDFSignatureListControl
+{
+    public class SignatureData
+    {
+        public SignatureStatus Status { get; set; }
+        public string Signer { get; set; }
+    }
+    
+    public partial class CPDFSignatureListControl : UserControl
+    {
+        private CPDFViewer pdfViewer;
+        private List<SignatureData> signatureDataList;
+        private List<CPDFSignature> signatureList;
+        private ContextMenu popContextMenu;
+        
+        public event EventHandler<CPDFSignature> ViewCertificateEvent;
+        public event EventHandler<CPDFSignature> ViewSignatureEvent;
+        public event EventHandler DeleteSignatureEvent;
+        public CPDFSignatureListControl()
+        {
+            InitializeComponent();
+            DataContext = this;
+            popContextMenu = new ContextMenu();
+            MenuItem viewSignatureDetailsMenu = new MenuItem();
+            viewSignatureDetailsMenu.Header = "Signature Details";
+            viewSignatureDetailsMenu.Click += ViewSignatureDetailsMenu_Click;
+            popContextMenu.Items.Add(viewSignatureDetailsMenu);
+            
+            MenuItem viewCertificateDetailsMenu = new MenuItem();
+            viewCertificateDetailsMenu.Header = "Certificate Details";
+            viewCertificateDetailsMenu.Click += ViewCertificateDetailsMenu_Click;
+            popContextMenu.Items.Add(viewCertificateDetailsMenu);
+            
+            MenuItem deleteMenu = new MenuItem();
+            deleteMenu.Header = "Delete";
+            deleteMenu.Click += DeleteMenu_Click;
+            popContextMenu.Items.Add(deleteMenu);
+        }
+        
+        private void ViewSignatureDetailsMenu_Click(object sender, RoutedEventArgs e)
+        {
+            int index = SignatureList.SelectedIndex;
+            if (index >= 0 && index < signatureList.Count)
+            {
+                ViewSignatureEvent?.Invoke(this, signatureList[index]);
+            }
+        }
+        
+        private void DeleteMenu_Click(object sender, RoutedEventArgs e)
+        {
+            // custom button content
+            string messageBoxText = "Are you sure to delete it?";
+            string caption = "Delete Signature";
+            MessageBoxButton button = MessageBoxButton.OKCancel;
+            MessageBoxImage icon = MessageBoxImage.Warning;
+            MessageBoxResult result = MessageBox.Show(messageBoxText, caption, button, icon, MessageBoxResult.Cancel);
+            if(result != MessageBoxResult.OK)
+            {
+                return;
+            }
+            int index = SignatureList.SelectedIndex;
+            if (index >= 0 && index < signatureList.Count)
+            {
+                var widget = signatureList[index].GetSignatureWidget(pdfViewer.Document);
+                pdfViewer.Document.RemoveSignature(signatureList[index], true);
+                widget.ResetForm();
+                widget.SetIsLocked(false);
+                pdfViewer.ReloadVisibleAnnots();
+                DeleteSignatureEvent?.Invoke(this, null);
+            }
+        }
+        
+        private void ViewCertificateDetailsMenu_Click(object sender, RoutedEventArgs e)
+        {
+            int index = SignatureList.SelectedIndex;
+            if (index >= 0 && index < signatureList.Count)
+            {
+                ViewCertificateEvent?.Invoke(this, signatureList[index]);
+            }
+        }
+
+        public void InitWithPDFViewer(CPDFViewer newPDFView)
+        {
+            pdfViewer = newPDFView;
+        }
+        
+        public void LoadSignatureList()
+        {
+            if (pdfViewer != null && pdfViewer.Document != null)
+            {
+                signatureList = SignatureHelper.SignatureList;
+                if (signatureList != null)
+                {
+                    SignatureList.ItemsSource = null;
+                    signatureDataList = new List<SignatureData>();
+                    foreach (CPDFSignature signature in signatureList)
+                    {
+                        var item = new SignatureData();
+                        CPDFSigner signer = signature.SignerList.First();
+                        bool isSignVerified = signer.IsSignVerified;
+                        bool isCertTrusted = signer.IsCertTrusted;
+                        bool notModified = signature.ModifyInfoList.Count == 0;
+                        if (isSignVerified && isCertTrusted && notModified)
+                        {
+                            item.Status = SignatureStatus.Valid;
+                        }
+                        else if (isSignVerified && !isCertTrusted && notModified)
+                        {
+                            item.Status = SignatureStatus.Unknown;
+                        }
+                        else
+                        {
+                            item.Status = SignatureStatus.Invalid;
+                        }
+                        
+                        item.Signer = signature.Name + "'s signature";
+                        signatureDataList.Add(item);
+                    }
+
+                    if (signatureList.Count > 0)
+                    {
+                        SignatureList.ContextMenu = popContextMenu;
+                    }
+                    SignatureList.ItemsSource = signatureDataList;
+                    SignatureList.Visibility = Visibility.Visible;
+                }
+                else
+                {
+                    SignatureList.Visibility = Visibility.Collapsed;
+                }
+            }
+        }
+
+        private void SignatureList_ContextMenuOpening(object sender, ContextMenuEventArgs e)
+        {
+            try
+            {
+                if (SignatureList != null && SignatureList.SelectedIndex == -1)
+                {
+                    foreach (var item in popContextMenu.Items)
+                    {
+
+                        (item as MenuItem).IsEnabled = false;
+                    }
+                }
+                else
+                {
+                    foreach (var item in popContextMenu.Items)
+                    {
+
+                        (item as MenuItem).IsEnabled = true;
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+
+            }
+        }
+
+        private void SignatureList_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            SignatureList.SelectedIndex = -1;
+        }
+        
+        private void SignatureList_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+        {
+            int index = SignatureList.SelectedIndex;
+            if (index >= 0 && index < signatureList.Count)
+            {
+                CRect rect = signatureList[index].GetPageBound(pdfViewer.Document);
+                Point point = new Point(rect.left, rect.top);
+                pdfViewer.GoToPage(signatureList[index].GetPageIndex(pdfViewer.Document),point);
+            }
+        }
+    }
+    
+    public class SignatureStatusToPathConverter : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (value is SignatureStatus signatureStatus && parameter is CPDFSignatureListControl cpdfSignatureListControl)
+            {
+                switch (signatureStatus)
+                {
+                    case SignatureStatus.Valid:
+                        return cpdfSignatureListControl.FindResource("ValidSignaturePath");
+                    case SignatureStatus.Invalid:
+                        return cpdfSignatureListControl.FindResource("InvalidSignaturePath");
+                    case SignatureStatus.Unknown:
+                        return cpdfSignatureListControl.FindResource("UnknownSignaturePath");
+                    default:
+                        return null;
+                }
+            }
+            return null;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            return null;
+        }
+    }
+
+}

+ 126 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/DigitalSignatureControl/DigitalSignatureControl.xaml

@@ -0,0 +1,126 @@
+<UserControl x:Class="Compdfkit_Tools.PDFControl.DigitalSignatureControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
+             xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common"
+             xmlns:cpdftools="clr-namespace:Compdfkit_Tools.PDFControl"
+             Loaded="UserControl_Loaded"
+             Unloaded="UserControl_Unloaded"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="../../Asset/Styles/ToggleButtonStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="../../Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="../../Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
+            </ResourceDictionary.MergedDictionaries>
+            <RoutedUICommand x:Key="Undo" Text="Undo"></RoutedUICommand>
+            <RoutedUICommand x:Key="Redo" Text="Redo"></RoutedUICommand>
+        </ResourceDictionary>
+    </UserControl.Resources>
+
+    <UserControl.InputBindings>
+        <KeyBinding Key="Z" Modifiers="Control" Command="{StaticResource Undo}"/>
+        <KeyBinding Key="Y" Modifiers="Control" Command="{StaticResource Redo}"/>
+    </UserControl.InputBindings>
+
+    <UserControl.CommandBindings>
+        <CommandBinding Command="{StaticResource Undo}" Executed="CommandBinding_Executed_Undo"/>
+        <CommandBinding Command="{StaticResource Redo}" Executed="CommandBinding_Executed_Redo"/>
+    </UserControl.CommandBindings>
+    <Grid x:Name="BodyGrid">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="auto"></RowDefinition>
+            <RowDefinition Height="auto"></RowDefinition>
+            <RowDefinition Height="*"></RowDefinition>
+        </Grid.RowDefinitions>
+
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="0"></ColumnDefinition>
+            <ColumnDefinition Width="0"></ColumnDefinition>
+            <ColumnDefinition Width="*"></ColumnDefinition>
+            <ColumnDefinition Width="auto"></ColumnDefinition>
+        </Grid.ColumnDefinitions>
+
+        <Border x:Name="ToolBarContainer" Height="45" Visibility="Visible" BorderThickness="1" BorderBrush="#1A000000" Background="#F2F3F5" Grid.ColumnSpan="4">
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
+                <StackPanel Orientation="Horizontal">
+                    <cpdfcommon:CPDFDigitalSignatureBarControl x:Name="DigitalSignatureBarControl" Height="44"/>
+                    <Line Height="40" Stroke="#D5D6D8" StrokeThickness="2" X1="0" Y1="10" X2="0" Y2="30" Margin="8,0,8,0" />
+                    <Button Name="UndoBtn" Style="{StaticResource LightButtonStyle}" BorderThickness="0"  Width="40" Height="40" IsEnabled="{Binding CanUndo,Mode=OneWay}"  Click="UndoButton_Click"
+                                    Background="Transparent">
+                        <Path x:Name="UndoPath" IsEnabled="{Binding CanUndo,Mode=OneWay}">
+                            <Path.Style>
+                                <Style TargetType="Path">
+                                    <Style.Triggers>
+                                        <Trigger Property="IsEnabled" Value="False">
+                                            <Setter Property="Fill" Value="LightGray"/>
+                                        </Trigger>
+                                        <Trigger Property="IsEnabled" Value="True">
+                                            <Setter Property="Fill" Value="#43474D"/>
+                                        </Trigger>
+                                    </Style.Triggers>
+                                </Style>
+                            </Path.Style>
+                            <Path.Data>
+                                M1.03033 3.62131L0.5 4.15164L1.03033 4.68197L4.65164 8.30328L5.7123 7.24261L3.37132 4.90164H10.0607C11.5794 4.90164 12.8107 6.13285 12.8107 
+                                7.65164C12.8107 9.17042 11.5794 10.4016 10.0607 10.4016H2.56066V11.9016H10.0607C12.4079 11.9016 14.3107 9.99885 14.3107 7.65164C14.3107 
+                                5.30443 12.4079 3.40164 10.0607 3.40164H3.37132L5.7123 1.06066L4.65164 0L1.03033 3.62131Z
+                            </Path.Data>
+                        </Path>
+                        <Button.ToolTip>
+                            <ToolTip Content="Undo"></ToolTip>
+                        </Button.ToolTip>
+                    </Button>
+                    <Button Style="{StaticResource LightButtonStyle}" BorderThickness="0" Width="40" Height="40" Margin="10,0,0,0"  IsEnabled="{Binding CanRedo,Mode=OneWay}" Click="RedoButton_Click"
+                                    Background="Transparent">
+                        <Path IsEnabled="{Binding CanRedo,Mode=OneWay}">
+                            <Path.Resources>
+                                <Style TargetType="Path">
+                                    <Style.Triggers>
+                                        <Trigger Property="IsEnabled" Value="False">
+                                            <Setter Property="Fill" Value="LightGray"/>
+                                        </Trigger>
+                                        <Trigger Property="IsEnabled" Value="True">
+                                            <Setter Property="Fill" Value="#43474D"/>
+                                        </Trigger>
+                                    </Style.Triggers>
+                                </Style>
+                            </Path.Resources>
+                            <Path.Data>
+                                M13.7802 3.62131L14.3105 4.15164L13.7802 4.68197L10.1589 8.30328L9.09825 7.24261L11.4392 4.90164H4.74989C3.2311 4.90164 1.99989 6.13285 
+                                1.99989 7.65164C1.99989 9.17042 3.2311 10.4016 4.74989 10.4016H12.2499V11.9016H4.74989C2.40268 11.9016 0.499887 9.99885 0.499887 
+                                7.65164C0.499887 5.30443 2.40268 3.40164 4.74989 3.40164H11.4392L9.09825 1.06066L10.1589 0L13.7802 3.62131Z
+                            </Path.Data>
+                        </Path>
+                        <Button.ToolTip>
+                            <ToolTip Content="Redo"></ToolTip>
+                        </Button.ToolTip>
+                    </Button>
+                </StackPanel>
+            </StackPanel>
+        </Border>
+        <Border Grid.Column="2" Grid.Row="1" x:Name="SignatureStatusBorder" Visibility="Collapsed"></Border>
+        <Border Grid.Row="2" Visibility="Collapsed" Name="BotaContainer"></Border>
+        <GridSplitter Grid.Row="2" Name="Splitter" Grid.Column="1" Width="15" ResizeBehavior="PreviousAndNext" Visibility="Collapsed">
+            <GridSplitter.Template>
+                <ControlTemplate TargetType="{x:Type GridSplitter}">
+                    <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
+                        BorderBrush="{TemplateBinding Border.BorderBrush}"
+                        Background="{TemplateBinding Panel.Background}" >
+                        <Path Fill="Gray" VerticalAlignment="Center">
+                            <Path.Data>
+                                M15 3.75H1V2.25H15V3.75ZM15 8.75H1V7.25H15V8.75ZM1 13.75H15V12.25H1V13.75Z
+                            </Path.Data>
+                        </Path>
+                    </Border>
+                </ControlTemplate>
+            </GridSplitter.Template>
+        </GridSplitter>
+        <Border x:Name="PDFGrid" Background="#CECECE" Grid.Row="2" Grid.Column="2"></Border>
+        <Border x:Name="PropertyContainer" Grid.Column="3" Grid.Row="2" Visibility="Collapsed"></Border>
+        <cpdfcommon:PageNumberControl x:Name="FloatPageTool" Grid.Column="2" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,20"></cpdfcommon:PageNumberControl>
+    </Grid>
+</UserControl>

+ 672 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/DigitalSignatureControl/DigitalSignatureControl.xaml.cs

@@ -0,0 +1,672 @@
+using Compdfkit_Tools.PDFControl;
+using ComPDFKitViewer.AnnotEvent;
+using ComPDFKitViewer.PdfViewer;
+using System;
+using System.ComponentModel;
+using System.Dynamic;
+using System.IO;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Input;
+using System.Windows.Media;
+using Compdfkit_Tools.Helper;
+using ComPDFKit.DigitalSign;
+using ComPDFKit.PDFAnnotation.Form;
+using ComPDFKitViewer;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    public partial class DigitalSignatureControl : UserControl, INotifyPropertyChanged
+    {
+        #region Properties
+        
+        private bool isFirstLoad = true;
+        public PDFViewControl PDFViewControl = new PDFViewControl();
+        private SignatureStatusBarControl signatureStatusBarControl;
+        private PanelState panelState = PanelState.GetInstance();
+        private CPDFDisplaySettingsControl displaySettingsControl = null;
+        private CPDFSignatureWidget currentSignatureWidget;
+        private double[] zoomLevelList = { 1f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
+        public event EventHandler<bool> OnCanSaveChanged;
+        public event EventHandler<string> AfterFillSignature;
+        public event EventHandler SignatureStatusChanged;
+        public event PropertyChangedEventHandler PropertyChanged;
+        protected void OnPropertyChanged([CallerMemberName] string name = null)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
+        }
+
+        /// <summary>
+        /// Whether the undo operation can be performed.
+        /// </summary>
+        public bool CanUndo
+        {
+            get
+            {
+                if (PDFViewControl != null && PDFViewControl.PDFView != null)
+                {
+                    return PDFViewControl.PDFView.UndoManager.CanUndo;
+                }
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// Whether the redo operation can be performed.
+        /// </summary>
+        public bool CanRedo
+        {
+            get
+            {
+                if (PDFViewControl != null && PDFViewControl.PDFView != null)
+                {
+                    return PDFViewControl.PDFView.UndoManager.CanRedo;
+                }
+
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// Whether the save operation can be performed.
+        /// </summary>
+        public bool CanSave
+        {
+            get
+            {
+                if (PDFViewControl != null && PDFViewControl.PDFView != null)
+                {
+                    return PDFViewControl.PDFView.UndoManager.CanSave;
+                }
+
+                return false;
+            }
+        }
+        #endregion
+        
+        /// <summary>
+        /// A digital signature control should be used in a window, and it should be initialized with a PDFViewer.
+        /// Certificates will be saved in the TrustedFolder.
+        /// </summary>
+        public DigitalSignatureControl()
+        {
+            InitializeComponent();
+            DataContext = this;
+            string trustedFolder = AppDomain.CurrentDomain.BaseDirectory + @"\TrustedFolder\";
+            if (!Directory.Exists(trustedFolder))
+            {
+                Directory.CreateDirectory(trustedFolder);
+            }
+            CPDFSignature.SignCertTrustedFolder = trustedFolder;
+        }
+
+        #region Public Method
+        
+        /// <summary>
+        /// Disconnect all the specified elements that are already the logical children of another element. And reset bar control status.
+        /// </summary>
+        public void ClearViewerControl()
+        {
+            PDFGrid.Child = null;
+            BotaContainer.Child = null;
+            PropertyContainer.Child = null;
+            displaySettingsControl = null;
+            SignatureStatusBorder.Child = null;
+            DigitalSignatureBarControl.ClearAllToolState();
+        }
+
+        /// <summary>
+        /// Init controls with pdfViewer, and load events.
+        /// </summary>
+        /// <param name="pdfViewer"></param>
+        public void InitWithPDFViewer(CPDFViewer pdfViewer)
+        {
+            PDFViewControl.PDFView = pdfViewer;
+            PDFGrid.Child = PDFViewControl;
+            FloatPageTool.InitWithPDFViewer(pdfViewer);
+            
+            PDFViewControl.PDFView.SetMouseMode(MouseModes.Viewer);
+            PDFViewControl.PDFView.SetShowLink(true);
+            PDFViewControl.PDFView.SetFormFieldHighlight(true);
+            PDFViewControl.PDFView.UndoManager.ClearHistory();
+            
+            DigitalSignatureBarControl.DigitalSignatureActionChanged -= DigitalSignatureBarControl_DigitalSignatureActionChanged;
+            DigitalSignatureBarControl.DigitalSignatureActionChanged += DigitalSignatureBarControl_DigitalSignatureActionChanged;
+            
+            PDFViewControl.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
+            PDFViewControl.PDFView.WidgetClickHandler += PDFView_WidgetClickHandler;
+            PDFViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
+            PDFViewControl.PDFView.AnnotCommandHandler += PDFView_AnnotCommandHandler;
+            
+            panelState.PropertyChanged -= PanelState_PropertyChanged;
+            panelState.PropertyChanged += PanelState_PropertyChanged;
+        }
+        
+        /// <summary>
+        /// Separately, init PDFView and load undo manager event. Only use for ensuring SaveBtn is enabled after deleting digital signature on Viewer mode.
+        /// </summary>
+        /// <param name="pdfViewer"></param>
+        public void LoadUndoManagerEvent(CPDFViewer pdfViewer)
+        {
+            PDFViewControl.PDFView = pdfViewer;
+            PDFViewControl.PDFView.UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
+            PDFViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
+        }
+
+        /// <summary>
+        /// Set child for BOTAContainer with BOTABarControl.
+        /// </summary>
+        /// <param name="botaControl"></param>
+        public void SetBOTAContainer(CPDFBOTABarControl botaControl)
+        {
+            BotaContainer.Child = botaControl;
+        }
+
+        /// <summary>
+        /// Create a certificate info dialog with signature.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e">Signature to init certificate</param>
+        public void ViewCertificateEvent(object sender, CPDFSignature e)
+        {
+            Window parentWindow = Window.GetWindow((DependencyObject)sender);
+            ViewCertificateDialog dialog = new ViewCertificateDialog()
+            {
+                Owner = parentWindow
+            };
+            dialog.InitCertificateList(e);
+            dialog.CertificateInfoControl.TrustCertificateEvent += (o, args) =>
+            {
+                SignatureStatusChanged?.Invoke(this, null);
+            };
+
+            if (parentWindow is VerifyDigitalSignatureControl verifyControl)
+            {
+                dialog.CertificateInfoControl.TrustCertificateEvent += (o, args) =>
+                {
+                    verifyControl.InitWithSignature(e);
+                };
+            }
+            dialog.ShowDialog();
+        }
+
+        /// <summary>
+        /// Set display settings control.
+        /// </summary>
+        /// <param name="displaySettingsControl"></param>
+        public void SetDisplaySettingsControl(CPDFDisplaySettingsControl displaySettingsControl)
+        {
+            this.displaySettingsControl = displaySettingsControl;
+        }
+
+        /// <summary>
+        /// Set visibility of SignatureStatusBarControl according its status.
+        /// </summary>
+        /// <param name="signatureStatusBarControl"></param>
+        public void SetSignatureStatusBarControl(SignatureStatusBarControl signatureStatusBarControl)
+        {
+            this.signatureStatusBarControl = signatureStatusBarControl;
+            SignatureStatusBorder.Child = this.signatureStatusBarControl;
+            if (signatureStatusBarControl.Status != SignatureStatus.None)
+            {
+                SignatureStatusBorder.Visibility = Visibility.Visible;
+            }
+            else
+            {
+                SignatureStatusBorder.Visibility = Visibility.Collapsed;
+            }
+        }
+        
+        /// <summary>
+        /// Create a signature info dialog with signature.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e">Signature to be displayed</param>
+        public void ViewSignatureEvent(object sender, CPDFSignature e)
+        {
+            Window parentWindow = Window.GetWindow((DependencyObject)sender);
+            VerifyDigitalSignatureControl dialog = new VerifyDigitalSignatureControl()
+            {
+                Owner = parentWindow
+            };
+            dialog.ViewCertificateEvent -= ViewCertificateEvent;
+            dialog.ViewCertificateEvent += ViewCertificateEvent;
+            dialog.InitWithSignature(e);
+            dialog.ShowDialog();
+        }
+        
+        #endregion
+
+        #region Private Method
+
+        /// <summary>
+        /// Get current time as a string.
+        /// </summary>
+        /// <returns></returns>
+        private string GetTime()
+        {
+            DateTime dateTime = DateTime.Now;
+            return " " + dateTime.ToString("yyyy-MM-dd HH:mm:ss.fff");
+        }
+
+        /// <summary>
+        /// Create a signature field.
+        /// </summary>
+        private void CreateSign()
+        {
+            PDFViewControl.PDFView.SetMouseMode(MouseModes.FormEditTool);
+            WidgetSignArgs signArgs = new WidgetSignArgs
+            {
+                LineWidth = 1,
+                LineColor = Colors.Black,
+                FieldName = "Signature" + GetTime()
+            };
+            PDFViewControl.PDFView.SetToolParam(signArgs);
+        }
+        
+        /// <summary>
+        /// Expand or collapse left panel.
+        /// </summary>
+        /// <param name="isExpand"></param>
+        private void ExpandLeftPanel(bool isExpand)
+        {
+            BotaContainer.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
+            Splitter.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
+            if (isExpand)
+            {
+                BodyGrid.ColumnDefinitions[0].Width = new GridLength(320);
+                BodyGrid.ColumnDefinitions[1].Width = new GridLength(15);
+            }
+            else
+            {
+                BodyGrid.ColumnDefinitions[0].Width = new GridLength(0);
+                BodyGrid.ColumnDefinitions[1].Width = new GridLength(0);
+            }
+        }
+
+        /// <summary>
+        /// Expand or collapse right panel.
+        /// </summary>
+        /// <param name="propertytPanel"></param>
+        /// <param name="visible"></param>
+        private void ExpandRightPropertyPanel(UIElement propertytPanel, Visibility visible)
+        {
+            PropertyContainer.Width = 260;
+            PropertyContainer.Child = propertytPanel;
+            PropertyContainer.Visibility = visible;
+        }
+
+        #endregion
+
+        #region Private Command Event
+        
+        /// <summary>
+        /// Click event of signature field.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void PDFView_WidgetClickHandler(object sender, WidgetArgs e)
+        {
+            var signatureWidget = (e as WidgetSignArgs).Sign;
+            CPDFSignature sig = signatureWidget.GetSignature(PDFViewControl.PDFView.Document);
+            if (signatureWidget.IsSigned() && sig!=null && sig?.SignerList.Count > 0)
+            {
+                ViewSignatureEvent(sender, sig);
+            }
+            else
+            {
+                Window parentWindow = Window.GetWindow((DependencyObject)sender);
+                AddCertificationDialog addCertificationControl = new AddCertificationDialog
+                {
+                    Owner = parentWindow
+                };
+                currentSignatureWidget = signatureWidget;
+                addCertificationControl.FillSignatureEvent -= AddCertificationControl_FillSignatureEvent;
+                addCertificationControl.FillSignatureEvent += AddCertificationControl_FillSignatureEvent;
+                addCertificationControl.ShowDialog(); 
+            }
+        }
+
+        /// <summary>
+        /// Event of filling a signature.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void AddCertificationControl_FillSignatureEvent(object sender, CertificateAccess e)
+        {
+            FillDigitalSignatureDialog fillDigitalSignatureDialog = new FillDigitalSignatureDialog
+            {
+                FilePath = e.filePath,
+                Password = e.password,
+                SignatureWidget = currentSignatureWidget,
+                Document = PDFViewControl.PDFView.Document,
+                Owner = Window.GetWindow(this)
+            };
+            fillDigitalSignatureDialog.AfterFillSignature += FillDigitalSignatureDialog_AfterFillSignature; ;
+            fillDigitalSignatureDialog.ShowDialog();
+        }
+
+        /// <summary>
+        /// Event of after filling a signature.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void FillDigitalSignatureDialog_AfterFillSignature(object sender, string e)
+        {
+            AfterFillSignature?.Invoke(this, e);
+        }
+
+        /// <summary>
+        /// Click event of buttons in digital SignatureBarControl.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void DigitalSignatureBarControl_DigitalSignatureActionChanged(object sender, Common.CPDFDigitalSignatureBarControl.DigitalSignatureAction e)
+        {
+            if (e == Common.CPDFDigitalSignatureBarControl.DigitalSignatureAction.AddSignatureField)
+            {
+                CreateSign();
+            }
+            else if (e == Common.CPDFDigitalSignatureBarControl.DigitalSignatureAction.Signing)
+            {
+                PDFViewControl.PDFView.SetMouseMode(MouseModes.Viewer);
+            }
+            else if (e == Common.CPDFDigitalSignatureBarControl.DigitalSignatureAction.VerifySignature)
+            {
+                ToggleButton button = sender as ToggleButton;
+                button.IsChecked = false;
+                SignatureStatusChanged?.Invoke(this, null);
+            }
+        }
+
+        /// <summary>
+        /// Property changed event of PanelState.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void PanelState_PropertyChanged(object sender, PropertyChangedEventArgs e)
+        {
+            if (e.PropertyName == nameof(PanelState.IsLeftPanelExpand))
+            {
+                ExpandLeftPanel(panelState.IsLeftPanelExpand);
+            }
+            else if (e.PropertyName == nameof(PanelState.RightPanel))
+            {
+                if (panelState.RightPanel == PanelState.RightPanelState.ViewSettings)
+                {
+                    ExpandRightPropertyPanel(displaySettingsControl, Visibility.Visible);
+                }
+                else
+                {
+                    ExpandRightPropertyPanel(null, Visibility.Collapsed);
+
+                }
+            }
+        }
+
+        /// <summary>
+        /// Event of UndoManager property changed.
+        /// </summary>
+        private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
+        {
+            OnPropertyChanged(e.PropertyName);
+            if (e.PropertyName == "CanSave")
+            {
+                OnCanSaveChanged?.Invoke(this, CanSave);
+            }
+        }
+
+        /// <summary>
+        /// Command event of undo operation.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void CommandBinding_Executed_Undo(object sender, ExecutedRoutedEventArgs e)
+        {
+            if (PDFViewControl != null && PDFViewControl.PDFView != null && CanUndo)
+            {
+                PDFViewControl.PDFView.UndoManager?.Undo();
+            }
+        }
+
+        /// <summary>
+        /// Command event of redo operation.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void CommandBinding_Executed_Redo(object sender, ExecutedRoutedEventArgs e)
+        {
+            if (PDFViewControl != null && PDFViewControl.PDFView != null && CanUndo)
+            {
+                PDFViewControl.PDFView.UndoManager?.Redo();
+            }
+        }
+
+        /// <summary>
+        /// Click event of undo button.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void UndoButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (PDFViewControl != null && PDFViewControl.PDFView != null && CanUndo)
+            {
+                PDFViewControl.PDFView.UndoManager?.Undo();
+            }
+        }
+
+        /// <summary>
+        /// Click event of redo button.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void RedoButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (PDFViewControl != null && PDFViewControl.PDFView != null && CanRedo)
+            {
+                PDFViewControl.PDFView.UndoManager?.Redo();
+            }
+        }
+        
+        #endregion
+
+        #region ContextMenu
+        
+        /// <summary>
+        /// Right click context menu
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void PDFView_AnnotCommandHandler(object sender, AnnotCommandArgs e)
+        {
+            if (e != null && e.CommandType == CommandType.Context)
+            {
+                if (e.CommandTarget == TargetType.WidgetView)
+                {
+                    e.Handle = true;
+                    e.PopupMenu = new ContextMenu();
+                    var sign = e.Sign.GetSignature(PDFViewControl.PDFView.Document);
+                    if (e.Sign.IsSigned() && sign != null && sign.SignerList.Any())
+                    {
+                        MenuItem DeleteMenu = new MenuItem()
+                            { Header = "Delete" };
+                        DeleteMenu.Click += (o, args) =>
+                        {
+                            PDFViewControl.PDFView.Document.RemoveSignature(sign, true);
+                            e.Sign.ResetForm();
+                            e.Sign.SetIsLocked(false);
+                            PDFViewControl.PDFView.ReloadVisibleAnnots();
+                            
+                            PDFViewControl.PDFView.UndoManager.CanSave = true;
+                            SignatureStatusChanged?.Invoke(this, null);
+                        };
+                        e.PopupMenu.Items.Add(DeleteMenu);
+                    }
+                    else
+                    {
+                        e.PopupMenu.Items.Add(new MenuItem()
+                            { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
+                        e.PopupMenu.Items.Add(new MenuItem()
+                            { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
+                        e.PopupMenu.Items.Add(new MenuItem()
+                            { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
+                    }
+                }
+                else
+                {
+                    e.Handle = true;
+                    e.PopupMenu = new ContextMenu();
+
+                    e.PopupMenu.Items.Add(new MenuItem()
+                        { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
+                    e.PopupMenu.Items.Add(new Separator());
+
+                    MenuItem fitWidthMenu = new MenuItem();
+                    fitWidthMenu.Header = "Automatically Resize";
+                    fitWidthMenu.Click += (o, p) =>
+                    {
+                        if (PDFViewControl != null)
+                        {
+                            PDFViewControl.PDFView?.ChangeFitMode(FitMode.FitWidth);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(fitWidthMenu);
+
+                    MenuItem fitSizeMenu = new MenuItem();
+                    fitSizeMenu.Header = "Actual Size";
+                    fitSizeMenu.Click += (o, p) =>
+                    {
+                        if (PDFViewControl != null)
+                        {
+                            PDFViewControl.PDFView?.ChangeFitMode(FitMode.FitSize);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(fitSizeMenu);
+
+                    MenuItem zoomInMenu = new MenuItem();
+                    zoomInMenu.Header = "Zoom In";
+                    zoomInMenu.Click += (o, p) =>
+                    {
+                        if (PDFViewControl != null)
+                        {
+                            double newZoom = CommandHelper.CheckZoomLevel(zoomLevelList,
+                                PDFViewControl.PDFView.ZoomFactor + 0.01, true);
+                            PDFViewControl.PDFView?.Zoom(newZoom);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(zoomInMenu);
+
+                    MenuItem zoomOutMenu = new MenuItem();
+                    zoomOutMenu.Header = "Zoom Out";
+                    zoomOutMenu.Click += (o, p) =>
+                    {
+                        if (PDFViewControl != null)
+                        {
+                            double newZoom = CommandHelper.CheckZoomLevel(zoomLevelList,
+                                PDFViewControl.PDFView.ZoomFactor - 0.01, false);
+                            PDFViewControl.PDFView?.Zoom(newZoom);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(zoomOutMenu);
+                    e.PopupMenu.Items.Add(new Separator());
+
+                    MenuItem singleView = new MenuItem();
+                    singleView.Header = "Single Page";
+                    singleView.Click += (o, p) =>
+                    {
+                        if (PDFViewControl != null)
+                        {
+                            PDFViewControl.PDFView?.ChangeViewMode(ViewMode.Single);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(singleView);
+
+                    MenuItem singleContinuousView = new MenuItem();
+                    singleContinuousView.Header = "Single Page Continuous";
+                    singleContinuousView.Click += (o, p) =>
+                    {
+                        if (PDFViewControl != null)
+                        {
+                            PDFViewControl.PDFView?.ChangeViewMode(ViewMode.SingleContinuous);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(singleContinuousView);
+
+                    MenuItem doubleView = new MenuItem();
+                    doubleView.Header = "Two Pages";
+                    doubleView.Click += (o, p) =>
+                    {
+                        if (PDFViewControl != null)
+                        {
+                            PDFViewControl.PDFView?.ChangeViewMode(ViewMode.Double);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(doubleView);
+
+                    MenuItem doubleContinuousView = new MenuItem();
+                    doubleContinuousView.Header = "Two Pages Continuous";
+                    doubleContinuousView.Click += (o, p) =>
+                    {
+                        if (PDFViewControl != null)
+                        {
+                            PDFViewControl.PDFView?.ChangeViewMode(ViewMode.DoubleContinuous);
+                        }
+                    };
+                    e.PopupMenu.Items.Add(doubleContinuousView);
+
+                    MenuItem resetFormMenu = new MenuItem();
+                    resetFormMenu.Header = "Reset Forms";
+                    resetFormMenu.Click += (o, p) =>
+                    {
+                        if (PDFViewControl != null)
+                        {
+                            PDFViewControl.PDFView?.ResetForm(null);
+                        }
+                    };
+                    e.PopupMenu.Items.Add(new Separator());
+                    e.PopupMenu.Items.Add(resetFormMenu);
+                }
+            }
+            else
+            {
+                e.DoCommand();
+            }
+        }
+        #endregion
+
+        #region Load Unload Event
+        
+        /// <summary>
+        /// Load event
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            
+        }
+         
+        /// <summary>
+        /// Unload event
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void UserControl_Unloaded(object sender, RoutedEventArgs e)
+        {
+            PDFViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
+            PDFViewControl.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
+        }
+        
+        #endregion
+    }
+}

+ 40 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/DigitalSignatureData/DigitalSignatureData.cs

@@ -0,0 +1,40 @@
+using ComPDFKit.DigitalSign;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    public enum CreateCertificationMode
+    {
+        AddExistedCertification,
+        AddCustomCertification,
+        SaveCertificate
+    }
+
+    public enum AlgorithmType
+    {
+        RSA1024bit,
+        RSA2048bit
+    }
+
+    public class CertificateInfo
+    {
+        public string GrantorName = string.Empty; 
+        public string Organization = string.Empty;
+        public string OrganizationUnit = string.Empty;
+        public string Email = string.Empty;
+        public string Area = string.Empty;
+        public string Password = string.Empty;
+        public AlgorithmType AlgorithmType;
+        public CPDFCertUsage PurposeType;
+    }
+    
+    public class CertificateAccess
+    {
+        public string filePath;
+        public string password; 
+    }
+}

+ 254 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/FillDigitalSignatureControl/FillDigitalSignatureControl.xaml

@@ -0,0 +1,254 @@
+<UserControl x:Class="Compdfkit_Tools.PDFControl.FillDigitalSignatureControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
+             xmlns:common="clr-namespace:Compdfkit_Tools.Common"
+             mc:Ignorable="d" 
+             d:DesignHeight="530" d:DesignWidth="630" 
+             >
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="../../Asset/Styles/ToggleButtonStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="../../Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="../../Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
+            </ResourceDictionary.MergedDictionaries>
+        </ResourceDictionary>
+    </UserControl.Resources>
+    <Grid>
+        <Grid Name="MainGrid" Background="White">
+            
+            <Grid.RowDefinitions>
+                <RowDefinition Height="auto"></RowDefinition>
+                <RowDefinition Height="auto"></RowDefinition>
+                <RowDefinition Height="30"></RowDefinition>
+                <RowDefinition Height="auto"></RowDefinition>
+                <RowDefinition Height="auto"></RowDefinition>
+                <RowDefinition Height="auto"></RowDefinition>
+            </Grid.RowDefinitions>
+            
+
+            <Grid Grid.Row="0" Width="314" HorizontalAlignment="Center" Margin="0,20,0,1">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="91"></ColumnDefinition>
+                    <ColumnDefinition Width="87"></ColumnDefinition>
+                    <ColumnDefinition Width="68"></ColumnDefinition>
+                    <ColumnDefinition Width="68"></ColumnDefinition>
+                </Grid.ColumnDefinitions>
+
+                <Grid>
+                    <Border Name="KeyboardBorder" Background="White" Padding="0,0,0,5" BorderBrush="#4982E6" Width="75"
+                      MouseDown="Border_MouseDown" Tag="Keyboard">
+                        <TextBlock FontSize="16">Keyboard</TextBlock>
+                    </Border>
+                </Grid>
+
+                <Grid Grid.Column="1">
+                    <Border Name="TrackpadBorder" Background="White" Padding="0,0,0,5" BorderBrush="#4982E6" Width="72"
+                      MouseDown="Border_MouseDown" Tag="Trackpad">
+                        <TextBlock FontSize="16">Trackpad</TextBlock>
+                    </Border>
+                </Grid>
+
+                <Grid Grid.Column="2">
+                    <Border Name="ImageBorder" Background="White" Padding="0,0,0,5" BorderBrush="#4982E6" Width="52"
+                      MouseDown="Border_MouseDown" Tag="Image">
+                        <TextBlock FontSize="16">Image</TextBlock>
+                    </Border>
+                </Grid>
+
+                <Grid Grid.Column="3">
+                    <Border Name="NoneBorder" Background="White" Padding="0,0,0,5" BorderBrush="#4982E6" Width="43"
+                      MouseDown="Border_MouseDown" Tag="None">
+                        <TextBlock FontSize="16">None</TextBlock>
+                    </Border>
+                </Grid>
+            </Grid>
+
+            <Canvas Grid.Row="1" Width="580" Height="187" Background="#F4F7FF">
+                <Image Width="580" Height="187" x:Name="imageControl" />
+            </Canvas>
+
+            <StackPanel Grid.Row="2" Name="ImagePickPanel" HorizontalAlignment="Right" Orientation="Horizontal" Margin="0,6,30,0"
+                        Visibility="Hidden">
+                <TextBlock x:Name="BrowseTxt" Foreground="Blue" MouseLeftButtonDown="BrowseTxt_MouseLeftButtonDown">Browse</TextBlock>
+                <TextBlock x:Name="ClearTxt" Margin="10,0,0,0" Foreground="Blue" MouseLeftButtonDown="ClearTxt_MouseLeftButtonDown">Clear</TextBlock>
+            </StackPanel>
+
+            <Grid Grid.Row="3" Margin="25,0,25,0">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="*"></ColumnDefinition>
+                    <ColumnDefinition Width="auto"></ColumnDefinition>
+                </Grid.ColumnDefinitions>
+                <TextBlock FontSize="14" Margin="0,3,0,0">Include Text</TextBlock>
+                <StackPanel Margin="00,0,20,0" Grid.Column="1" Orientation="Horizontal">
+                    <TextBlock FontSize="14" VerticalAlignment="Center" Margin="0,0,8,0">Alignment</TextBlock>
+                    <ToggleButton Name="TextAlignLeftBtn" Style="{StaticResource ToggleButtonStyle}" BorderThickness="0" Width="73" Height="30" 
+                            IsChecked="True" Click="TextAlignBtn_Click">
+                        <Path Fill="Black">
+                            <Path.Data>
+                                M13 4V3H0V4H13ZM16 8V7H0V8H16ZM10 11V12H0V11H10Z
+                            </Path.Data>
+                        </Path>
+                    </ToggleButton>
+                    <ToggleButton Name="TextAlignRightBtn" Style="{StaticResource ToggleButtonStyle}" BorderThickness="0" Width="73" Height="30"
+                            Click="TextAlignBtn_Click">
+                        <Path Fill="Black">
+                            <Path.Data>
+                                M16 4V3H3.00079V4H16ZM16 8V7H0.000976562V8H16ZM16 11V12H6.00061V11H16Z
+                            </Path.Data>
+                        </Path>
+                    </ToggleButton>
+                </StackPanel>
+            </Grid>
+
+            <Grid Grid.Row="4" Margin="25,10,0,0">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="auto"></ColumnDefinition>
+                    <ColumnDefinition Width="auto"></ColumnDefinition>
+                </Grid.ColumnDefinitions>
+                
+                <Grid HorizontalAlignment="Left">
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="32"></RowDefinition>
+                        <RowDefinition Height="32"></RowDefinition>
+                        <RowDefinition Height="32"></RowDefinition>
+                        <RowDefinition Height="32"></RowDefinition>
+                    </Grid.RowDefinitions>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="auto"></ColumnDefinition>
+                        <ColumnDefinition Width="50"></ColumnDefinition>
+                        <ColumnDefinition Width="auto"></ColumnDefinition>
+                        <ColumnDefinition Width="auto"></ColumnDefinition>
+                    </Grid.ColumnDefinitions>
+
+                    <CheckBox x:Name="NameChk" FontSize="14" Click="NameChk_Click">Name</CheckBox>
+                    <CheckBox x:Name="DateChk" FontSize="14" Grid.Row="1" Click="DateChk_Click">Date</CheckBox>
+                    <CheckBox x:Name="LogoChk" FontSize="14" Grid.Row="2" Click="LogoChk_Click">Logo</CheckBox>
+                    <CheckBox x:Name="ReasonChk" FontSize="14" Grid.Row="3" Click="ReasonChk_Click">Reason</CheckBox>
+
+                    <CheckBox x:Name="DistinguishableNameChk" FontSize="14" Grid.Column="2" Click="DistinguishableNameChk_Click">Distinguishable Name</CheckBox>
+                    <CheckBox x:Name="ComPDFKitVersionChk" FontSize="14" Grid.Column="2" Grid.Row="1" Click="ComPDFKitVersionChk_Click">ComPDFKit Versions</CheckBox>
+                    <CheckBox x:Name="PositionChk" FontSize="14" Grid.Column="2" Grid.Row="2" Click="PositionChk_Click">Position</CheckBox>
+                    <CheckBox x:Name="TabChk" FontSize="14" Grid.Column="2" Grid.Row="3" Click="TabChk_Click">Tab</CheckBox>
+
+                    <StackPanel x:Name="Reasonstp" Visibility="Collapsed" Orientation="Horizontal" Grid.Column="4" Margin="30,0,0,0" Grid.RowSpan="2" Height="30" Width="280">
+                        <TextBlock Text="Reason: " VerticalAlignment="Center" Width="50"></TextBlock>
+                        <ComboBox x:Name="ReasonCmb"  SelectionChanged="ReasonCmb_SelectionChanged" Width="220" VerticalContentAlignment="Center">
+                            <ComboBoxItem Content="&lt; None &gt;"></ComboBoxItem>
+                            <ComboBoxItem Content="I am the owner of the document." IsSelected="True"></ComboBoxItem>
+                            <ComboBoxItem Content="I am approving the document."></ComboBoxItem>
+                            <ComboBoxItem Content="I have reviewed this document"></ComboBoxItem>
+                        </ComboBox>
+                    </StackPanel>
+                    <StackPanel x:Name="PositionStp" Visibility="Collapsed" Orientation="Horizontal" Grid.Column="4" Grid.Row="1" Margin="30,10,0,0"  Grid.RowSpan="2" Height="30" Width="280">
+                        <TextBlock Text="Position: " VerticalAlignment="Center" Width="50"></TextBlock>
+                        <TextBox Width="220" x:Name="PositionTbx" TextChanged="PositionTbx_TextChanged"></TextBox>
+                    </StackPanel>
+                </Grid>
+
+                <StackPanel Name="ReasonPanel" Grid.Column="1" Orientation="Horizontal" Margin="15,10,0,0" VerticalAlignment="Top"
+                            Visibility="Collapsed">
+                    <TextBlock VerticalAlignment="Center" Margin="0,0,5,0">Reason</TextBlock> 
+                </StackPanel>
+
+            </Grid>
+
+            <Grid Grid.Row="5" Margin="25,10,0,0">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="auto"></ColumnDefinition>
+                    <ColumnDefinition Width="auto"></ColumnDefinition>
+                    <ColumnDefinition Width="*"></ColumnDefinition>
+                    <ColumnDefinition Width="auto"></ColumnDefinition>
+                    <ColumnDefinition Width="auto"></ColumnDefinition>
+                </Grid.ColumnDefinitions>
+
+                <Button x:Name="CancelBtn" Grid.Column="3" Height="32" Width="82" Style="{StaticResource LightButtonStyle}"
+                        Background="#DFE9FF" BorderThickness="0" Click="CancelBtn_Click">Cancel</Button>
+                <Button x:Name="ContinueBtn" Grid.Column="4" Margin="10,0,25,0" Height="32" Width="97" Style="{StaticResource ButtonStyle}" Click="ContinueBtn_Click">Next</Button>
+            </Grid>
+        </Grid>
+        
+        <Border Name="KeyboardPopup" Background="#A0000000" Visibility="Collapsed">
+            <Grid Background="White" Width="528" Height="412">
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="auto" />
+                        <RowDefinition Height="*" />
+                        <RowDefinition Height="auto" />
+                        <RowDefinition Height="auto" />
+                    </Grid.RowDefinitions>
+                <Button HorizontalAlignment="Right" Margin="0,8,10,0" Style="{StaticResource LightButtonStyle}" BorderThickness="0"
+                        Background="White" Width="24" Height="24" Click="KeyboardPopupClose_Click">
+                    <Button.Content>
+                        <Path Fill="#43474D" Width="16" Height="16">
+                            <Path.Data>
+                                M12.6466 13.2531L13.0001 13.6066L13.7072 12.8995L13.3537 12.546L8.7072 7.8995L13.2532 3.35352L13.6067 2.99997L12.8996 
+                                2.29286L12.5461 2.64642L8.00009 7.19239L3.45418 2.64648L3.10063 2.29292L2.39352 3.00003L2.74708 3.35358L7.29299 
+                                7.8995L2.64657 12.5459L2.29302 12.8995L3.00013 13.6066L3.35368 13.253L8.0001 8.6066L12.6466 13.2531Z
+                            </Path.Data>
+                        </Path>
+                    </Button.Content>
+                </Button>
+                    <TextBox     
+                    x:Name="KeyboardInPutTextBox" Grid.Row="1" BorderThickness="0" Background="#F2F3F5" Margin="10,0,10,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="45"/>
+                    <StackPanel Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal" Margin="0,10,20,10">
+                        <common:ColorPickerControl x:Name="TextColorPickerControl" Loaded="TextColorPickerControl_Loaded" ColorChanged="TextColorPickerControl_ColorChanged" TransparentBtnProperty="Collapsed"></common:ColorPickerControl>
+                    </StackPanel>
+                    <Grid Grid.Row="3" Margin="25,0,0,20" VerticalAlignment="Top">
+                        <Button Height="32" Width="82" Style="{StaticResource LightButtonStyle}" Background="#DFE9FF" 
+                                BorderThickness="0" HorizontalAlignment="Left" Content="Clear" Click="KeyboardClear_Click"/>
+                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
+                            <Button Height="32" Width="82" Style="{StaticResource LightButtonStyle}" Background="#DFE9FF" 
+                                    BorderThickness="0" Content="Cancel" Click="KeyboardCancel_Click"/>
+                            <Button x:Name="SaveBtn" Margin="10,0,25,0" Height="32" Width="97" Style="{StaticResource ButtonStyle}" Content="Save" Click="KeyboardSave_Click"/>
+                        </StackPanel>
+                    </Grid>
+                </Grid>
+        </Border>
+
+        <Border Name="CanvaDrawPopup" Background="#A0000000" Visibility="Collapsed">
+            <Grid Background="White" Width="528" Height="412">
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="auto"></RowDefinition>
+                    <RowDefinition Height="*"></RowDefinition>
+                    <RowDefinition Height="auto"></RowDefinition>
+                </Grid.RowDefinitions>
+
+                <Button HorizontalAlignment="Right" Margin="0,8,10,0" Style="{StaticResource LightButtonStyle}" BorderThickness="0"
+                        Background="White" Width="24" Height="24" Click="CanvasPopupClose_Click">
+                    <Button.Content>
+                        <Path Fill="#43474D" Width="16" Height="16">
+                            <Path.Data>
+                                M12.6466 13.2531L13.0001 13.6066L13.7072 12.8995L13.3537 12.546L8.7072 7.8995L13.2532 3.35352L13.6067 2.99997L12.8996 
+                                2.29286L12.5461 2.64642L8.00009 7.19239L3.45418 2.64648L3.10063 2.29292L2.39352 3.00003L2.74708 3.35358L7.29299 
+                                7.8995L2.64657 12.5459L2.29302 12.8995L3.00013 13.6066L3.35368 13.253L8.0001 8.6066L12.6466 13.2531Z
+                            </Path.Data>
+                        </Path>
+                    </Button.Content>
+                </Button>
+
+                <InkCanvas Name="DrawInkCanvas" Grid.Row="1" Width="580" Height="292" Background="#F2F3F5">
+
+                </InkCanvas>
+                <Grid Grid.Row="2" Margin="25,0,0,20">
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="auto"></ColumnDefinition>
+                        <ColumnDefinition Width="*"></ColumnDefinition>
+                        <ColumnDefinition Width="auto"></ColumnDefinition>
+                        <ColumnDefinition Width="auto"></ColumnDefinition>
+                    </Grid.ColumnDefinitions>
+
+                    <Button Height="32" Width="82" Style="{StaticResource LightButtonStyle}" Background="#DFE9FF" 
+                            BorderThickness="0" Click="CanvasClearBtn_Click">Clear</Button>
+
+                    <Button Grid.Column="2" Height="32" Width="82" Style="{StaticResource LightButtonStyle}" Background="#DFE9FF" 
+                            BorderThickness="0" Click="CanvasPopupClose_Click">Cancel</Button>
+                    <Button Grid.Column="3" Click="CanvasPopupConfirm_Click" Margin="10,0,25,0" Height="32" Width="97" Style="{StaticResource ButtonStyle}">OK</Button>
+
+                </Grid>
+            </Grid>
+        </Border>
+    </Grid>
+</UserControl>

+ 644 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/FillDigitalSignatureControl/FillDigitalSignatureControl.xaml.cs

@@ -0,0 +1,644 @@
+using ComPDFKit.DigitalSign;
+using ComPDFKit.Import;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKit.PDFAnnotation.Form;
+using ComPDFKit.PDFDocument;
+using ComPDFKit.PDFPage;
+using Compdfkit_Tools.Helper;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.IO;
+using System.Reflection;
+using System.Runtime.Remoting.Messaging;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Ink;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement;
+using Color = System.Drawing.Color;
+using Pen = System.Windows.Media.Pen;
+using PixelFormat = System.Windows.Media.PixelFormat;
+using Point = System.Windows.Point;
+using Window = System.Windows.Window;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    /// <summary>
+    /// Interaction logic for CPDFSignControl.xaml
+    /// </summary>
+    public partial class FillDigitalSignatureControl : UserControl
+    {
+
+        private readonly string logoPath = "Logo_opa40.png";
+        private string imagePath = string.Empty;
+        private string Text = string.Empty;
+        private Dictionary<string, Border> TabDict { get; set; }
+
+        private CPDFSignatureConfig tempSignatureConfig = new CPDFSignatureConfig();
+
+        private CPDFSignatureCertificate signatureCertificate;
+
+        public CPDFDocument Document;
+
+        private string signatureName = string.Empty;
+
+        private string location = string.Empty;
+
+        private string reason = string.Empty;
+
+        private float[] textColor = new float[] { 0, 0, 0 };
+
+        private string _signaturePath = string.Empty;
+        public string SignaturePath
+        {
+            get => _signaturePath;
+            set
+            {
+                _signaturePath = value;
+            }
+        }
+
+        private string _password = string.Empty;
+        public string Password
+        {
+            get => _password;
+            set
+            {
+                _password = value;
+                signatureCertificate = CPDFPKCS12CertHelper.GetCertificateWithPKCS12Path(SignaturePath, Password);
+                signatureName = DictionaryValueConverter.GetGrantorFromDictionary(signatureCertificate.SubjectDict);
+                tempSignatureConfig.Text = signatureName;
+                InitTempSignature();
+            }
+        }
+
+        private void InitTempSignature()
+        {
+            NameChk.IsChecked = true;
+            DateChk.IsChecked = true;
+            LogoChk.IsChecked = true;
+            TabChk.IsChecked = true;
+            SetProperty();
+            CreateTempSignature();
+            KeyboardInPutTextBox.Text = signatureName;
+        }
+
+        public CPDFSignatureWidget signatureWidget { get; set; }
+
+        public event EventHandler<string> AfterFillSignature;
+
+        public FillDigitalSignatureControl()
+        {
+            InitializeComponent();
+            TabDict = new Dictionary<string, Border>
+            {
+                ["Keyboard"] = KeyboardBorder,
+                ["Trackpad"] = TrackpadBorder,
+                ["Image"] = ImageBorder,
+                ["None"] = NoneBorder
+            };
+            SetCheckedTab("Keyboard");
+            ReasonCmb.SelectedIndex = 0;
+        }
+
+        private void CreateTempSignature()
+        {
+            CPDFDocument tempDocument = CPDFDocument.CreateDocument();
+            tempDocument.InsertPage(0, 200, 200, string.Empty);
+            CPDFPage page = tempDocument.PageAtIndex(0);
+            CPDFSignatureWidget signatureWidget = page.CreateWidget(C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS) as CPDFSignatureWidget;
+            signatureWidget.SetRect(new CRect(0, 100, 300, 0));
+            tempSignatureConfig.IsDrawLogo = (bool)LogoChk.IsChecked;
+            if (tempSignatureConfig.IsDrawLogo)
+            {
+                tempSignatureConfig.LogoBitmap = new Bitmap(logoPath);
+            }
+            tempSignatureConfig.Content = Text;
+            tempSignatureConfig.TextColor = textColor;
+            tempSignatureConfig.ContentColor = new float[] { 0, 0, 0 };
+            signatureWidget.UpdataApWithSignature(tempSignatureConfig);
+
+            byte[] signatureBitmapBytes = GetTempSignatureImage(signatureWidget, out int width, out int height);
+
+            signatureWidget.ReleaseAnnot();
+
+            if (signatureBitmapBytes.Length > 0)
+            {
+                PixelFormat fmt = PixelFormats.Bgra32;
+                BitmapSource bps = BitmapSource.Create(width, height, 96, 96, fmt, null, signatureBitmapBytes, (width * fmt.BitsPerPixel + 7) / 8);
+                imageControl.Source = bps;
+            }
+            else
+            {
+                imageControl.Source = null;
+            }
+        }
+
+        public static byte[] GetTempSignatureImage(CPDFSignatureWidget signatureWidget, out int width, out int height)
+        {
+            CRect rect = signatureWidget.GetRect();
+
+            var flags = BindingFlags.NonPublic | BindingFlags.Static;
+            var dpiProperty = typeof(SystemParameters).GetProperty("Dpi", flags);
+            int dpi = (int)dpiProperty.GetValue(null, null);
+
+            width = (int)(rect.width() * dpi / 72D * 2);
+            height = (int)(rect.height() * dpi / 72D * 2);
+
+            byte[] imageData = new byte[width * height * 4];
+            signatureWidget.RenderAnnot(width, height, imageData, CPDFAppearanceType.Normal);
+
+            return imageData;
+        }
+
+        private void TextAlignBtn_Click(object sender, RoutedEventArgs e)
+        {
+            ToggleButton checkBtn = sender as ToggleButton;
+            if (checkBtn == null)
+            {
+                return;
+            }
+            checkBtn.IsChecked = true;
+            if (checkBtn != TextAlignLeftBtn)
+            {
+                tempSignatureConfig.IsContentAlignLeft = true;
+                TextAlignLeftBtn.IsChecked = false;
+            }
+            if (checkBtn != TextAlignRightBtn)
+            {
+                tempSignatureConfig.IsContentAlignLeft = false;
+                TextAlignRightBtn.IsChecked = false;
+            }
+            CreateTempSignature();
+        }
+
+        private void Border_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            Border clickBorder = sender as Border;
+            if (clickBorder == null || clickBorder.Tag == null)
+            {
+                return;
+            }
+            SetCheckedTab(clickBorder.Tag.ToString());
+            ImagePickPanel.Visibility = Visibility.Hidden;
+
+            if (clickBorder == NoneBorder)
+            {
+                tempSignatureConfig.IsDrawOnlyContent = true;
+            }
+            else
+            {
+                tempSignatureConfig.IsDrawOnlyContent = false;
+                if (clickBorder == KeyboardBorder)
+                {
+                    tempSignatureConfig.Text = signatureName;
+                    tempSignatureConfig.ImageBitmap = null;
+                    KeyboardPopup.Visibility = Visibility.Visible;
+                }
+                else
+                {
+                    tempSignatureConfig.Text = string.Empty;
+                    if (clickBorder == TrackpadBorder)
+                    {
+                        CanvaDrawPopup.Visibility = Visibility.Visible;
+                    }
+                    else if (clickBorder == ImageBorder)
+                    {
+                        ImagePickPanel.Visibility = Visibility.Visible;
+                        if (!string.IsNullOrEmpty(imagePath))
+                        {
+                            tempSignatureConfig.ImageBitmap = new Bitmap(imagePath);
+                        }
+                    }
+                }
+            }
+            SetProperty();
+            CreateTempSignature();
+        }
+
+        private void SetCheckedTab(string tab)
+        {
+            if (TabDict != null && TabDict.ContainsKey(tab))
+            {
+                foreach (string key in TabDict.Keys)
+                {
+                    Border checkBorder = TabDict[key];
+                    if (checkBorder == null)
+                    {
+                        continue;
+                    }
+
+                    checkBorder.BorderThickness = new Thickness(0);
+                    if (key == tab)
+                    {
+                        checkBorder.BorderThickness = new Thickness(0, 0, 0, 2);
+                    }
+                }
+            }
+        }
+
+        private void CanvasPopupClose_Click(object sender, RoutedEventArgs e)
+        {
+            CanvaDrawPopup.Visibility = Visibility.Collapsed;
+        }
+
+        private void CanvasClearBtn_Click(object sender, RoutedEventArgs e)
+        {
+            DrawInkCanvas.Strokes.Clear();
+
+        }
+
+        private void CanvasPopupConfirm_Click(object sender, RoutedEventArgs e)
+        {
+            tempSignatureConfig.ImageBitmap = GetDrawInk();
+            CanvaDrawPopup.Visibility = Visibility.Collapsed;
+            SetProperty();
+            CreateTempSignature();
+        }
+
+        public Bitmap GetDrawInk()
+        {
+            if (DrawInkCanvas != null && DrawInkCanvas.Strokes != null && DrawInkCanvas.Strokes.Count > 0)
+            {
+                Rect bound = DrawInkCanvas.Strokes.GetBounds();
+                DrawingVisual drawVisual = new DrawingVisual();
+                DrawingContext drawContext = drawVisual.RenderOpen();
+
+                foreach (Stroke drawStroke in DrawInkCanvas.Strokes)
+                {
+                    Pen drawPen = new Pen(new SolidColorBrush(drawStroke.DrawingAttributes.Color), drawStroke.DrawingAttributes.Width);
+                    PathGeometry drawPath = new PathGeometry();
+                    PathFigureCollection Figures = new PathFigureCollection();
+                    PathFigure AddFigure = new PathFigure();
+                    Figures.Add(AddFigure);
+                    drawPath.Figures = Figures;
+
+                    if (drawStroke.StylusPoints.Count > 1)
+                    {
+                        StylusPoint startPoint = drawStroke.StylusPoints[0];
+                        AddFigure.StartPoint = new Point(startPoint.X - bound.X, startPoint.Y - bound.Y);
+                        for (int i = 1; i < drawStroke.StylusPoints.Count; i++)
+                        {
+                            StylusPoint drawPoint = drawStroke.StylusPoints[i];
+                            Point offsetPoint = new Point(drawPoint.X - bound.X, drawPoint.Y - bound.Y);
+                            LineSegment drawSegment = new LineSegment();
+                            drawSegment.Point = offsetPoint;
+                            AddFigure.Segments.Add(drawSegment);
+                        }
+                    }
+
+                    if (AddFigure.Segments.Count > 0)
+                    {
+                        drawContext.DrawGeometry(null, drawPen, drawPath);
+                    }
+                }
+                drawContext.Close();
+
+                RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)bound.Width, (int)bound.Height, 96, 96, PixelFormats.Pbgra32);
+                renderBitmap.Render(drawVisual);
+                BitmapFrame newFrame = BitmapFrame.Create(renderBitmap);
+                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
+                pngEncoder.Frames.Add(newFrame);
+                using (MemoryStream newStream = new MemoryStream())
+                {
+                    pngEncoder.Save(newStream);
+                    return new Bitmap(newStream);
+                }
+            }
+            else
+            {
+                return null;
+            }
+        }
+
+        private void SetProperty()
+        {
+            Text = string.Empty;
+            if ((bool)NameChk.IsChecked)
+            {
+                if ((bool)TabChk.IsChecked)
+                {
+                    Text += "Name: ";
+                }
+                Text += DictionaryValueConverter.GetGrantorFromDictionary(signatureCertificate.SubjectDict) + "\n";
+            }
+
+            if ((bool)DateChk.IsChecked)
+            {
+                if ((bool)TabChk.IsChecked)
+                {
+                    Text += "Date: ";
+                }
+                DateTime currentDateTime = DateTime.Now;
+
+                string customFormat = "yyyy.MM.dd HH:mm:ss";
+
+                string formattedDateTime = currentDateTime.ToString(customFormat);
+                Text += formattedDateTime + "\n";
+            }
+
+            if ((bool)LogoChk.IsChecked)
+            {
+                tempSignatureConfig.IsDrawLogo = true;
+            }
+            else
+            {
+                tempSignatureConfig.IsDrawLogo = false;
+            }
+
+            if ((bool)ReasonChk.IsChecked)
+            {
+                if ((bool)TabChk.IsChecked)
+                {
+                    Text += "Reason: ";
+                }
+                Text += (ReasonCmb.SelectedItem as ComboBoxItem).Content.ToString() + "\n";
+            }
+
+            if ((bool)DistinguishableNameChk.IsChecked)
+            {
+                if ((bool)TabChk.IsChecked)
+                {
+                    Text += "DN: ";
+                }
+                var keyOrder = new List<string> { "CN",  "O", "OU", "emailAddress", "L", "ST", "C" };
+
+                var keyMapping = new Dictionary<string, string>
+                {
+                    { "CN", "cn" },
+                    { "OU", "ou" },
+                    { "O", "o" },
+                    { "L", "l" },
+                    { "ST", "st" },
+                    { "C", "c" },
+                    { "emailAddress", "email" }
+                };
+
+                var stringBuilder = new StringBuilder();
+
+                foreach (var originalKey in keyOrder)
+                {
+                    if (keyMapping.TryGetValue(originalKey, out string newKey) &&
+                        signatureCertificate.SubjectDict.TryGetValue(originalKey, out string value) && !string.IsNullOrEmpty(value))
+                    {
+                        if (stringBuilder.Length > 0)
+                        {
+                            stringBuilder.Append(",");
+                        }
+                        stringBuilder.Append(newKey + "=" + value);
+                    }
+                }
+
+                 Text += stringBuilder.ToString()+"\n";
+            }
+
+            if ((bool)ComPDFKitVersionChk.IsChecked)
+            {
+                Assembly assembly = Assembly.GetExecutingAssembly();
+                Version version = assembly.GetName().Version;
+                if ((bool)TabChk.IsChecked)
+                {
+                    Text += "ComPDFKit Version: ";
+                }
+                Text += version.Major.ToString() + "." + version.Minor.ToString() + "." + version.Build.ToString() + "." + version.Revision.ToString() + "\n";
+
+            }
+
+            if ((bool)PositionChk.IsChecked)
+            {
+                if ((bool)TabChk.IsChecked)
+                {
+                    Text += "Position: ";
+                }
+                Text += PositionTbx.Text + "\n";
+            }
+        }
+
+        private void ReasonCheckBox_Click(object sender, RoutedEventArgs e)
+        {
+            CheckBox checkItem = sender as CheckBox;
+            if (checkItem == null)
+            {
+                return;
+            }
+
+            ReasonPanel.Visibility = checkItem.IsChecked == true ? Visibility.Visible : Visibility.Collapsed;
+        }
+
+        private void BrowseTxt_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            string filter = "Image files (*.jpg, *.jpeg, *.png, *.bmp)|*.jpg;*.jpeg;*.png;*.bmp";
+            string pngPath = CommonHelper.GetExistedPathOrEmpty(filter);
+            if (!string.IsNullOrEmpty(pngPath))
+            {
+                imagePath = pngPath;
+                try
+                {
+                    tempSignatureConfig.ImageBitmap = new Bitmap(imagePath);
+                }
+                catch (Exception exception)
+                {
+                    MessageBox.Show("The image is invalid.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+                    return;
+                }
+                SetProperty();
+                CreateTempSignature();
+            }
+        }
+
+        private void ClearTxt_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            imagePath = string.Empty;
+            tempSignatureConfig.ImageBitmap = null;
+            SetProperty();
+            CreateTempSignature();
+        }
+
+        private void NameChk_Click(object sender, RoutedEventArgs e)
+        {
+            SetProperty();
+            CreateTempSignature();
+        }
+
+        private void DateChk_Click(object sender, RoutedEventArgs e)
+        {
+            SetProperty();
+            CreateTempSignature();
+        }
+
+        private void LogoChk_Click(object sender, RoutedEventArgs e)
+        {
+            SetProperty();
+            CreateTempSignature();
+        }
+
+        private void ReasonChk_Click(object sender, RoutedEventArgs e)
+        {
+            if (!(bool)ReasonChk.IsChecked)
+            {
+                Reasonstp.Visibility = Visibility.Collapsed;
+            }
+            else
+            {
+                Reasonstp.Visibility = Visibility.Visible;
+            }
+            SetProperty();
+            CreateTempSignature();
+        }
+
+        private void DistinguishableNameChk_Click(object sender, RoutedEventArgs e)
+        {
+            SetProperty();
+            CreateTempSignature();
+        }
+
+        private void PositionChk_Click(object sender, RoutedEventArgs e)
+        {
+            if (!(bool)PositionChk.IsChecked)
+            {
+                PositionStp.Visibility = Visibility.Collapsed;
+            }
+            else
+            {
+                PositionStp.Visibility = Visibility.Visible;
+            }
+            SetProperty();
+            CreateTempSignature();
+        }
+
+        private void TabChk_Click(object sender, RoutedEventArgs e)
+        {
+            SetProperty();
+            CreateTempSignature();
+        }
+
+        private void ReasonCmb_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            SetProperty();
+            CreateTempSignature();
+        }
+
+        private void ComPDFKitVersionChk_Click(object sender, RoutedEventArgs e)
+        {
+            SetProperty();
+            CreateTempSignature();
+        }
+
+        private void PositionTbx_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (!(bool)PositionChk.IsChecked)
+            {
+                PositionStp.Visibility = Visibility.Collapsed;
+            }
+            else
+            {
+                PositionStp.Visibility = Visibility.Visible;
+            }
+            SetProperty();
+            CreateTempSignature();
+        }
+
+        private void ContinueBtn_Click(object sender, RoutedEventArgs e)
+        {
+            string filePath = CommonHelper.GetGeneratePathOrEmpty("PDF files (*.pdf)|*.pdf", Document.FileName + "_Signed.pdf");
+
+            if (string.IsNullOrEmpty(filePath))
+            {
+                return;
+            }
+
+            if (filePath.ToLower() == Document.FilePath.ToLower())
+            {
+                MessageBox.Show("Do not use the new file name that is the same as the current file name.");
+                return;
+            }
+
+            if ((bool)ReasonChk.IsChecked)
+            {
+                reason = (ReasonCmb?.SelectedItem as ComboBoxItem)?.Content?.ToString();
+            }
+            else
+            {
+                reason = string.Empty;
+            }
+
+            if ((bool)PositionChk.IsChecked)
+            {
+                location = PositionTbx.Text;
+            }
+            else
+            {
+                location = string.Empty;
+            }
+
+            signatureWidget.UpdataApWithSignature(tempSignatureConfig);
+
+            if (Document.WriteSignatureToFilePath(signatureWidget, filePath, SignaturePath, Password, location, reason, CPDFSignaturePermissions.CPDFSignaturePermissionsNone))
+            {
+                signatureCertificate.AddToTrustedCertificates();
+                AfterFillSignature?.Invoke(sender, filePath);
+            }
+
+            CloseWindow(sender);
+        }
+
+
+        private void CancelBtn_Click(object sender, RoutedEventArgs e)
+        {
+            CloseWindow(sender);
+        }
+
+        private void CloseWindow(object sender)
+        {
+            Window parentWindow = Window.GetWindow(sender as DependencyObject);
+            parentWindow?.Close();
+        }
+
+        private void TextColorPickerControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            TextColorPickerControl.SetIsChecked(0);
+            TextColorPickerControl.Brush = new SolidColorBrush(Colors.Black);
+        }
+
+        private void TextColorPickerControl_ColorChanged(object sender, EventArgs e)
+        {
+            KeyboardInPutTextBox.Foreground = TextColorPickerControl.Brush;
+        }
+
+        private void KeyboardCancel_Click(object sender, RoutedEventArgs e)
+        {
+            KeyboardPopup.Visibility = Visibility.Collapsed;
+        }
+
+        private void KeyboardClear_Click(object sender, RoutedEventArgs e)
+        {
+            KeyboardInPutTextBox.Text = string.Empty;
+        }
+
+        private void KeyboardSave_Click(object sender, RoutedEventArgs e)
+        {
+            signatureName = KeyboardInPutTextBox.Text;
+            tempSignatureConfig.Text = signatureName;
+            SolidColorBrush solidColorBrush = TextColorPickerControl.Brush as SolidColorBrush;
+            float red = solidColorBrush.Color.R;
+            float green = solidColorBrush.Color.G;
+            float blue = solidColorBrush.Color.B;
+            textColor = new[] { red / 255, green / 255, blue / 255 };
+
+            KeyboardPopup.Visibility = Visibility.Collapsed;
+            SetProperty();
+            CreateTempSignature();
+        }
+
+        private void KeyboardPopupClose_Click(object sender, RoutedEventArgs e)
+        {
+            KeyboardPopup.Visibility = Visibility.Collapsed;
+        }
+    }
+}

+ 14 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/FillDigitalSignatureControl/FillDigitalSignatureDialog.xaml

@@ -0,0 +1,14 @@
+<Window x:Class="Compdfkit_Tools.PDFControl.FillDigitalSignatureDialog"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
+        mc:Ignorable="d"
+        ResizeMode="NoResize"
+        ShowInTaskbar="False"
+        Title="Customize the Signature Appearance"  Width="630" Height="550">
+    <Grid>
+        <local:FillDigitalSignatureControl x:Name="FillDigitalSignatureControl"></local:FillDigitalSignatureControl>
+    </Grid>
+</Window>

+ 82 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/FillDigitalSignatureControl/FillDigitalSignatureDialog.xaml.cs

@@ -0,0 +1,82 @@
+using ComPDFKit.PDFAnnotation.Form;
+using ComPDFKit.PDFDocument;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    /// <summary>
+    /// Interaction logic for FillDigitalSignatureDialog.xaml
+    /// </summary>
+    public partial class FillDigitalSignatureDialog : Window
+    {
+        private string _filePath = string.Empty;
+        public string FilePath
+        {
+            get => _filePath;
+            set
+            {
+                _filePath = value;
+                FillDigitalSignatureControl.SignaturePath = value;
+            }
+        }
+
+        private string _password = string.Empty;
+        public string Password
+        {
+            get => _password;
+            set
+            {
+                _password = value;
+                FillDigitalSignatureControl.Password = value;
+            }
+        }
+
+        private CPDFSignatureWidget _signatureWidget;
+        public CPDFSignatureWidget SignatureWidget
+        {
+            get => this._signatureWidget;
+            set
+            {
+                this._signatureWidget = value;
+                FillDigitalSignatureControl.signatureWidget = value;
+            }
+        }
+
+        private CPDFDocument _document;
+        public CPDFDocument Document
+        {
+            get => _document;
+            set
+            {
+                _document = value;
+                FillDigitalSignatureControl.Document = value;
+            }
+        }
+
+        public event EventHandler<string> AfterFillSignature;
+
+        public FillDigitalSignatureDialog()
+        {
+            InitializeComponent();
+            FillDigitalSignatureControl.AfterFillSignature -= ReloadAfterFillSignature;
+            FillDigitalSignatureControl.AfterFillSignature += ReloadAfterFillSignature;
+        }
+
+        private void ReloadAfterFillSignature(object sender, string e)
+        {
+            AfterFillSignature?.Invoke(sender, e);
+        }
+    }
+}

File diff suppressed because it is too large
+ 48 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/SignatureStatusBarControl/SignatureStatusBarControl.xaml


+ 153 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/SignatureStatusBarControl/SignatureStatusBarControl.xaml.cs

@@ -0,0 +1,153 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Windows;
+using System.Windows.Controls;
+using ComPDFKit.DigitalSign;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    public enum SignatureStatus
+    {
+        None,
+        Valid,
+        Invalid,
+        MultiSig,
+        Unknown,
+    }
+    public partial class SignatureStatusBarControl : UserControl, INotifyPropertyChanged
+    {
+        private string _messageString;
+        public string MessageString
+        {
+            get => _messageString;
+            set => UpdateProper(ref _messageString, value);
+        }
+        private string validString = "The signature is valid";
+        private string invalidString = "The signature is invalid";
+        private string multiSigString = "At least one signature is invalid";
+        private string unknownString = "Signature validity is unknown";
+
+        public event EventHandler OnViewSignatureButtonClicked;
+        
+        private SignatureStatus _status;
+        public SignatureStatus Status
+        {
+            get => _status;
+            set
+            {
+                _status = value;
+                SetStatus(_status);
+            }
+        }
+
+        public SignatureStatusBarControl()
+        {
+            InitializeComponent();
+            DataContext = this;
+        }
+        
+        private void SetStatus(SignatureStatus status)
+        {
+            ValidBorder.Visibility = Visibility.Collapsed;
+            InvalidBorder.Visibility = Visibility.Collapsed;
+            UnknownBorder.Visibility = Visibility.Collapsed;
+
+            switch (status)
+            {
+                case SignatureStatus.None:
+                    MessageString = "";
+                    Visibility = Visibility.Collapsed;
+                    break;
+                case SignatureStatus.Valid:
+                    ValidBorder.Visibility = Visibility.Visible;
+                    Visibility = Visibility.Visible;
+                    MessageString = validString;
+                    break;
+                case SignatureStatus.Invalid:
+                    InvalidBorder.Visibility = Visibility.Visible;
+                    Visibility = Visibility.Visible;
+                    MessageString = invalidString;
+                    break;
+                case SignatureStatus.MultiSig:
+                    InvalidBorder.Visibility = Visibility.Visible;
+                    Visibility = Visibility.Visible;
+                    MessageString = multiSigString;
+                    break;
+                case SignatureStatus.Unknown:
+                    UnknownBorder.Visibility = Visibility.Visible;
+                    Visibility = Visibility.Visible;
+                    MessageString = unknownString;
+                    break;
+            }
+        }
+
+        public void SetStatus(List<CPDFSignature> signatureList)
+        {
+            SignatureStatus status;
+            if (signatureList.Count == 1)
+            {
+                bool isTrusted = true;
+                bool isVerified = true;
+                bool notModified = true;
+                foreach (var signature in signatureList)
+                {
+                    CPDFSigner signer = signature.SignerList.First();
+                    if(signer.IsSignVerified == false)
+                        isVerified = false;
+                    if (signer.IsCertTrusted == false)
+                        isTrusted = false;
+                    if (signature.ModifyInfoList.Count > 0)
+                        notModified = false;
+                }
+                
+                
+                if (isTrusted && isVerified && notModified)
+                {
+                    status = SignatureStatus.Valid;
+                }
+                else if (!isTrusted && isVerified && notModified)
+                {
+                    status = SignatureStatus.Unknown;
+                }
+                else
+                {
+                    status = SignatureStatus.Invalid;
+                }
+            }
+            else if (signatureList.Count > 1)
+            {
+                status = SignatureStatus.MultiSig;
+            }
+            else
+            {
+                status = SignatureStatus.None;
+            }
+            Status = status;
+        }
+
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        protected void UpdateProper<T>(ref T properValue,
+            T newValue,
+            [CallerMemberName] string properName = "")
+        {
+            if (object.Equals(properValue, newValue))
+                return;
+
+            properValue = newValue;
+            OnPropertyChanged(properName);
+        }
+
+        protected void OnPropertyChanged([CallerMemberName] string propertyName = "") =>
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+
+
+        private void ButtonViewSignature_OnClick(object sender, RoutedEventArgs e)
+        {
+            OnViewSignatureButtonClicked?.Invoke(this,null);
+        }
+    }
+}

File diff suppressed because it is too large
+ 53 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/VerifyDigitalSignatureControl/DigitalSignatureInfoControl.xaml


+ 130 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/VerifyDigitalSignatureControl/DigitalSignatureInfoControl.xaml.cs

@@ -0,0 +1,130 @@
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Windows;
+using System.Windows.Controls;
+using Compdfkit_Tools.Helper;
+using Compdfkit_Tools.PDFControl;
+using ComPDFKit.DigitalSign;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    public partial class DigitalSignatureInfoControl : UserControl, INotifyPropertyChanged
+    {
+        private string _signerInfo;
+        public string SignerInfo
+        {
+            get => _signerInfo;
+            set => UpdateProper(ref _signerInfo, value);
+        }
+        
+        private string _timeInfo;
+        public string TimeInfo
+        {
+            get => _timeInfo;
+            set => UpdateProper(ref _timeInfo, value);
+        }
+        
+        private SignatureStatus _status;
+        public SignatureStatus Status
+        {
+            get => _status;
+            set
+            {
+                _status = value;
+                SetStatus(_status);
+            }
+        }
+        public DigitalSignatureInfoControl()
+        {
+            InitializeComponent();
+            DataContext = this;
+        }
+        
+        public void InitWithSignature(CPDFSignature signature)
+        {
+            string validity;
+            string signerName;
+            string email;
+            string time;
+            
+            if(signature == null)
+                return;
+            SignatureStatus status;
+            CPDFSigner signer = signature.SignerList.First();
+            bool isTrusted = signer.IsCertTrusted;
+            bool isVerified = signer.IsSignVerified;
+            bool notModified = signature.ModifyInfoList.Count == 0;
+            if (isTrusted && isVerified && notModified)
+            {
+                status = SignatureStatus.Valid;
+                validity = "Valid Signature";
+            }
+            else if (!isTrusted && isVerified && notModified)
+            {
+                status = SignatureStatus.Unknown;
+                validity = "Unknown Signature";
+            }
+            else
+            {
+                status = SignatureStatus.Invalid;
+                validity = "Invalid Signature";
+            }
+            Status = status;
+
+            signerName = signature.Name;
+            email = DictionaryValueConverter.GetEmailFormDictionary(signature.SignerList.First().CertificateList.Last().SubjectDict);
+            time = signature.Date;
+            SignerInfo = validity + ",Signed by" + "\"" + signerName;
+            if (!string.IsNullOrEmpty(email))
+            {
+                SignerInfo += "<" + email + ">" + "\"";
+            }
+            else
+            {
+                SignerInfo += "\"";
+            }
+
+            TimeInfo = "Signature Time:" + CommonHelper.GetExactDateFromString(time);
+        }
+        
+        private void SetStatus(SignatureStatus status)
+        {
+            ValidBorder.Visibility = Visibility.Collapsed;
+            InvalidBorder.Visibility = Visibility.Collapsed;
+            UnknownBorder.Visibility = Visibility.Collapsed;
+
+            switch (status)
+            {
+                case SignatureStatus.None:
+                    break;
+                case SignatureStatus.Valid:
+                    ValidBorder.Visibility = Visibility.Visible;
+                    break;
+                case SignatureStatus.Invalid:
+                    InvalidBorder.Visibility = Visibility.Visible;
+                    break;
+                case SignatureStatus.Unknown:
+                    UnknownBorder.Visibility = Visibility.Visible;
+                    break;
+            }
+        }
+
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        protected void UpdateProper<T>(ref T properValue,
+            T newValue,
+            [CallerMemberName] string properName = "")
+        {
+            if (object.Equals(properValue, newValue))
+                return;
+
+            properValue = newValue;
+            OnPropertyChanged(properName);
+        }
+
+        protected void OnPropertyChanged([CallerMemberName] string propertyName = "") =>
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+    }
+}

+ 18 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/VerifyDigitalSignatureControl/DigitalSignatureValiditySummaaryControl.xaml

@@ -0,0 +1,18 @@
+<UserControl x:Class="Compdfkit_Tools.PDFControl.DigitalSignatureValiditySummaaryControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
+             mc:Ignorable="d"
+             d:DesignHeight="239" d:DesignWidth="504">
+    <Grid>
+        <Grid Background="#ffffff"  Margin="20,0,0,0"  Panel.ZIndex="1" Height="20" HorizontalAlignment="Left" VerticalAlignment="Top">
+            <TextBlock Text="Validity Summary" FontWeight="Bold" FontSize="14" FontFamily="Segoe UI"></TextBlock>
+        </Grid>
+        <Border Grid.Row="0" Margin="12" BorderBrush="#CCCCCC" BorderThickness="1">
+            <TextBlock Margin="10" Text="{Binding ValiditySummaryString}" Width="448" TextWrapping="Wrap"></TextBlock>
+        </Border>
+    </Grid>
+
+</UserControl>

+ 89 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/VerifyDigitalSignatureControl/DigitalSignatureValiditySummaaryControl.xaml.cs

@@ -0,0 +1,89 @@
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Windows.Controls;
+using Compdfkit_Tools.Helper;
+using ComPDFKit.DigitalSign;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    public partial class DigitalSignatureValiditySummaaryControl : UserControl, INotifyPropertyChanged
+    {
+        private string _validitySummaryString;
+        public string ValiditySummaryString
+        {
+            get => _validitySummaryString;
+            set => UpdateProper(ref _validitySummaryString, value);
+        }
+        public DigitalSignatureValiditySummaaryControl()
+        {
+            InitializeComponent();
+            DataContext = this;
+        }
+
+        public void InitWithSignature(CPDFSignature signature)
+        {
+            bool isSignVerified = signature.SignerList.First().IsSignVerified;
+            bool isCertTrusted = signature.SignerList.First().IsCertTrusted;
+            bool isDocModified = signature.ModifyInfoList.Count > 0;
+            bool isExpired = DateTime.Now >
+            CommonHelper.GetDateTimeFromString(signature.SignerList.First().CertificateList.First().ValidityEnds);
+            
+            string validitySummaryString = "";
+            if (isCertTrusted)
+            {
+                validitySummaryString += "The signer's identity is valid.\n\n";
+            }
+            else
+            {
+                validitySummaryString += "The signer's identity is invalid.\n\n";
+            }
+
+            if(isDocModified || (!isSignVerified && !isCertTrusted))
+            {
+                validitySummaryString += "The signature is invalid.\n\n";
+            }
+            else if (isSignVerified && isCertTrusted)
+            {
+                validitySummaryString += "The signature is valid.\n\n";
+            }
+            else if(isSignVerified && !isCertTrusted)
+            {
+                validitySummaryString += "Signature validity is unknown because it has not been included in your list of trusted certificates and none of its parent certificates are trusted certificates.\n\n";
+            }
+            
+            if(isExpired)
+            {
+                validitySummaryString += "The file was signed with a certificate that has expired. If you acquired this file recently, it may not be authentic.\n\n";
+            }
+
+            if (!isDocModified)
+            {
+                validitySummaryString += "The document has not been modified since this signature was applied.\n";
+            }
+            else
+            {
+                validitySummaryString += "The document has been altered or corrupted since it was signed by the current user.\n";
+            }
+            ValiditySummaryString = validitySummaryString;
+        }
+
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        protected void UpdateProper<T>(ref T properValue,
+            T newValue,
+            [CallerMemberName] string properName = "")
+        {
+            if (object.Equals(properValue, newValue))
+                return;
+
+            properValue = newValue;
+            OnPropertyChanged(properName);
+        }
+
+        protected void OnPropertyChanged([CallerMemberName] string propertyName = "") =>
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+    }
+}

+ 23 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/VerifyDigitalSignatureControl/VerifyDigitalSignatureControl.xaml

@@ -0,0 +1,23 @@
+<Window x:Class="Compdfkit_Tools.PDFControl.VerifyDigitalSignatureControl"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
+        mc:Ignorable="d"
+        ShowInTaskbar="False"
+        Title="VerifyDigitalSignatureControl" Height="450" Width="552">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto"></RowDefinition>
+            <RowDefinition Height="Auto"></RowDefinition>
+            <RowDefinition Height="Auto"></RowDefinition>
+            <RowDefinition Height="Auto"></RowDefinition>
+        </Grid.RowDefinitions>
+        
+        <local:DigitalSignatureInfoControl x:Name="DigitalSignatureInfoControl" Height="52" Margin="0,30,0,10"></local:DigitalSignatureInfoControl>
+        <local:DigitalSignatureValiditySummaaryControl x:Name="DigitalSignatureValiditySummaryControl" Grid.Row="1" Height="239" Margin="0,10,0,10"></local:DigitalSignatureValiditySummaaryControl>
+        
+        <Button Grid.Row="3" Height="32" Width="158" HorizontalAlignment="Right" Content="View signer certificates" Margin="12" Click="ViewCertificates_OnClick" FontSize="14" FontFamily="Segoe UI"></Button>
+    </Grid>
+</Window>

+ 30 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/VerifyDigitalSignatureControl/VerifyDigitalSignatureControl.xaml.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Windows;
+using Compdfkit_Tools.PDFControl;
+using ComPDFKit.DigitalSign;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    public partial class VerifyDigitalSignatureControl : Window
+    {
+        private CPDFSignature signature;
+        public event EventHandler<CPDFSignature> ViewCertificateEvent;
+        
+        public VerifyDigitalSignatureControl()
+        {
+            InitializeComponent();
+        }
+
+        public void InitWithSignature(CPDFSignature signature)
+        {
+            DigitalSignatureInfoControl.InitWithSignature(signature);
+            DigitalSignatureValiditySummaryControl.InitWithSignature(signature);
+            this.signature = signature;
+        }
+
+        private void ViewCertificates_OnClick(object sender, RoutedEventArgs e)
+        {
+            ViewCertificateEvent?.Invoke(this, signature);
+        }
+    }
+}

+ 12 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/CertificateChainControl.xaml

@@ -0,0 +1,12 @@
+<UserControl x:Class="Compdfkit_Tools.DigitalSignature.ViewCertificationControl.CertificateChainControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:Compdfkit_Tools.DigitalSignature.ViewCertificationControl"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <Grid>
+            
+    </Grid>
+</UserControl>

+ 28 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/CertificateChainControl.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Compdfkit_Tools.DigitalSignature.ViewCertificationControl
+{
+    /// <summary>
+    /// Interaction logic for CertificateChainControl.xaml
+    /// </summary>
+    public partial class CertificateChainControl : UserControl
+    {
+        public CertificateChainControl()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 110 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/CertificateDetailControl.xaml

@@ -0,0 +1,110 @@
+<UserControl x:Class="Compdfkit_Tools.PDFControl.CertificateDetailControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="600">
+    <Grid>
+        <Grid Background="#ffffff"  Margin="20,0,0,0"  Panel.ZIndex="1" Height="20" HorizontalAlignment="Left" VerticalAlignment="Top">
+            <TextBlock Text="Details" FontWeight="Bold" FontSize="16"></TextBlock>
+        </Grid>
+       
+        <Border Margin="12" BorderBrush="#33000000" BorderThickness="1" >
+            <ScrollViewer Margin="0,10,0,0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
+                <StackPanel VerticalAlignment="Center" Margin="20,0,0,0">
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Version: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="AwardTxt" Text="{Binding Version}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Algorithm: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="AlgorithmTxt" Text="{Binding Algorithm}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Subject: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="Subjectxt" Text="{Binding Subject}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Issuer: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="IssuerTxt" Text="{Binding Issuer}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+                    
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Serial Number: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="SerialNumberTxt" Text="{Binding SerialNumber}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+                    
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Valid from: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="ValidityFromTxt" Text="{Binding ValidityFrom}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+                    
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Valid to: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="ValidityToTxt" Text="{Binding ValidityTo}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+                    
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Certificate Policy: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="CertificatePolicyTxt" Text="{Binding CertificatePolicy}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+                    
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="CRL Distribution Points: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="CRLTxt" Text="{Binding CrlDistributionPoint}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Issuer Information Access: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="AgencyInformationTxt" Text="{Binding AuthorityInfoAccess}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+                    
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Issuer‘s Key Identifier: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="AuthoritySecretKeyTxt" Text="{Binding AuthorityKeyIdentifier}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Subject‘s Key Identifier: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="SubjectSecretKeyTxt" Text="{Binding SubjectKeyIdentifier}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Basic Constraints: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="BasicConstraintsTxt" Text="{Binding BasicConstraints}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Key Usage: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="KeyUsageTxt" Text="{Binding KeyUsage}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Public key: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="PublicKeyTxt" Text="{Binding PublicKey}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+                    
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="X.509 Data: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="X509Txt" Text="{Binding X509Data}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+                    
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="SHA1 Abstract: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="SHA1AbstractTxt" Text="{Binding SHA1Digest}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+                    
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="MD5 Abstract: " Foreground="Black" FontSize="14"></TextBlock>
+                        <TextBlock x:Name="MD5AbstractTxt" Text="{Binding MD5Digest}" Foreground="#666"  FontSize="14" Width="300" TextWrapping="Wrap"></TextBlock>
+                    </StackPanel>
+                </StackPanel>
+            </ScrollViewer>
+        </Border>
+    </Grid>
+</UserControl>

+ 220 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/CertificateDetailControl.xaml.cs

@@ -0,0 +1,220 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Compdfkit_Tools.Helper;
+using ComPDFKit.DigitalSign;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    public partial class CertificateDetailControl : UserControl,INotifyPropertyChanged
+    {
+        private string version;
+        public string Version
+        {
+            get => version;
+            set => UpdateProper(ref version, value);
+        }
+        
+        private string algorithm;
+        public string Algorithm
+        {
+            get => algorithm;
+            set => UpdateProper(ref algorithm, value);
+        }
+        
+        private string subject;
+        public string Subject
+        {
+            get => subject;
+            set => UpdateProper(ref subject, value);
+        }
+        
+        private string issuer;
+        public string Issuer
+        {
+            get => issuer;
+            set => UpdateProper(ref issuer, value);
+        }
+        
+        private string serialNumber;
+        public string SerialNumber
+        {
+            get => serialNumber;
+            set => UpdateProper(ref serialNumber, value);
+        }
+
+        private string validityFrom;
+        public string ValidityFrom
+        {
+            get => validityFrom;
+            set => UpdateProper(ref validityFrom, value);
+        }
+
+        private string validityTo;
+        public string ValidityTo
+        {
+            get => validityTo;
+            set => UpdateProper(ref validityTo, value);
+        }
+        
+        private string certificatePolicy;
+        public string CertificatePolicy
+        {
+            get => certificatePolicy;
+            set => UpdateProper(ref certificatePolicy, value);
+        }
+        
+        private string crlDistributionPoint;
+        public string CrlDistributionPoint
+        {
+            get => crlDistributionPoint;
+            set => UpdateProper(ref crlDistributionPoint, value);
+        }
+        
+        private string authorityInfoAccess;
+        public string AuthorityInfoAccess
+        {
+            get => authorityInfoAccess;
+            set => UpdateProper(ref authorityInfoAccess, value);
+        }
+
+        private string authorityKeyIdentifier;
+        public string AuthorityKeyIdentifier
+        {
+            get => authorityKeyIdentifier;
+            set => UpdateProper(ref authorityKeyIdentifier, value);
+        }
+        
+        private string subjectKeyIdentifier;
+        public string SubjectKeyIdentifier
+        {
+            get => subjectKeyIdentifier;
+            set => UpdateProper(ref subjectKeyIdentifier, value);
+        }
+        
+        private string basicConstraints;
+        public string BasicConstraints
+        {
+            get => basicConstraints;
+            set => UpdateProper(ref basicConstraints, value);
+        }
+        
+        private string keyUsage;
+        public string KeyUsage
+        {
+            get => keyUsage;
+            set => UpdateProper(ref keyUsage, value);
+        }
+        
+        private string publicKey;
+        public string PublicKey
+        {
+            get => publicKey;
+            set => UpdateProper(ref publicKey, value);
+        }
+        
+        private string x509Data;
+        public string X509Data
+        {
+            get => x509Data;
+            set => UpdateProper(ref x509Data, value);
+        }
+        
+        private string sha1Abstract;
+        public string SHA1Digest
+        {
+            get => sha1Abstract;
+            set => UpdateProper(ref sha1Abstract, value);
+        }
+        
+        private string md5Digest;
+        public string MD5Digest
+        {
+            get => md5Digest;
+            set => UpdateProper(ref md5Digest, value);
+        }
+
+        public CertificateDetailControl()
+        {
+            InitializeComponent();
+            DataContext = this;
+        }
+        
+        public void LoadDetailInfo(CPDFSignatureCertificate certificate)
+        {
+            string certificatePolicyText = string.Empty;
+            string crlDistributionPointText = string.Empty;
+            string authorityInfoAccessText = string.Empty;
+            string keyUsageText = string.Empty;
+            var usageList = DictionaryValueConverter.GetUsage(certificate);
+
+            foreach (var policy in certificate.CertificatePolicies)
+            {
+                certificatePolicyText += policy + "\n";
+            }
+
+            foreach (var access in certificate.AuthorityInfoAccess)
+            {
+                authorityInfoAccess += access + "\n";
+            }
+
+            foreach (var crl in certificate.CRLDistributionPoints)
+            {
+                crlDistributionPointText += crl + "\n";
+            }
+            
+            for(int i = 0; i < usageList.Count; i++)
+            {
+                keyUsageText += usageList[i];
+                keyUsageText += (i == usageList.Count - 1) ? "" : ", ";
+            }
+            
+            Version = certificate.Version.ToString();
+            Algorithm = certificate.SignatureAlgorithmType.ToString().Substring(26) + "(" + certificate.SignatureAlgorithmOID + ")";
+            Subject = certificate.Subject;
+            Issuer = certificate.Issuer;
+            SerialNumber = certificate.SerialNumber;
+            ValidityFrom = CommonHelper.GetExactDateFromString(certificate.ValidityStarts);
+            ValidityTo = CommonHelper.GetExactDateFromString(certificate.ValidityEnds);
+            CertificatePolicy = certificatePolicyText;
+            CrlDistributionPoint = crlDistributionPointText;
+            X509Data = certificate.X509Data;
+            AuthorityInfoAccess = authorityInfoAccess;
+            AuthorityKeyIdentifier = certificate.AuthorityKeyIdentifier;
+            SubjectKeyIdentifier = certificate.SubjectKeyIdentifier;
+            BasicConstraints = certificate.BasicConstraints;
+            KeyUsage = keyUsageText;
+            PublicKey = certificate.PublicKey;
+            SHA1Digest = certificate.SHA1Digest;
+            MD5Digest = certificate.MD5Digest;
+        }
+        
+        public event PropertyChangedEventHandler PropertyChanged;
+        protected void UpdateProper<T>(ref T properValue,
+            T newValue,
+            [CallerMemberName] string properName = "")
+        {
+            if (object.Equals(properValue, newValue))
+                return;
+
+            properValue = newValue;
+            OnPropertyChanged(properName);
+        }
+
+        protected void OnPropertyChanged([CallerMemberName] string propertyName = "") =>
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+    }
+}

+ 42 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/CertificateInfoControl.xaml

@@ -0,0 +1,42 @@
+<UserControl x:Class="Compdfkit_Tools.PDFControl.CertificateInfoControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
+             mc:Ignorable="d" 
+             d:DesignHeight="650" d:DesignWidth="750">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="../../Asset/Styles/TabControlStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="../../Asset/Styles/TabItemStyle.xaml"></ResourceDictionary>
+            </ResourceDictionary.MergedDictionaries>
+        </ResourceDictionary>
+    </UserControl.Resources>
+    <Grid>
+        <TabControl Style="{StaticResource LineTabControlStyle}"                
+                    Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type Grid}}}"
+                Height="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType={x:Type Grid}}}">
+            <TabItem Header="Summary" Style="{StaticResource LineTabItemStyle}">
+                <Grid>
+                    <local:SummaryControl x:Name="SummaryControl" Height="160" VerticalAlignment="Top"></local:SummaryControl>
+                </Grid>
+            </TabItem>
+            <TabItem Header="Details"  Style="{StaticResource LineTabItemStyle}">
+                <Grid>
+                    <local:CertificateDetailControl x:Name="CertificateDetailControl" Height="450" VerticalAlignment="Top"></local:CertificateDetailControl>
+                </Grid>
+            </TabItem>
+            <TabItem Header="Trust"  Style="{StaticResource LineTabItemStyle}">
+                <Grid>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="150"></RowDefinition>
+                        <RowDefinition></RowDefinition>
+                    </Grid.RowDefinitions>
+                    <local:ConfidenceControl x:Name="ConfidenceControl"></local:ConfidenceControl>
+                </Grid>
+            </TabItem>
+        </TabControl>
+    </Grid>
+</UserControl>

+ 39 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/CertificateInfoControl.xaml.cs

@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Permissions;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using ComPDFKit.DigitalSign;
+
+namespace Compdfkit_Tools.PDFControl {
+    public partial class CertificateInfoControl : UserControl
+    {
+        public event EventHandler TrustCertificateEvent;
+        public CertificateInfoControl()
+        {
+            InitializeComponent();
+        }
+
+        public void LoadCertificateInfo(CPDFSignatureCertificate certificate)
+        {
+            SummaryControl.LoadSummaryInfo(certificate);
+            CertificateDetailControl.LoadDetailInfo(certificate);
+            ConfidenceControl.LoadConfidenceInfo(certificate);
+
+            ConfidenceControl.TrustCertificateEvent += (sender, args) =>
+            {
+                TrustCertificateEvent?.Invoke(sender, null);
+            };
+        }
+    }
+}

+ 63 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/ConfidenceControl.xaml

@@ -0,0 +1,63 @@
+<UserControl x:Class="Compdfkit_Tools.PDFControl.ConfidenceControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
+             xmlns:common="clr-namespace:Compdfkit_Tools.Common"
+             mc:Ignorable="d" 
+             d:DesignHeight="150" d:DesignWidth="600" x:Name="UserControl1">
+    
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <Viewbox x:Key="ValidPath" Width="20" Height="20" x:Shared="False">
+                <Canvas Width="20" Height="20">
+                    <Path Data="M10 17.5C14.1421 17.5 17.5 14.1421 17.5 10C17.5 5.85786 14.1421 2.5 10 2.5C5.85786 2.5 2.5 5.85786 2.5 10C2.5 14.1421 5.85786 17.5 10 17.5ZM9.74283 12.9801L13.9095 7.98014L12.7572 7.01986L9.11627 11.3889L7.197 9.46967L6.13634 10.5303L8.63634 13.0303L9.21707 13.6111L9.74283 12.9801Z" 
+                          Fill="#3CCD75"/>
+                </Canvas>
+            </Viewbox>
+            
+            <Viewbox x:Key="InvalidPath" Width="20" Height="20" x:Shared="False">
+                <Canvas Width="20" Height="20">
+                    <Path Data="M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z" 
+                          Fill="#FF6666"/>
+                    <Path Data="M12 8L8 12" Stroke="White" StrokeThickness="1.5" StrokeLineJoin="Round"/>
+                    <Path Data="M8 8L12 12" Stroke="White" StrokeThickness="1.5" StrokeLineJoin="Round"/>
+                </Canvas>
+            </Viewbox>
+            <local:ConfidenceStatusToPathConverter x:Key="ConfidenceStatusToPathConverter" />
+            <common:ReverseBoolConverter x:Key="ReverseBoolConverter" />
+        </ResourceDictionary>
+    </UserControl.Resources>
+    
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="112"></RowDefinition>
+            <RowDefinition Height="auto"></RowDefinition>
+        </Grid.RowDefinitions>
+        <Grid Background="#ffffff"  Margin="20,0,0,0"  Panel.ZIndex="1" Height="20" HorizontalAlignment="Left" VerticalAlignment="Top">
+            <TextBlock Text="This Certificate Is Trusted to" FontWeight="Bold" FontSize="16"></TextBlock>
+        </Grid>
+        <Border Margin="12" BorderBrush="#33000000" BorderThickness="1" >
+            <StackPanel VerticalAlignment="Center" Margin="20,0,0,0">
+
+                <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                    <Canvas Height="20" Width="20">
+                        <ContentControl Content="{Binding IsTrusted, Converter={StaticResource ConfidenceStatusToPathConverter}}" />
+                    </Canvas>
+                    <TextBlock Text="Sign document or data" VerticalAlignment="Center"></TextBlock>
+                </StackPanel>
+
+                <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                    <Canvas Height="20" Width="20">
+                        <ContentControl Content="{Binding IsTrusted, Converter={StaticResource ConfidenceStatusToPathConverter}}" />
+                    </Canvas>
+                    <TextBlock Text="Certify document" VerticalAlignment="Center"></TextBlock>
+                </StackPanel>
+
+
+            </StackPanel>
+        </Border>
+        <Button Grid.Row="1" Content="Add to Trusted Certificates" IsEnabled="{Binding IsTrusted, Converter={StaticResource ReverseBoolConverter}}" Click="TrustCertificateButton_OnClick" Height="32" Width="230" HorizontalAlignment="Right" Margin="0,0,12,12"></Button>
+    </Grid>
+</UserControl>

+ 110 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/ConfidenceControl.xaml.cs

@@ -0,0 +1,110 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Globalization;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Compdfkit_Tools.DigitalSignature.CPDFSignatureListControl;
+using Compdfkit_Tools.Properties;
+using ComPDFKit.DigitalSign;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    /// <summary>
+    /// Interaction logic for ConfidenceControl.xaml
+    /// </summary>
+    public partial class ConfidenceControl : UserControl, INotifyPropertyChanged
+    {
+        public static ResourceDictionary ResourceDictionary { get; set; }
+        private bool isTrusted;
+        private CPDFSignatureCertificate cpdfCertificate;
+        
+        public event EventHandler TrustCertificateEvent;
+        public bool IsTrusted
+        {
+            get => isTrusted;
+            set => UpdateProper(ref isTrusted, value);
+        }
+        
+        public ConfidenceControl()
+        {
+            InitializeComponent();
+            DataContext = this;
+            ResourceDictionary = this.Resources;
+        }
+        
+        public void LoadConfidenceInfo(CPDFSignatureCertificate certificate)
+        {
+            cpdfCertificate = certificate;
+            VerifyCertificate();
+        }
+        
+        public void VerifyCertificate()
+        {
+            if (cpdfCertificate != null)
+            {
+                cpdfCertificate.CheckCertificateIsTrusted();
+                IsTrusted = cpdfCertificate.IsTrusted;
+            }
+        }
+        
+        public event PropertyChangedEventHandler PropertyChanged;
+        protected void UpdateProper<T>(ref T properValue,
+            T newValue,
+            [CallerMemberName] string properName = "")
+        {
+            if (object.Equals(properValue, newValue))
+                return;
+
+            properValue = newValue;
+            OnPropertyChanged(properName);
+        }
+
+        protected void OnPropertyChanged([CallerMemberName] string propertyName = "") =>
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+        
+        private void TrustCertificateButton_OnClick(object sender, RoutedEventArgs e)
+        {
+            cpdfCertificate.AddToTrustedCertificates();
+            VerifyCertificate();
+            TrustCertificateEvent?.Invoke(this, null);
+        }
+    }
+    
+    public class ConfidenceStatusToPathConverter : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            ResourceDictionary resourceDictionary = ConfidenceControl.ResourceDictionary;
+            if (value is bool isTrusted)
+            {
+                if (isTrusted)
+                {
+                    return resourceDictionary["ValidPath"];
+                    
+                }
+                else
+                {
+                    return resourceDictionary["InvalidPath"];
+                }
+            }
+            return null;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            return null;
+        }
+    }
+}

+ 44 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/SummaryControl.xaml

@@ -0,0 +1,44 @@
+<UserControl x:Class="Compdfkit_Tools.PDFControl.SummaryControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
+             mc:Ignorable="d" 
+             d:DesignHeight="160" d:DesignWidth="600">
+    <Grid>
+        <Grid Background="#ffffff"  Margin="20,0,0,0"  Panel.ZIndex="1" Height="20" HorizontalAlignment="Left" VerticalAlignment="Top">
+            <TextBlock Text="Summary" FontWeight="Bold" FontSize="16"></TextBlock>
+        </Grid>
+        <Border Margin="12" BorderBrush="#33000000" BorderThickness="1" >
+            <ScrollViewer Margin="0,10,0,0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
+                <StackPanel VerticalAlignment="Center" Margin="20,0,0,0">
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Issued to: " Foreground="Black"  FontSize="14"></TextBlock>
+                        <TextBlock Text="{Binding Award}" Foreground="#666" FontSize="14"></TextBlock>
+                    </StackPanel>
+
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Issuer: " Foreground="Black"  FontSize="14"></TextBlock>
+                        <TextBlock Text="{Binding Grantor}" Foreground="#666"  FontSize="14"></TextBlock>
+                    </StackPanel>
+
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Valid from: " Foreground="Black"  FontSize="14"></TextBlock>
+                        <TextBlock Text="{Binding ValidityFrom}" Foreground="#666"  FontSize="14"></TextBlock>
+                    </StackPanel>
+                    
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Valid to: " Foreground="Black"  FontSize="14"></TextBlock>
+                        <TextBlock Text="{Binding ValidityTo}" Foreground="#666"  FontSize="14"></TextBlock>
+                    </StackPanel>
+
+                    <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
+                        <TextBlock Text="Intended Usage: " Foreground="Black"  FontSize="14"></TextBlock>
+                        <TextBlock Text="{Binding IntendedUsage}" Foreground="#666"  FontSize="14"></TextBlock>
+                    </StackPanel>
+                </StackPanel>
+            </ScrollViewer>
+        </Border>
+    </Grid>
+</UserControl>

+ 112 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/SummaryControl.xaml.cs

@@ -0,0 +1,112 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Compdfkit_Tools.Helper;
+using ComPDFKit.DigitalSign;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    /// <summary>
+    /// Interaction logic for SummaryControl.xaml
+    /// </summary>
+    public partial class SummaryControl : UserControl,INotifyPropertyChanged
+    {
+        private string award;
+        public string Award
+        {
+            get => award;
+            set => UpdateProper(ref award, value);
+        }
+        
+        private string grantor;
+        public string Grantor
+        {
+            get => grantor;
+            set => UpdateProper(ref grantor, value);
+        }
+        
+        private string validityFrom;
+        public string ValidityFrom
+        {
+            get => validityFrom;
+            set => UpdateProper(ref validityFrom, value);
+        }
+        
+        private string validityTo;
+        public string ValidityTo
+        {
+            get => validityTo;
+            set => UpdateProper(ref validityTo, value);
+        }
+        
+        private string intendedUsage;
+        public string IntendedUsage
+        {
+            get => intendedUsage;
+            set => UpdateProper(ref intendedUsage, value);
+        }
+
+        public SummaryControl()
+        {
+            InitializeComponent();
+            DataContext = this;
+        }
+        
+        public void LoadSummaryInfo(CPDFSignatureCertificate certificate)
+        {
+            string awardText;
+            string grantorText = DictionaryValueConverter.GetGrantorFromDictionary(certificate.SubjectDict);
+            string email = DictionaryValueConverter.GetEmailFormDictionary(certificate.SubjectDict);
+            var usageList = DictionaryValueConverter.GetUsage(certificate);
+            string keyUsageText = "";
+            
+            if(email != null)
+            {
+                awardText = grantorText + " <" + email + ">";
+            }
+            else
+            {
+                awardText = grantorText;
+            }
+            
+            for(int i = 0; i < usageList.Count; i++)
+            {
+                keyUsageText += usageList[i];
+                keyUsageText += (i == usageList.Count - 1) ? "" : ", ";
+            }
+            Award = awardText;
+            Grantor = grantorText;
+            ValidityFrom = CommonHelper.GetExactDateFromString(certificate.ValidityStarts);
+            ValidityTo = CommonHelper.GetExactDateFromString(certificate.ValidityEnds);
+            IntendedUsage = keyUsageText;
+        }
+        
+        public event PropertyChangedEventHandler PropertyChanged;
+        protected void UpdateProper<T>(ref T properValue,
+            T newValue,
+            [CallerMemberName] string properName = "")
+        {
+            if (object.Equals(properValue, newValue))
+                return;
+
+            properValue = newValue;
+            OnPropertyChanged(properName);
+        }
+
+        protected void OnPropertyChanged([CallerMemberName] string propertyName = "") =>
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+    }
+}

+ 49 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/ViewCertificateDialog.xaml

@@ -0,0 +1,49 @@
+<Window x:Class="Compdfkit_Tools.PDFControl.ViewCertificateDialog"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
+        mc:Ignorable="d"
+        Title="ViewCertificationControl" Height="670" Width="820" ResizeMode="NoResize" ShowInTaskbar="False">
+    
+    <Window.Resources>
+        <local:DictionaryValueConverter x:Key="DictionaryValueConverter"/>
+    </Window.Resources>
+    
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="56"></RowDefinition>
+            <RowDefinition></RowDefinition>
+            <RowDefinition Height="56"></RowDefinition>
+        </Grid.RowDefinitions>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="240"></ColumnDefinition>
+            <ColumnDefinition></ColumnDefinition>
+        </Grid.ColumnDefinitions>
+
+        <TextBlock Grid.ColumnSpan="2" Margin="10,20,10,20" Foreground="#666666" Text="Browse digital ID files. Digital ID files are password protected. If you do not know its password, you cannot access the digital ID card."></TextBlock>
+
+        <ListView Grid.Row="1" Grid.Column="0" x:Name="CertificateListView" Margin="10,0,10,0" SelectionChanged="CertificateListView_OnSelectionChanged">
+            <ListView.ItemsPanel>
+                <ItemsPanelTemplate>
+                    <VirtualizingStackPanel Background="#FAFCFF" Margin="-5,0,0,0"/>
+                </ItemsPanelTemplate>
+            </ListView.ItemsPanel>
+
+            <ListView.ItemTemplate>
+                <DataTemplate>
+                    <Grid Name="SignatureGrid" Height="40">
+                        <TextBlock Text="{Binding SubjectDict, Converter={StaticResource DictionaryValueConverter}}" Margin="10,0,0,0" ToolTip="{Binding SubjectDict, Converter={StaticResource DictionaryValueConverter}}"/>
+                    </Grid>
+                </DataTemplate>
+            </ListView.ItemTemplate>
+        </ListView>
+        
+        <Grid Grid.Row="1" Grid.Column="1">
+            <local:CertificateInfoControl BorderBrush="#999999" Margin="0,0,10,0" BorderThickness="1" x:Name="CertificateInfoControl"></local:CertificateInfoControl>
+        </Grid>
+        
+        <Button Grid.Row="2" Grid.ColumnSpan="2" Height="32" Width="112" HorizontalAlignment="Right" Margin="10" Click="ButtonBase_OnClick">Close</Button>
+    </Grid>
+</Window>

+ 176 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/ViewCertificateDialog.xaml.cs

@@ -0,0 +1,176 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using ComPDFKit.DigitalSign;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    /// <summary>
+    /// Interaction logic for ViewCertificationControl.xaml
+    /// </summary>
+    public partial class ViewCertificateDialog : Window
+    {
+        private List<CPDFSignatureCertificate> certificateList;
+        public ViewCertificateDialog()
+        {
+            InitializeComponent();
+        }
+
+        public void InitCertificateList(CPDFSignature signature)
+        {
+            CertificateListView.ItemsSource = null;
+            certificateList = signature.SignerList.First().CertificateList;
+            CertificateListView.ItemsSource = certificateList;
+            CertificateListView.SelectedIndex = certificateList.Count - 1;
+        }
+
+        private void CertificateListView_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            int index = CertificateListView.SelectedIndex;
+            if(index >= 0)
+            {
+                CertificateInfoControl.LoadCertificateInfo(certificateList[index]);
+            }
+        }
+
+        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
+        {
+            this.Close();
+        }
+    }
+    
+    public class DictionaryValueConverter : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (value is Dictionary<string, string> dictionary)
+            {
+                return GetGrantorFromDictionary(dictionary);
+            }
+            return "Unknown Signer";
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            return null;
+        }
+        
+        public static string GetGrantorFromDictionary(Dictionary<string, string> dictionary)
+        {
+            string grantor = string.Empty;
+            dictionary.TryGetValue("CN", out grantor);
+            if (string.IsNullOrEmpty(grantor))
+            {
+                dictionary.TryGetValue("OU", out grantor);
+            }
+            if (string.IsNullOrEmpty(grantor))
+            {
+                grantor = "Unknown Signer";
+            }
+            return grantor;
+        }
+
+        public static string GetDNFromDictionary(Dictionary<string, string> dictionary)
+        {
+            List<string> dnParts = new List<string>();
+
+            if (dictionary.TryGetValue("CN", out string cn))
+            {
+                if (!string.IsNullOrEmpty(cn))
+                {
+                    dnParts.Add("CN=" + cn);
+                }
+            }
+
+            if (dictionary.TryGetValue("O", out string o))
+            {
+                if (!string.IsNullOrEmpty(o))
+                {
+                    dnParts.Add("O=" + o);
+                }
+            }
+
+            if (dictionary.TryGetValue("OU", out string ou))
+            {
+                dnParts.Add("OU=" + ou);
+            }
+
+            if (dictionary.TryGetValue("C", out string c))
+            {
+                dnParts.Add("C=" + c);
+            }
+
+            if (dictionary.TryGetValue("ST", out string st))
+            {
+                dnParts.Add("ST=" + st);
+            }
+             
+            string DN = string.Join(", ", dnParts);
+
+            return DN;
+        }
+
+
+        public static string GetEmailFormDictionary(Dictionary<string, string> dictionary)
+        {
+            string email = string.Empty;
+            dictionary.TryGetValue("emailAddress", out email);
+            return email;
+        }
+
+        public static List<string> GetUsage(CPDFSignatureCertificate certificate)
+        {
+            int usage = certificate.KeyUsage;
+            List<string> usageList = new List<string>();
+            if ((usage & 1 << 0) != 0)
+            {
+                usageList.Add("Encipher Only");
+            }
+            if ((usage & 1 << 1) != 0)
+            {
+                usageList.Add("CRL Signature");
+            }
+            if ((usage & 1 << 2) != 0)
+            {
+                usageList.Add("Certificate Signature");
+            }
+            if ((usage & 1 << 3) != 0)
+            {
+                usageList.Add("Key Agreement");
+            }
+            if ((usage & 1 << 4) != 0)
+            {
+                usageList.Add("Data Encipherment");
+            }
+            if ((usage & 1 << 5) != 0)
+            {
+                usageList.Add("Key Encipherment");
+            }
+            if ((usage & 1 << 6) != 0)
+            {
+                usageList.Add("Non Repudiation");
+            }
+            if ((usage & 1 << 7) != 0)
+            {
+                usageList.Add("Digital Signature");
+            }
+            if ((usage & 1 << 15) != 0)
+            {
+                usageList.Add("Decipher Only");
+            }
+
+            return usageList;
+        }
+    }
+}

+ 155 - 0
Demo/Examples/Compdfkit_Tools/Edit/ContentEditCOntrol/ContentEditControl.xaml

@@ -0,0 +1,155 @@
+<UserControl x:Class="Compdfkit_Tools.PDFControl.ContentEditControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
+             xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800"
+             Loaded="UserControl_Loaded"
+             Unloaded="UserControl_UnLoaded">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="../../Asset/Styles/ToggleButtonStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="../../Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="../../Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
+            </ResourceDictionary.MergedDictionaries>
+            <RoutedUICommand x:Key="Undo" Text="Undo"></RoutedUICommand>
+            <RoutedUICommand x:Key="Redo" Text="Redo"></RoutedUICommand>
+        </ResourceDictionary>
+    </UserControl.Resources>
+
+    <UserControl.InputBindings>
+        <KeyBinding Key="Z" Modifiers="Control" Command="{StaticResource Undo}"/>
+        <KeyBinding Key="Y" Modifiers="Control" Command="{StaticResource Redo}"/>
+    </UserControl.InputBindings>
+
+    <UserControl.CommandBindings>
+        <CommandBinding Command="{StaticResource Undo}" Executed="CommandBinding_Executed_Undo"/>
+        <CommandBinding Command="{StaticResource Redo}" Executed="CommandBinding_Executed_Redo"/>
+    </UserControl.CommandBindings>
+
+    <Grid x:Name="BodyGrid">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="auto"></RowDefinition>
+            <RowDefinition Height="*"></RowDefinition>
+        </Grid.RowDefinitions>
+
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="0"></ColumnDefinition>
+            <ColumnDefinition Width="0"></ColumnDefinition>
+            <ColumnDefinition Width="*"></ColumnDefinition>
+            <ColumnDefinition Width="auto"></ColumnDefinition>
+        </Grid.ColumnDefinitions>
+
+        <Border x:Name="ToolBarContainer" Height="45" Visibility="Visible" BorderThickness="1" BorderBrush="#1A000000" Background="#F2F3F5" Grid.ColumnSpan="4">
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
+                <ToggleButton Style="{StaticResource ToggleButtonStyle}" Name="PDFTextEditButton" BorderThickness="0" Padding="10,5,10,5" Click="PDFTextEditButton_Click" Width="99" Height="40">
+                    <StackPanel Orientation="Horizontal">
+                        <Path Fill="#273C62" VerticalAlignment="Center">
+                            <Path.Data>
+                                M1.25 0H0.5V0.75V13.25V14H1.25H17.75H18.5V13.25V7H17V12.5H2V1.5H12.5V0H1.25ZM11.5 5V2.5H3.5V5H5V4H6.75V10H6V11.5H9V10H8.25V4H10V5H11.5ZM15.75 
+                                3.75H13.5V2.25H15.75V0H17.25V2.25H19.5V3.75H17.25V6H15.75V3.75Z
+                            </Path.Data>
+                        </Path>
+                        <TextBlock  FontSize="12" VerticalAlignment="Center" Margin="8,0,0,0">Text</TextBlock>
+                    </StackPanel>
+                    <ToggleButton.ToolTip>
+                        <ToolTip Content="Text"></ToolTip>
+                    </ToggleButton.ToolTip>
+                </ToggleButton>
+
+                <ToggleButton Style="{StaticResource ToggleButtonStyle}" Name="PDFImageEditButton" BorderThickness="0" Padding="10,5,10,5" Margin="10,0,0,0" Click="PDFImageEditButton_Click">
+                    <StackPanel Orientation="Horizontal">
+                        <Path Fill="#273C62" VerticalAlignment="Center">
+                            <Path.Data>
+                                M1.5 0H0.75V0.75V13.25V14H1.5H18H18.75V13.25V7H17.25V12.5H17.2147L11.8718 7.81776L9.56428 10.25L5.29496 6.75L2.25 9.95948V1.5H12.75V0H1.5ZM13.5 5.25C13.5 
+                                            6.07843 12.8284 6.75 12 6.75C11.1716 6.75 10.5 6.07843 10.5 5.25C10.5 4.42157 11.1716 3.75 12 3.75C12.8284 3.75 13.5 4.42157 13.5 5.25ZM15.75 
+                                            3.75H13.5V2.25H15.75V0H17.25V2.25H19.5V3.75H17.25V6H15.75V3.75Z
+                            </Path.Data>
+                        </Path>
+                        <TextBlock  FontSize="12" VerticalAlignment="Center" Margin="8,0,0,0">Picture</TextBlock>
+                    </StackPanel>
+                    <ToggleButton.ToolTip>
+                        <ToolTip Content="Image"></ToolTip>
+                    </ToggleButton.ToolTip>
+                </ToggleButton>
+
+                <Line Height="40" Stroke="#D5D6D8" StrokeThickness="2" X1="0" Y1="10" X2="0" Y2="30" Margin="8,0,8,0" />
+
+                <Button Name="UndoBtn" Style="{StaticResource LightButtonStyle}" BorderThickness="0"  Width="40" Height="40" IsEnabled="{Binding CanUndo,Mode=OneWay}" Click="UndoBtn_Click"
+                                    Background="Transparent">
+                    <Path x:Name="UndoPath" IsEnabled="{Binding CanUndo,Mode=OneWay}">
+                        <Path.Style>
+                            <Style TargetType="Path">
+                                <Style.Triggers>
+                                    <Trigger Property="IsEnabled" Value="False">
+                                        <Setter Property="Fill" Value="LightGray"/>
+                                    </Trigger>
+                                    <Trigger Property="IsEnabled" Value="True">
+                                        <Setter Property="Fill" Value="#43474D"/>
+                                    </Trigger>
+                                </Style.Triggers>
+                            </Style>
+                        </Path.Style>
+                        <Path.Data>
+                            M1.03033 3.62131L0.5 4.15164L1.03033 4.68197L4.65164 8.30328L5.7123 7.24261L3.37132 4.90164H10.0607C11.5794 4.90164 12.8107 6.13285 12.8107 
+                                7.65164C12.8107 9.17042 11.5794 10.4016 10.0607 10.4016H2.56066V11.9016H10.0607C12.4079 11.9016 14.3107 9.99885 14.3107 7.65164C14.3107 
+                                5.30443 12.4079 3.40164 10.0607 3.40164H3.37132L5.7123 1.06066L4.65164 0L1.03033 3.62131Z
+                        </Path.Data>
+                    </Path>
+                    <Button.ToolTip>
+                        <ToolTip Content="Undo"></ToolTip>
+                    </Button.ToolTip>
+                </Button>
+                <Button Style="{StaticResource LightButtonStyle}" BorderThickness="0" Width="40" Height="40" Margin="10,0,0,0"  IsEnabled="{Binding CanRedo,Mode=OneWay}" Click="RedoBtn_Click"
+                                    Background="Transparent">
+                    <Path IsEnabled="{Binding CanRedo,Mode=OneWay}">
+                        <Path.Resources>
+                            <Style TargetType="Path">
+                                <Style.Triggers>
+                                    <Trigger Property="IsEnabled" Value="False">
+                                        <Setter Property="Fill" Value="LightGray"/>
+                                    </Trigger>
+                                    <Trigger Property="IsEnabled" Value="True">
+                                        <Setter Property="Fill" Value="#43474D"/>
+                                    </Trigger>
+                                </Style.Triggers>
+                            </Style>
+                        </Path.Resources>
+                        <Path.Data>
+                            M13.7802 3.62131L14.3105 4.15164L13.7802 4.68197L10.1589 8.30328L9.09825 7.24261L11.4392 4.90164H4.74989C3.2311 4.90164 1.99989 6.13285 
+                                1.99989 7.65164C1.99989 9.17042 3.2311 10.4016 4.74989 10.4016H12.2499V11.9016H4.74989C2.40268 11.9016 0.499887 9.99885 0.499887 
+                                7.65164C0.499887 5.30443 2.40268 3.40164 4.74989 3.40164H11.4392L9.09825 1.06066L10.1589 0L13.7802 3.62131Z
+                        </Path.Data>
+                    </Path>
+                    <Button.ToolTip>
+                        <ToolTip Content="Undo"></ToolTip>
+                    </Button.ToolTip>
+                </Button>
+
+            </StackPanel>
+        </Border>
+        <Border Grid.Row="1" Visibility="Collapsed" x:Name="BotaContainer"></Border>
+        <GridSplitter  Grid.Row="1" Name="Splitter" Grid.Column="1" Width="15" ResizeBehavior="PreviousAndNext" Visibility="Collapsed">
+            <GridSplitter.Template>
+                <ControlTemplate TargetType="{x:Type GridSplitter}">
+                    <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
+                        BorderBrush="{TemplateBinding Border.BorderBrush}"
+                        Background="{TemplateBinding Panel.Background}" >
+                        <Path Fill="Gray" VerticalAlignment="Center">
+                            <Path.Data>
+                                M15 3.75H1V2.25H15V3.75ZM15 8.75H1V7.25H15V8.75ZM1 13.75H15V12.25H1V13.75Z
+                            </Path.Data>
+                        </Path>
+                    </Border>
+                </ControlTemplate>
+            </GridSplitter.Template>
+        </GridSplitter>
+        <Border x:Name="PDFGrid" Background="#CECECE" Grid.Row="1" Grid.Column="2"></Border>
+        <Border Grid.Column="3" Name="PropertyContainer" Grid.Row="1" Visibility="Collapsed" ></Border>
+        <cpdfcommon:PageNumberControl  Grid.Column="2" Grid.Row="1" x:Name="FloatPageTool" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,20"></cpdfcommon:PageNumberControl>
+    </Grid>
+</UserControl>
+ 

+ 602 - 0
Demo/Examples/Compdfkit_Tools/Edit/ContentEditCOntrol/ContentEditControl.xaml.cs

@@ -0,0 +1,602 @@
+using ComPDFKit.PDFDocument;
+using ComPDFKit.PDFPage;
+using ComPDFKit.PDFPage.Edit;
+using Compdfkit_Tools.Edit;
+using ComPDFKitViewer;
+using ComPDFKitViewer.PdfViewer;
+using Microsoft.Win32;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Drawing;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Compdfkit_Tools.Helper;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    public partial class ContentEditControl : UserControl, INotifyPropertyChanged
+    {
+        #region Property
+        public PDFViewControl PdfViewControl = new PDFViewControl();
+        public PDFContentEditControl pdfContentEditControl = new PDFContentEditControl();
+        private CPDFDisplaySettingsControl displaySettingsControl = null;
+
+        private double[] zoomLevelList = { 1f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
+
+        private PDFEditEvent pdfTextCreateParam;
+        private PDFEditEvent lastPDFEditEvent = null;
+        private PanelState panelState = PanelState.GetInstance();
+
+        private KeyEventHandler KeyDownHandler;
+        public event PropertyChangedEventHandler PropertyChanged;
+        public ICommand CloseTabCommand;
+        public ICommand ExpandPropertyPanelCommand;
+
+        public bool CanUndo
+        {
+            get
+            {
+                if (PdfViewControl != null && PdfViewControl.PDFView != null)
+                {
+                    return PdfViewControl.PDFView.UndoManager.CanUndo;
+                }
+                return false;
+            }
+        }
+
+        public bool CanRedo
+        {
+            get
+            {
+                if (PdfViewControl != null && PdfViewControl.PDFView != null)
+                {
+                    return PdfViewControl.PDFView.UndoManager.CanRedo;
+                }
+
+                return false;
+            }
+        }
+
+        private bool CanSave
+        {
+            get
+            {
+                if (PdfViewControl != null && PdfViewControl.PDFView != null)
+                {
+                    return PdfViewControl.PDFView.UndoManager.CanSave;
+                }
+
+                return false;
+            }
+        }
+
+        public event EventHandler<bool> OnCanSaveChanged;
+        public event EventHandler OnAnnotEditHandler;
+
+        #endregion
+
+        public ContentEditControl()
+        {
+            InitializeComponent();
+            panelState.PropertyChanged += PanelState_PropertyChanged;
+        }
+        
+        private void PanelState_PropertyChanged(object sender, PropertyChangedEventArgs e)
+        {
+            if (e.PropertyName == nameof(PanelState.IsLeftPanelExpand))
+            {
+                ExpandLeftPanel(panelState.IsLeftPanelExpand);
+            }
+            else if (e.PropertyName == nameof(PanelState.RightPanel))
+            {
+                if (panelState.RightPanel == PanelState.RightPanelState.PropertyPanel)
+                {
+                    ExpandRightPropertyPanel(pdfContentEditControl, Visibility.Visible);
+                }
+                else if (panelState.RightPanel == PanelState.RightPanelState.ViewSettings)
+                {
+                    ExpandRightPropertyPanel(displaySettingsControl, Visibility.Visible);
+                }
+                else
+                {
+                    ExpandRightPropertyPanel(null, Visibility.Collapsed);
+                }
+            }
+        }
+
+        public void ClearPDFEditState(ToggleButton ignoreBtn = null)
+        {
+            List<ToggleButton> clearBtnList = new List<ToggleButton>()
+            {
+                PDFTextEditButton,
+                PDFImageEditButton
+            };
+
+            foreach (ToggleButton item in clearBtnList)
+            {
+                if (ignoreBtn == item)
+                {
+                    continue;
+                }
+                item.IsChecked = false;
+            }
+        }
+         
+        private void PDFTextEditButton_Click(object sender, RoutedEventArgs e)
+        {
+            ToggleButton senderBtn = sender as ToggleButton;
+            if (senderBtn != null && PdfViewControl != null)
+            {
+                ClearPDFEditState(senderBtn);
+                if (senderBtn.IsChecked == true)
+                {
+                    PDFEditEvent createParam = new PDFEditEvent();
+                    createParam.EditType = CPDFEditType.EditText;
+                    createParam.IsBold = false;
+                    createParam.IsItalic = false;
+                    createParam.FontSize = 14;
+                    createParam.FontName = "Helvetica";
+                    createParam.FontColor = Colors.Black;
+                    createParam.TextAlign = TextAlignType.AlignLeft;
+                    createParam.Transparency = 255;
+
+                    if (PdfViewControl.PDFView != null && PdfViewControl.PDFView.Document != null)
+                    {
+                        CPDFDocument pdfDoc = PdfViewControl.PDFView.Document;
+                        PdfViewControl.PDFView.ToolManager.EnableClickCreate = true;
+                        PdfViewControl.PDFView.ToolManager.ClickCreateWidth = 100;
+                        if (pdfDoc.PageCount > 0)
+                        {
+                            CPDFPage pdfPage = pdfDoc.PageAtIndex(0);
+                            CPDFEditPage editPage = pdfPage.GetEditPage();
+                            editPage.BeginEdit(CPDFEditType.EditText);
+                            createParam.SystemFontNameList.AddRange(editPage.GetFontList());
+                            editPage.EndEdit();
+                        }
+                    }
+                  
+                    PdfViewControl.PDFView?.SetPDFEditType(CPDFEditType.EditText);
+                    PdfViewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.EditText);
+                    PdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
+                    PdfViewControl.PDFView?.ReloadDocument();
+
+                    PdfViewControl.PDFView?.SetPDFEditParam(createParam);
+                    pdfContentEditControl.SetPDFTextEditData(createParam);
+                    panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
+                    pdfTextCreateParam = createParam;
+                }
+                else
+                {
+                    PdfViewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.None);
+                    PdfViewControl.PDFView?.SetPDFEditType(CPDFEditType.EditImage | CPDFEditType.EditText);
+                    PdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
+                    PdfViewControl.PDFView?.ReloadDocument();
+                    pdfContentEditControl.ClearContentControl();
+                    panelState.RightPanel = PanelState.RightPanelState.None;
+                }
+            }
+
+        }
+
+        private void PDFImageEditButton_Click(object sender, RoutedEventArgs e)
+        {
+            ToggleButton senderBtn = sender as ToggleButton;
+            if (senderBtn != null && PdfViewControl != null)
+            {
+                panelState.RightPanel = PanelState.RightPanelState.None;
+                senderBtn.IsChecked = false;
+                OpenFileDialog openFileDialog = new OpenFileDialog();
+                openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)|*.jpg;*.jpeg;*.png;*.bmp;";
+                if (openFileDialog.ShowDialog() == true)
+                {
+                    ClearPDFEditState(senderBtn);
+                    PdfViewControl.PDFView?.ClearSelectPDFEdit();
+                    PdfViewControl.PDFView?.SetPDFEditType(CPDFEditType.EditImage | CPDFEditType.EditText);
+                    PdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
+                    PdfViewControl.PDFView?.ReloadDocument();
+                     
+                    PdfViewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.EditImage);
+                    PdfViewControl.PDFView?.AddPDFEditImage(openFileDialog.FileName); 
+                }
+            }
+        }
+
+        public void ExpandLeftPanel(bool isExpand)
+        {
+            BotaContainer.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
+            Splitter.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
+            if (isExpand)
+            {
+                BodyGrid.ColumnDefinitions[0].Width = new GridLength(320);
+                BodyGrid.ColumnDefinitions[1].Width = new GridLength(15);
+            }
+            else
+            {
+                BodyGrid.ColumnDefinitions[0].Width = new GridLength(0);
+                BodyGrid.ColumnDefinitions[1].Width = new GridLength(0);
+            }
+        }
+
+        private void UndoBtn_Click(object sender, RoutedEventArgs e)
+        {
+            if (PdfViewControl != null && PdfViewControl.PDFView != null)
+            {
+                PdfViewControl.PDFView.UndoManager?.Undo();
+            }
+        }
+
+        private void RedoBtn_Click(object sender, RoutedEventArgs e)
+        {
+            if (PdfViewControl != null && PdfViewControl.PDFView != null)
+            {
+                PdfViewControl.PDFView.UndoManager?.Redo();
+            }
+        }
+
+        public void SetViewSettings(Visibility visibility, CPDFDisplaySettingsControl displaySettingsControl = null)
+        {
+            this.PropertyContainer.Child = displaySettingsControl;
+            this.PropertyContainer.Visibility = visibility;
+        }
+
+        public void SetBOTAContainer(CPDFBOTABarControl botaControl)
+        {
+            this.BotaContainer.Child = botaControl;
+        }
+
+        public void SetDisplaySettingsControl(CPDFDisplaySettingsControl displaySettingsControl)
+        {
+            this.displaySettingsControl = displaySettingsControl;
+        }
+
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            PdfViewControl.PDFView.PDFEditCommandHandler += PDFView_PDFEditCommandHandler;
+        }
+
+        private void UserControl_UnLoaded(object sender, RoutedEventArgs e)
+        {
+            PdfViewControl.PDFView.PDFEditCommandHandler -= PDFView_PDFEditCommandHandler;
+        }
+         
+        public void ExpandRightPropertyPanel(UIElement propertytPanel, Visibility visible)
+        {
+            PropertyContainer.Width = 260;
+            PropertyContainer.Child = propertytPanel;
+            PropertyContainer.Visibility = visible;
+        }
+
+        public void InitWithPDFViewer(CPDFViewer pdfViewer)
+        {
+            PdfViewControl.PDFView = pdfViewer;
+            PDFGrid.Child = PdfViewControl;
+            FloatPageTool.InitWithPDFViewer(pdfViewer);
+            pdfContentEditControl.InitWithPDFViewer(pdfViewer);
+            PdfViewControl.PDFView.PDFEditActiveHandler -= PDFView_PDFEditActiveHandler; 
+            PdfViewControl.PDFView.PDFEditActiveHandler += PDFView_PDFEditActiveHandler;
+            PdfViewControl.PDFView.UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
+            PdfViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
+            DataContext = this;
+        }
+
+        /// <summary>
+        /// Text and Image Selected Event
+        /// </summary>
+        private void PDFView_PDFEditActiveHandler(object sender, ComPDFKitViewer.PDFEditEvent e)
+        {
+            lastPDFEditEvent = e; 
+
+            if (e == null)
+            {
+                PropertyContainer.Child = pdfContentEditControl;
+
+                if (pdfTextCreateParam != null && PdfViewControl != null && PdfViewControl.PDFView != null)
+                {
+                    if (PdfViewControl.PDFView.GetPDFEditCreateType() == CPDFEditType.EditText)
+                    {
+                        pdfContentEditControl.SetPDFTextEditData(pdfTextCreateParam);
+                    }
+                    else if (PdfViewControl.PDFView.GetPDFEditCreateType() == CPDFEditType.None)
+                    {
+                        pdfContentEditControl.ClearContentControl();
+
+                    }
+                }
+                else
+                {
+                    pdfContentEditControl.ClearContentControl();
+                }
+                return;
+            }
+
+            if (e.EditType == CPDFEditType.EditText)
+            {
+                pdfContentEditControl.SetPDFTextEditData(e, true);
+                return;
+            }
+
+            if (e.EditType == CPDFEditType.EditImage && PdfViewControl != null)
+            {
+                UIElement pageView = sender as UIElement;
+                if (pageView != null)
+                {
+                    pageView.MouseLeftButtonUp += PageView_MouseLeftButtonUp;
+                }
+                pdfContentEditControl.SetPDFImageEditData(e);
+                return;
+            }
+        }
+
+        private void PageView_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+        {
+            UIElement pageView = sender as UIElement;
+            if (pageView != null)
+            {
+                pageView.MouseLeftButtonUp -= PageView_MouseLeftButtonUp;
+            }
+            if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
+            {
+                pdfContentEditControl.SetPDFImageEditData(lastPDFEditEvent);
+            }
+        }
+        
+        public void ClearViewerControl()
+        {
+            PDFGrid.Child = null;
+            BotaContainer.Child = null;
+            PropertyContainer.Child = null;
+            displaySettingsControl = null;
+        }
+        
+        #region Property changed
+        protected void OnPropertyChanged([CallerMemberName] string name = null)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
+        }
+
+
+        public void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
+        {
+            OnPropertyChanged(e.PropertyName);
+            if (e.PropertyName == "CanSave")
+            {
+                OnCanSaveChanged?.Invoke(this, CanSave);
+            }
+        }
+        #endregion
+
+        #region Context menu
+
+        private void PDFView_PDFEditCommandHandler(object sender, PDFEditCommand e)
+        {
+            if (e == null)
+            {
+                return;
+            }
+
+            if (e.EditType == CPDFEditType.EditText)
+            {
+                e.Handle = true;
+                PDFEditTextContextMenu(sender, e);
+            }
+
+            if (e.EditType == CPDFEditType.EditImage)
+            {
+                e.Handle = true;
+                PDFEditImageContextMenu(sender, e);
+            }
+        }
+        
+        private void PDFEditTextContextMenu(object sender, PDFEditCommand editCommand)
+        {
+            editCommand.PopupMenu = new ContextMenu();
+            if (lastPDFEditEvent != null)
+            {
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
+            }
+            else
+            {
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
+                if (editCommand.TextAreaCopied)
+                {
+                    editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste And Match Style", Command = CustomCommands.PasteMatchStyle, CommandTarget = (UIElement)sender });
+                }
+            }
+        }
+
+        private void PDFEditImageContextMenu(object sender, PDFEditCommand editCommand)
+        {
+            editCommand.PopupMenu = new ContextMenu();
+            if (lastPDFEditEvent != null)
+            {
+                MenuItem rotateLeftMenu = new MenuItem();
+                rotateLeftMenu.Header = "Left Rotate";
+                rotateLeftMenu.Click += (o, p) =>
+                {
+                    if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
+                    {
+                        lastPDFEditEvent.Rotate = -90;
+                        lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                        pdfContentEditControl.RefreshThumb();
+                    }
+                };
+                editCommand.PopupMenu.Items.Add(rotateLeftMenu);
+
+                MenuItem rotateRightMenu = new MenuItem();
+                rotateRightMenu.Header = "Right Rotate";
+                rotateRightMenu.Click += (o, p) =>
+                {
+                    if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
+                    {
+                        lastPDFEditEvent.Rotate = 90;
+                        lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                        pdfContentEditControl.RefreshThumb();
+                    }
+                };
+                editCommand.PopupMenu.Items.Add(rotateRightMenu);
+
+                MenuItem replaceMenu = new MenuItem();
+                replaceMenu.Header = "Replace";
+                replaceMenu.Click += (o, p) =>
+                {
+                    if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
+                    {
+                        OpenFileDialog openFileDialog = new OpenFileDialog();
+                        openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)|*.jpg;*.jpeg;*.png;*.bmp;";
+                        if (openFileDialog.ShowDialog() == true)
+                        {
+                            lastPDFEditEvent.ReplaceImagePath = openFileDialog.FileName;
+                            lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                            PdfViewControl.PDFView?.ClearSelectPDFEdit();
+                            pdfContentEditControl.RefreshThumb();
+                        }
+                    }
+                };
+                editCommand.PopupMenu.Items.Add(replaceMenu);
+
+                MenuItem exportMenu = new MenuItem();
+                exportMenu.Header = "Export";
+                exportMenu.Click += (o, p) =>
+                {
+                    if (PdfViewControl != null && PdfViewControl.PDFView != null)
+                    {
+                        Dictionary<int, List<Bitmap>> imageDict = PdfViewControl.PDFView.GetSelectedImages();
+                        if (imageDict != null && imageDict.Count > 0)
+                        {
+                            System.Windows.Forms.FolderBrowserDialog folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
+                            if (folderBrowser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+                            {
+                                string choosePath = folderBrowser.SelectedPath;
+                                string openPath = choosePath;
+                                foreach (int pageIndex in imageDict.Keys)
+                                {
+                                    List<Bitmap> imageList = imageDict[pageIndex];
+                                    foreach (Bitmap image in imageList)
+                                    {
+                                        string savePath = System.IO.Path.Combine(choosePath, Guid.NewGuid() + ".jpg");
+                                        image.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg);
+                                        openPath = savePath;
+                                    }
+                                }
+                                Process.Start("explorer", "/select,\"" + openPath + "\"");
+                            }
+                        }
+                    }
+                };
+                editCommand.PopupMenu.Items.Add(exportMenu);
+
+                MenuItem opacityMenu = new MenuItem();
+                opacityMenu.Header = "Opacity";
+                editCommand.PopupMenu.Items.Add(opacityMenu);
+
+                AppendOpacityMenu(opacityMenu);
+
+                MenuItem horizonMirror = new MenuItem();
+                horizonMirror.Header = "HMirror";
+                horizonMirror.Click += (o, p) =>
+                {
+                    if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
+                    {
+                        lastPDFEditEvent.HorizontalMirror = true;
+                        lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                    }
+                };
+                editCommand.PopupMenu.Items.Add(horizonMirror);
+
+                MenuItem verticalMirror = new MenuItem();
+                verticalMirror.Header = "VMirror";
+                verticalMirror.Click += (o, p) =>
+                {
+                    if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
+                    {
+                        lastPDFEditEvent.VerticalMirror = true;
+                        lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                    }
+                };
+                editCommand.PopupMenu.Items.Add(verticalMirror);
+
+                MenuItem cropMenu = new MenuItem();
+                cropMenu.Header = "Crop";
+                cropMenu.Click += (o, p) =>
+                {
+                    if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
+                    {
+                        lastPDFEditEvent.ClipImage = true;
+                        lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                    }
+                };
+                editCommand.PopupMenu.Items.Add(cropMenu);
+
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
+                if (editCommand.TextAreaCopied)
+                {
+                    editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste And Match Style", Command = CustomCommands.PasteMatchStyle, CommandTarget = (UIElement)sender });
+                }
+            }
+            else
+            {
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
+            }
+        }
+        
+        private void AppendOpacityMenu(MenuItem parentMenu)
+        {
+            List<int> opacityList = new List<int>()
+            {
+                25,50,75,100
+            };
+
+            foreach (int opacity in opacityList)
+            {
+                MenuItem opacityMenu = new MenuItem();
+                opacityMenu.Header = string.Format("{0}%", opacity);
+                opacityMenu.Click += (o, p) =>
+                {
+                    if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
+                    {
+                        lastPDFEditEvent.Transparency = (int)Math.Ceiling(opacity * 255 / 100D);
+                        lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                    }
+                };
+                parentMenu.Items.Add(opacityMenu);
+            }
+        }
+
+        #endregion
+        private void CommandBinding_Executed_Undo(object sender, ExecutedRoutedEventArgs e)
+        {
+            if (PdfViewControl != null && PdfViewControl.PDFView != null && CanUndo)
+            {
+                PdfViewControl.PDFView.UndoManager?.Undo();
+            }
+        }
+
+        private void CommandBinding_Executed_Redo(object sender, ExecutedRoutedEventArgs e)
+        {
+            if (PdfViewControl != null && PdfViewControl.PDFView != null && CanRedo)
+            {
+                PdfViewControl.PDFView.UndoManager?.Redo();
+            }
+        }
+    }
+}

+ 1 - 1
Demo/Examples/Compdfkit_Tools/Edit/PDFImageEdit/PDFImageEditControl/PDFImageEditControl.xaml.cs

@@ -236,7 +236,7 @@ namespace Compdfkit_Tools.Edit
         public void SetImageTransparency(double transparency)
         {
             ImasgeOpacitySlider.Value = transparency / 255D;
-            OpacityTextBox.Text = string.Format("{0}%", (int)(Math.Ceiling(ImasgeOpacitySlider.Value * 100)));
+            OpacityTextBox.Text = string.Format("{0}%", (int)(Math.Round(ImasgeOpacitySlider.Value * 100)));
         }
     }
 }

+ 121 - 0
Demo/Examples/Compdfkit_Tools/Form/FormControl/FormControl.xaml

@@ -0,0 +1,121 @@
+<UserControl x:Class="Compdfkit_Tools.PDFControl.FormControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             mc:Ignorable="d" 
+             xmlns:cpdftools="clr-namespace:Compdfkit_Tools.PDFControl"
+             xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common"
+             Loaded="UserControl_Loaded"
+             Unloaded="UserControl_Unloaded"
+             d:DesignHeight="720" d:DesignWidth="1080">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="../../Asset/Styles/ToggleButtonStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="../../Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="../../Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
+            </ResourceDictionary.MergedDictionaries>
+            <RoutedUICommand x:Key="Undo" Text="Undo"></RoutedUICommand>
+            <RoutedUICommand x:Key="Redo" Text="Redo"></RoutedUICommand>
+        </ResourceDictionary>
+    </UserControl.Resources>
+
+    <UserControl.InputBindings>
+        <KeyBinding Key="Z" Modifiers="Control" Command="{StaticResource Undo}"/>
+        <KeyBinding Key="Y" Modifiers="Control" Command="{StaticResource Redo}"/>
+    </UserControl.InputBindings>
+
+    <UserControl.CommandBindings>
+        <CommandBinding Command="{StaticResource Undo}" Executed="CommandBinding_Executed_Undo"/>
+        <CommandBinding Command="{StaticResource Redo}" Executed="CommandBinding_Executed_Redo"/>
+    </UserControl.CommandBindings>
+
+    <Grid Name="BodyGrid">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="auto"/>
+            <RowDefinition Height="*"/>
+        </Grid.RowDefinitions>
+        <Grid.ColumnDefinitions>             
+            <ColumnDefinition Width="0"></ColumnDefinition>
+            <ColumnDefinition Width="0"></ColumnDefinition>
+            <ColumnDefinition Width="*"></ColumnDefinition>
+            <ColumnDefinition Width="auto"></ColumnDefinition>
+        </Grid.ColumnDefinitions>
+        <Border x:Name="ToolBarContainer" Height="45" Visibility="Visible" BorderThickness="1" BorderBrush="#1A000000" Background="#F2F3F5" Grid.ColumnSpan="4">
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
+                <cpdftools:CPDFFormBarControl x:Name="PDFFormTool"  Grid.ColumnSpan="4" Height="44"/>
+                <Line Height="40" Stroke="#D5D6D8" StrokeThickness="2" X1="0" Y1="10" X2="0" Y2="30" Margin="8,0,8,0" />
+                <Button Name="UndoBtn" Style="{StaticResource LightButtonStyle}" BorderThickness="0"  Width="40" Height="40" IsEnabled="{Binding CanUndo,Mode=OneWay }" Click="UndoButton_Click" 
+                            Background="Transparent">
+                    <Path x:Name="UndoPath" IsEnabled="{Binding CanUndo,Mode=OneWay}">
+                        <Path.Style>
+                            <Style TargetType="Path">
+                                <Style.Triggers>
+                                    <Trigger Property="IsEnabled" Value="False">
+                                        <Setter Property="Fill" Value="LightGray"/>
+                                    </Trigger>
+                                    <Trigger Property="IsEnabled" Value="True">
+                                        <Setter Property="Fill" Value="#43474D"/>
+                                    </Trigger>
+                                </Style.Triggers>
+                            </Style>
+                        </Path.Style>
+                        <Path.Data>
+                            M1.03033 3.62131L0.5 4.15164L1.03033 4.68197L4.65164 8.30328L5.7123 7.24261L3.37132 4.90164H10.0607C11.5794 4.90164 12.8107 6.13285 12.8107 
+                        7.65164C12.8107 9.17042 11.5794 10.4016 10.0607 10.4016H2.56066V11.9016H10.0607C12.4079 11.9016 14.3107 9.99885 14.3107 7.65164C14.3107 
+                        5.30443 12.4079 3.40164 10.0607 3.40164H3.37132L5.7123 1.06066L4.65164 0L1.03033 3.62131Z
+                        </Path.Data>
+                    </Path>
+                    <Button.ToolTip>
+                        <ToolTip Content="Undo"></ToolTip>
+                    </Button.ToolTip>
+                </Button>
+                <Button Style="{StaticResource LightButtonStyle}" BorderThickness="0" Width="40" Height="40" Margin="10,0,0,0"  IsEnabled="{Binding CanRedo,Mode=OneWay}" Click="RedoButton_Click"
+                            Background="Transparent">
+                    <Path IsEnabled="{Binding CanRedo,Mode=OneWay}">
+                        <Path.Resources>
+                            <Style TargetType="Path">
+                                <Style.Triggers>
+                                    <Trigger Property="IsEnabled" Value="False">
+                                        <Setter Property="Fill" Value="LightGray"/>
+                                    </Trigger>
+                                    <Trigger Property="IsEnabled" Value="True">
+                                        <Setter Property="Fill" Value="#43474D"/>
+                                    </Trigger>
+                                </Style.Triggers>
+                            </Style>
+                        </Path.Resources>
+                        <Path.Data>
+                            M13.7802 3.62131L14.3105 4.15164L13.7802 4.68197L10.1589 8.30328L9.09825 7.24261L11.4392 4.90164H4.74989C3.2311 4.90164 1.99989 6.13285 
+                        1.99989 7.65164C1.99989 9.17042 3.2311 10.4016 4.74989 10.4016H12.2499V11.9016H4.74989C2.40268 11.9016 0.499887 9.99885 0.499887 
+                        7.65164C0.499887 5.30443 2.40268 3.40164 4.74989 3.40164H11.4392L9.09825 1.06066L10.1589 0L13.7802 3.62131Z
+                        </Path.Data>
+                    </Path>
+                    <Button.ToolTip>
+                        <ToolTip Content="Redo"></ToolTip>
+                    </Button.ToolTip>
+                </Button>
+            </StackPanel>
+        </Border>
+        <Border Grid.Row="1" Visibility="Collapsed" Name="BotaContainer"></Border>
+        <GridSplitter  Grid.Row="1" Name="Splitter" Grid.Column="1" Width="15" ResizeBehavior="PreviousAndNext" Visibility="Collapsed">
+            <GridSplitter.Template>
+                <ControlTemplate TargetType="{x:Type GridSplitter}">
+                    <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
+                            BorderBrush="{TemplateBinding Border.BorderBrush}"
+                            Background="{TemplateBinding Panel.Background}" >
+                        <Path Fill="Gray" VerticalAlignment="Center">
+                            <Path.Data>
+                                M15 3.75H1V2.25H15V3.75ZM15 8.75H1V7.25H15V8.75ZM1 13.75H15V12.25H1V13.75Z
+                            </Path.Data>
+                        </Path>
+                    </Border>
+                </ControlTemplate>
+            </GridSplitter.Template>
+        </GridSplitter>
+        <Border x:Name="PDFGrid" Background="#CECECE" Grid.Row="1" Grid.Column="2"></Border>
+        <Border Grid.Column="3" Name="PropertyContainer" Grid.Row="1" Visibility="Collapsed" ></Border>
+        <cpdfcommon:PageNumberControl  Grid.Column="2" Grid.Row="1" x:Name="FloatPageTool" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,20"></cpdfcommon:PageNumberControl>
+        </Grid>
+</UserControl>

+ 540 - 0
Demo/Examples/Compdfkit_Tools/Form/FormControl/FormControl.xaml.cs

@@ -0,0 +1,540 @@
+using ComPDFKitViewer.PdfViewer;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Drawing;
+using System.IO;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using ComPDFKitViewer;
+using ComPDFKitViewer.AnnotEvent;
+using Compdfkit_Tools.Helper;
+using Path = System.Windows.Shapes.Path;
+
+namespace Compdfkit_Tools.PDFControl
+{
+    public partial class FormControl : UserControl, INotifyPropertyChanged
+    {
+        #region Property
+
+        public PDFViewControl PdfViewControl = new PDFViewControl();
+        public FromPropertyControl FromPropertyControl = new FromPropertyControl();
+        private double[] zoomLevelList = { 1f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
+        public event PropertyChangedEventHandler PropertyChanged;
+        private CPDFDisplaySettingsControl displaySettingsControl;
+
+        private PanelState panelState = PanelState.GetInstance();
+
+        public bool CanUndo
+        {
+            get
+            {
+                if (PdfViewControl != null && PdfViewControl.PDFView != null)
+                {
+                    return PdfViewControl.PDFView.UndoManager.CanUndo;
+                }
+                return false;
+            }
+        }
+
+        public bool CanRedo
+        {
+            get
+            {
+                if (PdfViewControl != null && PdfViewControl.PDFView != null)
+                {
+                    return PdfViewControl.PDFView.UndoManager.CanRedo;
+                }
+
+                return false; 
+            }
+        }
+        public bool CanSave
+        {
+            get
+            {
+                if (PdfViewControl != null && PdfViewControl.PDFView != null)
+                {
+                    return PdfViewControl.PDFView.UndoManager.CanSave;
+                }
+
+                return false;
+            }
+        }
+
+        public event EventHandler<bool> OnCanSaveChanged;
+        public event EventHandler OnAnnotEditHandler;
+
+        #endregion
+
+        public FormControl()
+        {
+            InitializeComponent();
+            DataContext = this;
+        }
+        
+        #region Load Unload custom control
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            InitialPDFViewControl(PdfViewControl);
+            PdfViewControl.PDFView.AnnotCommandHandler += PDFView_AnnotCommandHandler;
+        }
+         
+        private void UserControl_Unloaded(object sender, RoutedEventArgs e)
+        {
+            PdfViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
+        }
+
+        #endregion
+
+        #region Expand and collapse Panel
+
+        public void ExpandRightPropertyPanel(UIElement propertytPanel, Visibility visible)
+        {
+            PropertyContainer.Width = 260;
+            PropertyContainer.Child = propertytPanel;
+            PropertyContainer.Visibility = visible; 
+        }
+
+        public void ExpandLeftPanel(bool isExpand)
+        {
+            BotaContainer.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
+            Splitter.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
+            if (isExpand)
+            {
+                BodyGrid.ColumnDefinitions[0].Width = new GridLength(320);
+                BodyGrid.ColumnDefinitions[1].Width = new GridLength(15);
+            }
+            else
+            {
+                BodyGrid.ColumnDefinitions[0].Width = new GridLength(0);
+                BodyGrid.ColumnDefinitions[1].Width = new GridLength(0);
+            }
+        }
+
+        #endregion
+
+        #region Private Command Method
+        private void PDFView_WidgetClickHandler(object sender, WidgetArgs e)
+        {
+            if (e is WidgetSignArgs)
+            {
+                panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
+            }
+            else
+            {
+                panelState.RightPanel = PanelState.RightPanelState.None;
+            }
+        }
+
+        private void PDFView_AnnotActiveHandler(object sender, AnnotAttribEvent e)
+        {
+            if (e == null || e.IsAnnotCreateReset)
+            {
+                FromPropertyControl.SetPropertyForType(null, null);
+            }
+            else
+            {
+                switch (e.GetAnnotTypes())
+                {
+                    case AnnotArgsType.WidgetViewForm:
+                        WidgetArgs formArgs = e.GetAnnotHandlerEventArgs(AnnotArgsType.WidgetViewForm).First() as WidgetArgs;
+                        switch (formArgs.WidgetType)
+                        {
+                            case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_PUSHBUTTON:
+                            case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_COMBOBOX:
+                            case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_LISTBOX:
+                                panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
+                                break;
+                            default:
+                                break;
+                        }
+                        FromPropertyControl.SetPropertyForType(formArgs, e);
+                        break;
+                }
+            }
+        }
+
+        private string GetTime()
+        {
+            DateTime dateTime = DateTime.Now;
+            return " " + dateTime.ToString("yyyy-MM-dd HH:mm:ss.fff");
+        }
+
+        private void PDFView_AnnotEditHandler(object sender, List<AnnotEditEvent> e)
+        {
+            if (e != null && e.Count > 0)
+            {
+                AnnotEditEvent editEvent = e[e.Count - 1];
+                if (editEvent.EditAction == ActionType.Add)
+                {
+                    if (PdfViewControl.PDFView.ToolManager.CurrentAnnotArgs != null)
+                    {
+                        WidgetArgs widgetArgs = PdfViewControl.PDFView.ToolManager.CurrentAnnotArgs as WidgetArgs;
+                        if (widgetArgs != null)
+                        {
+                            switch (widgetArgs.WidgetType)
+                            {
+                                case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_PUSHBUTTON:
+                                    widgetArgs.FieldName = "Button" + GetTime();
+                                    break;
+                                case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_CHECKBOX:
+                                    widgetArgs.FieldName = "Checkbox" + GetTime();
+                                    break;
+                                case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_RADIOBUTTON:
+                                    widgetArgs.FieldName = "Radio button" + GetTime();
+                                    break;
+                                case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_TEXTFIELD:
+                                    widgetArgs.FieldName = "Text" + GetTime();
+                                    break;
+                                case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_COMBOBOX:
+                                    widgetArgs.FieldName = "Combobox" + GetTime();
+                                    break;
+                                case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_LISTBOX:
+                                    widgetArgs.FieldName = "List" + GetTime();
+                                    break;
+                                case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS:
+                                    widgetArgs.FieldName = "Signature" + GetTime();
+                                    break;
+                                case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_UNKNOWN:
+                                    break;
+                                default:
+                                    break;
+                            }
+                        }
+                    }
+                    PdfViewControl.PDFView.SelectAnnotation(editEvent.PageIndex, editEvent.AnnotIndex);
+                }
+                else if (editEvent.EditAction == ActionType.Del)
+                {
+                    FromPropertyControl.CleanProperty();
+                }
+            }
+        }
+        
+        private void PDFView_AnnotCommandHandler(object sender, AnnotCommandArgs e)
+        {
+            if (e != null && e.CommandType == CommandType.Context)
+            {
+                if (e.PressOnSelectedText)
+                {
+                    e.Handle = true;
+                    e.PopupMenu = new ContextMenu();
+                    e.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
+                }
+                else if (e.CommandTarget == TargetType.ImageSelection)
+                {
+                    if (PdfViewControl != null && PdfViewControl.PDFView != null && PdfViewControl.PDFView.GetSelectImageCount() > 0)
+                    {
+                        e.Handle = true;
+                        e.PopupMenu = new ContextMenu();
+
+                        MenuItem imageCopyMenu = new MenuItem();
+                        imageCopyMenu = new MenuItem();
+                        imageCopyMenu.Header = "Copy Images";
+                        WeakEventManager<MenuItem, RoutedEventArgs>.AddHandler(imageCopyMenu, "Click", CopyImage_Click);
+                        imageCopyMenu.CommandParameter = e;
+                        e.PopupMenu.Items.Add(imageCopyMenu);
+
+                        MenuItem imageExtraMenu = new MenuItem();
+                        imageExtraMenu = new MenuItem();
+                        imageExtraMenu.Header = "Extract Images";
+                        WeakEventManager<MenuItem, RoutedEventArgs>.AddHandler(imageExtraMenu, "Click", ExtraImage_Click);
+                        imageExtraMenu.CommandParameter = e;
+                        e.PopupMenu.Items.Add(imageExtraMenu);
+                    }
+                }
+                else if (e.CommandTarget == TargetType.WidgetView)
+                {
+                    e.Handle = true;
+                    e.PopupMenu = new ContextMenu();
+                    e.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
+                    e.PopupMenu.Items.Add(new MenuItem() { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
+                    e.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
+                }
+                else
+                {
+                    e.Handle = true;
+                    e.PopupMenu = new ContextMenu();
+
+                    e.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
+                    e.PopupMenu.Items.Add(new Separator());
+
+                    MenuItem fitWidthMenu = new MenuItem();
+                    fitWidthMenu.Header = "Automatically Resize";
+                    fitWidthMenu.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            PdfViewControl.PDFView?.ChangeFitMode(FitMode.FitWidth);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(fitWidthMenu);
+
+                    MenuItem fitSizeMenu = new MenuItem();
+                    fitSizeMenu.Header = "Actual Size";
+                    fitSizeMenu.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            PdfViewControl.PDFView?.ChangeFitMode(FitMode.FitSize);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(fitSizeMenu);
+
+                    MenuItem zoomInMenu = new MenuItem();
+                    zoomInMenu.Header = "Zoom In";
+                    zoomInMenu.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            double newZoom = CommandHelper.CheckZoomLevel(zoomLevelList,PdfViewControl.PDFView.ZoomFactor + 0.01, true);
+                            PdfViewControl.PDFView?.Zoom(newZoom);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(zoomInMenu);
+
+                    MenuItem zoomOutMenu = new MenuItem();
+                    zoomOutMenu.Header = "Zoom Out";
+                    zoomOutMenu.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            double newZoom = CommandHelper.CheckZoomLevel(zoomLevelList,PdfViewControl.PDFView.ZoomFactor - 0.01, false);
+                            PdfViewControl.PDFView?.Zoom(newZoom);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(zoomOutMenu);
+                    e.PopupMenu.Items.Add(new Separator());
+
+                    MenuItem singleView = new MenuItem();
+                    singleView.Header = "Single Page";
+                    singleView.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            PdfViewControl.PDFView?.ChangeViewMode(ViewMode.Single);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(singleView);
+
+                    MenuItem singleContinuousView = new MenuItem();
+                    singleContinuousView.Header = "Single Page Continuous";
+                    singleContinuousView.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            PdfViewControl.PDFView?.ChangeViewMode(ViewMode.SingleContinuous);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(singleContinuousView);
+
+                    MenuItem doubleView = new MenuItem();
+                    doubleView.Header = "Two Pages";
+                    doubleView.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            PdfViewControl.PDFView?.ChangeViewMode(ViewMode.Double);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(doubleView);
+
+                    MenuItem doubleContinuousView = new MenuItem();
+                    doubleContinuousView.Header = "Two Pages Continuous";
+                    doubleContinuousView.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            PdfViewControl.PDFView?.ChangeViewMode(ViewMode.DoubleContinuous);
+                        }
+                    };
+                    e.PopupMenu.Items.Add(doubleContinuousView);
+
+                    MenuItem resetFormMenu = new MenuItem();
+                    resetFormMenu.Header = "Reset Forms";
+                    resetFormMenu.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            PdfViewControl.PDFView?.ResetForm(null);
+                        }
+                    };
+                    e.PopupMenu.Items.Add(new Separator());
+                    e.PopupMenu.Items.Add(resetFormMenu);
+                }
+            }
+            else
+            {
+                e.DoCommand();
+            }
+        }
+
+        private void CopyImage_Click(object sender, RoutedEventArgs e)
+        {
+            CommandHelper.CopyImage_Click(PdfViewControl.PDFView.GetSelectedImages());
+        }
+
+        private void ExtraImage_Click(object sender, RoutedEventArgs e)
+        {
+            CommandHelper.ExtraImage_Click(PdfViewControl.PDFView.GetSelectedImages());
+        }
+
+        private void UndoButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (PdfViewControl != null && PdfViewControl.PDFView != null)
+            {
+                PdfViewControl.PDFView.UndoManager?.Undo();
+            }
+        }
+
+        private void RedoButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (PdfViewControl != null && PdfViewControl.PDFView != null)
+            {
+                PdfViewControl.PDFView.UndoManager?.Redo();
+            }
+        }
+
+        private void CommandBinding_Executed_Undo(object sender, ExecutedRoutedEventArgs e)
+        {
+            if (PdfViewControl != null && PdfViewControl.PDFView != null && CanUndo)
+            {
+                PdfViewControl.PDFView.UndoManager?.Undo();
+            }
+        }
+
+        private void CommandBinding_Executed_Redo(object sender, ExecutedRoutedEventArgs e)
+        {
+            if (PdfViewControl != null && PdfViewControl.PDFView != null && CanRedo)
+            {
+                PdfViewControl.PDFView.UndoManager?.Redo();
+            }
+        }
+        
+        protected void OnPropertyChanged([CallerMemberName] string name = null)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
+        }
+
+        private void PanelState_PropertyChanged(object sender, PropertyChangedEventArgs e)
+        {
+            if (e.PropertyName == nameof(PanelState.IsLeftPanelExpand))
+            {
+                ExpandLeftPanel(panelState.IsLeftPanelExpand);
+            }
+            else if (e.PropertyName == nameof(PanelState.RightPanel))
+            {
+                if (panelState.RightPanel == PanelState.RightPanelState.PropertyPanel)
+                {
+                    ExpandRightPropertyPanel(FromPropertyControl, Visibility.Visible);
+                }
+                else if (panelState.RightPanel == PanelState.RightPanelState.ViewSettings)
+                {
+                    ExpandRightPropertyPanel(displaySettingsControl, Visibility.Visible);
+                }
+                else
+                {
+                    ExpandRightPropertyPanel(null, Visibility.Collapsed); 
+                }
+            }
+        }
+        
+        private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
+        {
+            OnPropertyChanged(e.PropertyName);
+            if (e.PropertyName == "CanSave")
+            {
+                OnCanSaveChanged?.Invoke(this, CanSave);
+            }
+        }
+        #endregion
+
+        #region Public Method
+
+        public void InitWithPDFViewer(CPDFViewer pdfViewer)
+        {
+            PdfViewControl.PDFView = pdfViewer;
+            PDFFormTool.InitWithPDFViewer(pdfViewer, FromPropertyControl);
+            FloatPageTool.InitWithPDFViewer(pdfViewer);
+            PDFGrid.Child = PdfViewControl;
+
+            panelState.PropertyChanged -= PanelState_PropertyChanged; 
+            panelState.PropertyChanged += PanelState_PropertyChanged; 
+        }
+
+        public void SetBOTAContainer(CPDFBOTABarControl botaControl)
+        {
+            this.BotaContainer.Child = botaControl;
+        }
+        
+        public void SetDisplaySettingsControl(CPDFDisplaySettingsControl displaySettingsControl)
+        {
+            this.displaySettingsControl = displaySettingsControl;
+        }
+
+        public void ClearAllToolState()
+        {
+            this.PDFFormTool.ClearAllToolState();
+        }
+
+        public void SetToolBarContainerVisibility(Visibility visibility)
+        {
+            this.ToolBarContainer.Visibility = visibility;
+        }
+        
+        public void InitialPDFViewControl(PDFViewControl newPDFViewer)
+        {
+            PDFFormTool.InitWithPDFViewer(newPDFViewer.PDFView, FromPropertyControl);
+            FromPropertyControl.SetPDFViewer(newPDFViewer.PDFView);
+            PDFFormTool.ClearAllToolState();
+            newPDFViewer.PDFView.AnnotEditHandler -= PDFView_AnnotEditHandler;
+            newPDFViewer.PDFView.AnnotActiveHandler -= PDFView_AnnotActiveHandler;
+            newPDFViewer.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
+            PdfViewControl.PDFView.UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
+            PdfViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
+            newPDFViewer.PDFView.AnnotEditHandler += PDFView_AnnotEditHandler;
+            newPDFViewer.PDFView.AnnotActiveHandler += PDFView_AnnotActiveHandler;
+            newPDFViewer.PDFView.WidgetClickHandler += PDFView_WidgetClickHandler;
+            newPDFViewer.CustomSignHandle = true;
+        }
+
+        public void UnloadEvent()
+        {
+            PdfViewControl.PDFView.AnnotEditHandler -= PDFView_AnnotEditHandler;
+            PdfViewControl.PDFView.AnnotActiveHandler -= PDFView_AnnotActiveHandler;
+            PdfViewControl.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
+            //panelState.PropertyChanged -= PanelState_PropertyChanged;
+        }
+
+        public void ClearViewerControl()
+        {
+            PDFGrid.Child = null;
+            BotaContainer.Child = null;
+            PropertyContainer.Child = null;
+            displaySettingsControl = null;
+        }
+
+        #endregion
+
+        
+    }
+}

+ 1 - 1
Demo/Examples/Compdfkit_Tools/Form/FromPropertyControl.xaml.cs

@@ -28,7 +28,7 @@ namespace Compdfkit_Tools.PDFControl
                 SetAnnotationPanel(currentPanel);
                 return;
             }
-            switch (Args.WidgeType)
+            switch (Args.WidgetType)
             {
                 case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_PUSHBUTTON:
                     PushButtonProperty pushButtonProperty = new PushButtonProperty();

+ 1 - 3
Demo/Examples/Compdfkit_Tools/Form/Property/CheckBoxProperty.xaml

@@ -3,12 +3,10 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-             xmlns:local="Compdfkit_Tools.PDFControl.Property" 
              xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common"
              mc:Ignorable="d" 
              Loaded="UserControl_Loaded"
-             Unloaded="UserControl_Unloaded"
-            >
+             Unloaded="UserControl_Unloaded">
     <UserControl.Resources>
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>

+ 2 - 1
Demo/Examples/Compdfkit_Tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFDisplaySettingsControl.xaml

@@ -6,7 +6,8 @@
              xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
              xmlns:pdftoolsui="clr-namespace:Compdfkit_Tools.PDFControlUI"
              mc:Ignorable="d" 
-             d:DesignHeight="450" d:DesignWidth="800" Width="260">
+             d:DesignHeight="450" d:DesignWidth="800" Width="260"
+             Background="#ffffff">
     <Grid>
         <Grid.RowDefinitions>
             <RowDefinition Height="auto"></RowDefinition>

+ 1 - 0
Demo/Examples/Compdfkit_Tools/PDFView/PDFInfo/CPDFInfoControl.xaml

@@ -13,3 +13,4 @@
         </StackPanel>
     </Grid>
 </UserControl>
+ 

+ 7 - 0
Demo/Examples/Compdfkit_Tools/PDFView/PDFInfo/CPDFInfoControl.xaml.cs

@@ -1,4 +1,5 @@
 using ComPDFKitViewer.PdfViewer;
+using System;
 using System.Windows.Controls;
 
 namespace Compdfkit_Tools.PDFControl
@@ -7,6 +8,8 @@ namespace Compdfkit_Tools.PDFControl
     {
         public CPDFViewer pdfViewer;
 
+        public event EventHandler CloseInfoEvent;
+
         public CPDFInfoControl()
         {
             InitializeComponent();
@@ -20,5 +23,9 @@ namespace Compdfkit_Tools.PDFControl
             CPDFCreateInfoControl.InitWithPDFViewer(pdfViewer);
             CPDFSecurityInfoControl.InitWithPDFViewer(pdfViewer);
         }
+        private void CloseInfoButton_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            CloseInfoEvent?.Invoke(this, new EventArgs());
+        }
     }
 }

+ 7 - 2
Demo/Examples/Compdfkit_Tools/PDFView/PDFThumbnail/PDFThumbnailControl/CPdfThumbnailControl.xaml.cs

@@ -91,14 +91,13 @@ namespace Compdfkit_Tools.PDFControl
             pdfView.RenderCompleted += PdfView_RenderCompleted;
             PopulateThumbnailList();
             LoadVisibleThumbs();
-            SelectThumbItem(pdfView.CurrentIndex);
         }
 
         private void PdfView_RenderCompleted(object sender, KeyValuePair<string, object> e)
         {
             if (e.Key == "RenderNum")
             {
-                SelectThumbItem(pdfView.CurrentIndex);
+                SelectThumbItemWithoutGoTo(pdfView.CurrentIndex);
             }
         }
 
@@ -118,6 +117,12 @@ namespace Compdfkit_Tools.PDFControl
             ThumbControl?.SelectItem(newIndex);
         }
 
+
+        public void SelectThumbItemWithoutGoTo(int newIndex)
+        {
+            ThumbControl?.SelectItemWithoutGoTo(newIndex);
+        }
+
         private void PopulateThumbnailList()
         {
             int thumbnailWidth = thumbnailSize[zoomLevel];

+ 1 - 1
Demo/Examples/Compdfkit_Tools/PDFView/PDFThumbnail/PDFThumbnailUI/CPdfThumbnailUI.xaml

@@ -16,7 +16,7 @@
     </UserControl.Resources>
     <Grid>
         <ListBox Name="ThumbListBox" SelectionChanged="ThumbListBox_SelectionChanged" SelectionMode="Single" ScrollViewer.ScrollChanged="ThumbListBox_ScrollChanged" BorderThickness="0"
-                 ScrollViewer.VerticalScrollBarVisibility="Hidden">
+                 ScrollViewer.VerticalScrollBarVisibility="Auto">
             <ListBox.Resources>
                 <Style TargetType="ListBoxItem" BasedOn="{StaticResource ThumbnailListBoxItemStyle}"/>
             </ListBox.Resources>

+ 30 - 1
Demo/Examples/Compdfkit_Tools/PDFView/PDFThumbnail/PDFThumbnailUI/CPdfThumbnailUI.xaml.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Runtime.CompilerServices;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Media;
@@ -18,6 +19,8 @@ namespace Compdfkit_Tools.PDFControlUI
         /// </summary>
         public event EventHandler<ScrollChangedEventArgs> ViewChanged;
 
+        private bool lockGoToPage;
+
         /// <summary>
         /// A list of thumbnail results
         /// </summary>
@@ -32,7 +35,14 @@ namespace Compdfkit_Tools.PDFControlUI
         /// </summary>
         private void ThumbListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
-            SelectionChanged?.Invoke(this, ThumbListBox.SelectedIndex);
+            if (!lockGoToPage)
+            {
+                SelectionChanged?.Invoke(this, ThumbListBox.SelectedIndex);
+            }
+            else
+            {
+                lockGoToPage = false;
+            }
         }
 
         /// <summary>
@@ -125,8 +135,27 @@ namespace Compdfkit_Tools.PDFControlUI
                 ThumbListBox.SelectedIndex = checkIndex;
             }
         }
+
+        /// <summary>
+        /// Select an object
+        /// </summary>
+        public void SelectItemWithoutGoTo(int checkIndex)
+        {
+            if (ThumbListBox != null && thumbResultList != null && thumbResultList.Count > checkIndex && checkIndex >= 0)
+            {
+                ThumbnailItem thumbItem = thumbResultList[checkIndex];
+                if (IsItemVisible(thumbItem) == false)
+                {
+                    ThumbListBox.ScrollIntoView(thumbItem);
+                }
+                lockGoToPage = true;
+                ThumbListBox.SelectedIndex = checkIndex;
+            }
+        }
+
     }
 
+
     /// <summary>
     /// Thumbnail object
     /// </summary>

+ 8 - 43
Demo/Examples/Compdfkit_Tools/PDFView/PDFViewControl/PDFViewControl.xaml.cs

@@ -20,12 +20,13 @@ namespace Compdfkit_Tools.PDFControl
 {
     public partial class PDFViewControl : UserControl
     {
-        public CPDFViewer PDFView { get; private set; }
+        #region Properties
+        public CPDFViewer PDFView { get; set; }
 
         public bool CustomSignHandle { get; set; }
 
         private double[] zoomLevelList = { 1f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
-
+        #endregion
         public PDFViewControl()
         {
             InitializeComponent();
@@ -33,49 +34,9 @@ namespace Compdfkit_Tools.PDFControl
             Content = PDFView;
             PDFView.MouseWheelZoomHandler += PDFView_MouseWheelZoomHandler;
             PDFView.PDFActionHandler += PDFView_PDFActionHandler;
-            PDFView.WidgetClickHandler += PDFView_WidgetClickHandler;
-        }
-
-        private void PDFView_WidgetClickHandler(object sender, WidgetArgs e)
-        {
-            if ((e is WidgetSignArgs) && CustomSignHandle == false)
-            {
-                try
-                {
-                    WidgetSignArgs signArgs = (WidgetSignArgs)e;
-
-                    OpenFileDialog openFileDialog = new OpenFileDialog();
-                    openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)|*.jpg;*.jpeg;*.png;*.bmp;";
-                    if (openFileDialog.ShowDialog() == true)
-                    {
-                        string ImagePath = openFileDialog.FileName;
-                        using (FileStream fileData = File.OpenRead(ImagePath))
-                        {
-                            string fileExt = System.IO.Path.GetExtension(ImagePath).ToLower();
-                            BitmapFrame frame = null;
-                            BitmapDecoder decoder = BitmapDecoder.Create(fileData, BitmapCreateOptions.None, BitmapCacheOption.Default);
-                            if (decoder != null && decoder.Frames.Count > 0)
-                            {
-                                frame = decoder.Frames[0];
-                            }
-                            if (frame != null)
-                            {
-                                byte[] ImageArray = new byte[frame.PixelWidth * frame.PixelHeight * 4];
-                                int ImageWidth = frame.PixelWidth;
-                                int ImageHeight = frame.PixelHeight;
-                                frame.CopyPixels(ImageArray, frame.PixelWidth * 4, 0);
-                                signArgs.UpdateApWithImage(ImageArray, ImageWidth, ImageHeight, C_Scale_Type.fitCenter, 0);
-                            }
-                        }
-                    }
-                }
-                catch (Exception ex)
-                {
-
-                }
-            }
         }
 
+        #region Private Command Methods
         private void PDFView_PDFActionHandler(object sender, CPDFAction pdfAction)
         {
             if (pdfAction != null)
@@ -205,7 +166,9 @@ namespace Compdfkit_Tools.PDFControl
             }
             return standardZoom / 100;
         }
+        #endregion
 
+        #region Public Methods
         public bool CheckHasForm()
         {
             if (PDFView == null || PDFView.Document == null)
@@ -228,5 +191,7 @@ namespace Compdfkit_Tools.PDFControl
             }
             return false;
         }
+        #endregion
+        
     }
 }

+ 45 - 0
Demo/Examples/Compdfkit_Tools/PDFView/RegularViewerControl.xaml

@@ -0,0 +1,45 @@
+<UserControl x:Class="Compdfkit_Tools.PDFView.RegularViewerControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:local="clr-namespace:Compdfkit_Tools.PDFView"
+             xmlns:common="clr-namespace:Compdfkit_Tools.Common"
+             mc:Ignorable="d"
+             Unloaded="UserControl_Unloaded"
+             d:DesignHeight="720" d:DesignWidth="1080">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="auto"></RowDefinition>
+            <RowDefinition Height="*"></RowDefinition>
+        </Grid.RowDefinitions>
+        <Border x:Name="SignatureStatusBorder" Visibility="Collapsed"/>
+        <Grid Grid.Row="1" x:Name="BodyGrid">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="0"></ColumnDefinition>
+                <ColumnDefinition Width="0"></ColumnDefinition>
+                <ColumnDefinition Width="*"></ColumnDefinition>
+                <ColumnDefinition Width="auto"></ColumnDefinition>
+            </Grid.ColumnDefinitions>
+                <Border Visibility="Collapsed" x:Name="BotaContainer"></Border>
+                <GridSplitter Name="Splitter" Grid.Column="1" Width="15" ResizeBehavior="PreviousAndNext" Visibility="Collapsed">
+                    <GridSplitter.Template>
+                        <ControlTemplate TargetType="{x:Type GridSplitter}">
+                            <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
+                                    BorderBrush="{TemplateBinding Border.BorderBrush}"
+                                    Background="{TemplateBinding Panel.Background}" >
+                                <Path Fill="Gray" VerticalAlignment="Center">
+                                    <Path.Data>
+                                        M15 3.75H1V2.25H15V3.75ZM15 8.75H1V7.25H15V8.75ZM1 13.75H15V12.25H1V13.75Z
+                                    </Path.Data>
+                                </Path>
+                            </Border>
+                        </ControlTemplate>
+                    </GridSplitter.Template>
+                </GridSplitter>
+                <Border Grid.Column="2" x:Name="PDFGrid" Background="#CECECE"></Border>
+                <Border Grid.Column="3" Name="PropertyContainer" Visibility="Collapsed" ></Border>
+        </Grid>
+        <common:PageNumberControl Grid.Row="1" x:Name="FloatPageTool" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,20"></common:PageNumberControl>
+    </Grid>
+</UserControl>

+ 396 - 0
Demo/Examples/Compdfkit_Tools/PDFView/RegularViewerControl.xaml.cs

@@ -0,0 +1,396 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Drawing;
+using System.IO;
+using System.Runtime.CompilerServices;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Media.Imaging;
+using Compdfkit_Tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI;
+using Compdfkit_Tools.Helper;
+using Compdfkit_Tools.PDFControl;
+using ComPDFKit.DigitalSign;
+using ComPDFKit.PDFAnnotation.Form;
+using ComPDFKitViewer;
+using ComPDFKitViewer.AnnotEvent;
+using ComPDFKitViewer.PdfViewer;
+
+namespace Compdfkit_Tools.PDFView
+{
+    public partial class RegularViewerControl : UserControl, INotifyPropertyChanged
+    {
+        public PDFViewControl PdfViewControl = new PDFViewControl();
+        public CPDFAnnotationControl PDFAnnotationControl = new CPDFAnnotationControl();
+        private SignatureStatusBarControl signatureStatusBarControl;
+        private CPDFDisplaySettingsControl displaySettingsControl = null;
+        private PanelState panelState = PanelState.GetInstance();
+        private double[] zoomLevelList = { 1f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
+        public event PropertyChangedEventHandler PropertyChanged;
+        public event EventHandler<bool> OnCanSaveChanged;
+
+        private bool CanSave
+        {
+            get
+            {
+                if (PdfViewControl != null && PdfViewControl.PDFView != null)
+                {
+                    return PdfViewControl.PDFView.UndoManager.CanSave;
+                }
+
+                return false;
+            }
+        }
+        
+        public RegularViewerControl()
+        {
+            InitializeComponent();
+            panelState.PropertyChanged -= PanelState_PropertyChanged;
+            panelState.PropertyChanged += PanelState_PropertyChanged;
+        }
+        
+        private void PanelState_PropertyChanged(object sender, PropertyChangedEventArgs e)
+        {
+            if (e.PropertyName == nameof(PanelState.IsLeftPanelExpand))
+            {
+                ExpandLeftPanel(panelState.IsLeftPanelExpand);
+            }
+            else if (e.PropertyName == nameof(PanelState.RightPanel))
+            {
+                if (panelState.RightPanel == PanelState.RightPanelState.PropertyPanel)
+                {
+                    ExpandRightPropertyPanel(PDFAnnotationControl, Visibility.Visible);
+                }
+                else if (panelState.RightPanel == PanelState.RightPanelState.ViewSettings)
+                {
+                    ExpandRightPropertyPanel(displaySettingsControl, Visibility.Visible);
+                }
+                else
+                {
+                    ExpandRightPropertyPanel(null, Visibility.Collapsed);
+
+                }
+            }
+        }
+        
+        public void ExpandLeftPanel(bool isExpand)
+        {
+            BotaContainer.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
+            Splitter.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
+            if (isExpand)
+            {
+                BodyGrid.ColumnDefinitions[0].Width = new GridLength(320);
+                BodyGrid.ColumnDefinitions[1].Width = new GridLength(15);
+            }
+            else
+            {
+                BodyGrid.ColumnDefinitions[0].Width = new GridLength(0);
+                BodyGrid.ColumnDefinitions[1].Width = new GridLength(0);
+            }
+        }
+        
+        public void ExpandRightPropertyPanel(UIElement propertytPanel, Visibility visible)
+        {
+            PropertyContainer.Width = 260;
+            PropertyContainer.Child = propertytPanel;
+            PropertyContainer.Visibility = visible;
+        }
+        
+        #region Init PDFViewer
+
+        private void InitialControl()
+        {
+            PdfViewControl.PDFView?.SetMouseMode(MouseModes.Viewer);
+            PdfViewControl.PDFView?.SetShowLink(true);
+            PDFGrid.Child = PdfViewControl; 
+            PdfViewControl.PDFView.UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
+            PdfViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
+            PdfViewControl.PDFView.SetFormFieldHighlight(true);
+        }
+        
+        public void InitWithPDFViewer(CPDFViewer pdfViewer)
+        {
+            PdfViewControl.PDFView = pdfViewer;
+            PDFGrid.Child = PdfViewControl;
+            FloatPageTool.InitWithPDFViewer(pdfViewer);
+            InitialControl();
+            DataContext = this;
+            if(PdfViewControl!=null && PdfViewControl.PDFView!=null)
+            {
+                PdfViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
+                PdfViewControl.PDFView.AnnotCommandHandler += PDFView_AnnotCommandHandler;
+                PdfViewControl.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
+                PdfViewControl.PDFView.WidgetClickHandler += PDFView_WidgetClickHandler;
+            }
+        }
+
+        private void PDFView_WidgetClickHandler(object sender, WidgetArgs e)
+        {
+            if ((e is WidgetSignArgs args))
+            {
+                var signatureWidget = args.Sign;
+                if(signatureWidget != null)
+                {
+                    CPDFSignature sig = signatureWidget.GetSignature(PdfViewControl.PDFView.Document);
+                    if (signatureWidget.IsSigned() && sig!=null && sig?.SignerList.Count > 0)
+                    {
+                        return;
+                    }
+                }
+                
+                if (args.WidgetType == C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS)
+                {
+                    panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
+                    CPDFSignatureUI signatureProperty = new CPDFSignatureUI();
+                    signatureProperty.SetFormProperty(args, PdfViewControl.PDFView);
+                    PropertyContainer.Child = signatureProperty;
+                }
+            }
+        }
+        
+        public void CancelWidgetClickHandler()
+        {
+            if (PdfViewControl != null && PdfViewControl.PDFView != null)
+            {
+                PdfViewControl.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
+            }
+        }
+
+        public void SetBOTAContainer(CPDFBOTABarControl botaControl)
+        {
+            this.BotaContainer.Child = botaControl;
+        }
+        
+        public void SetDisplaySettingsControl(CPDFDisplaySettingsControl displaySettingsControl)
+        {
+            this.displaySettingsControl = displaySettingsControl;
+        }
+        
+        public void SetSignatureStatusBarControl(SignatureStatusBarControl signatureStatusBarControl)
+        {
+            this.signatureStatusBarControl = signatureStatusBarControl;
+            SignatureStatusBorder.Child = this.signatureStatusBarControl;
+            if (signatureStatusBarControl.Status != SignatureStatus.None)
+            {
+                SignatureStatusBorder.Visibility = Visibility.Visible;
+            }
+            else
+            {
+                SignatureStatusBorder.Visibility = Visibility.Collapsed;
+            }
+        }
+
+        #endregion
+        
+        public void ClearViewerControl()
+        {
+            PDFGrid.Child = null;
+            BotaContainer.Child = null;
+            PropertyContainer.Child= null;
+            SignatureStatusBorder.Child = null;
+            displaySettingsControl = null;
+        }
+        
+        #region PropertyChanged
+
+        /// <summary>
+        /// Undo Redo Event Noitfy
+        /// </summary>
+        private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
+        {
+            OnPropertyChanged(e.PropertyName);
+            if (e.PropertyName == "CanSave")
+            {
+                OnCanSaveChanged?.Invoke(this, CanSave);
+            }
+        }
+
+        protected void OnPropertyChanged([CallerMemberName] string name = null)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
+        }
+
+        #endregion
+        
+        #region Context Menu
+
+        private void ExtraImage_Click(object sender, RoutedEventArgs e)
+        {
+            CommandHelper.ExtraImage_Click(PdfViewControl.PDFView.GetSelectedImages());
+        }
+
+        private void CopyImage_Click(object sender, RoutedEventArgs e)
+        {
+            CommandHelper.CopyImage_Click(PdfViewControl.PDFView.GetSelectedImages());
+        }
+
+        private void PDFView_AnnotCommandHandler(object sender, AnnotCommandArgs e)
+        {
+            if (e != null && e.CommandType == CommandType.Context)
+            {
+                if (e.PressOnSelectedText)
+                {
+                    e.Handle = true;
+                    e.PopupMenu = new ContextMenu();
+                    e.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
+                }
+                else if (e.CommandTarget == TargetType.ImageSelection)
+                {
+                    if (PdfViewControl != null && PdfViewControl.PDFView != null && PdfViewControl.PDFView.GetSelectImageCount() > 0)
+                    {
+                        e.Handle = true;
+                        e.PopupMenu = new ContextMenu();
+
+                        MenuItem imageCopyMenu = new MenuItem();
+                        imageCopyMenu = new MenuItem();
+                        imageCopyMenu.Header = "Copy Images";
+                        WeakEventManager<MenuItem, RoutedEventArgs>.AddHandler(imageCopyMenu, "Click", CopyImage_Click);
+                        imageCopyMenu.CommandParameter = e;
+                        e.PopupMenu.Items.Add(imageCopyMenu);
+
+                        MenuItem imageExtraMenu = new MenuItem();
+                        imageExtraMenu = new MenuItem();
+                        imageExtraMenu.Header = "Extract Images";
+                        WeakEventManager<MenuItem, RoutedEventArgs>.AddHandler(imageExtraMenu, "Click", ExtraImage_Click);
+                        imageExtraMenu.CommandParameter = e;
+                        e.PopupMenu.Items.Add(imageExtraMenu);
+                    }
+                }
+                else
+                {
+                    e.Handle = true;
+                    e.PopupMenu = new ContextMenu();
+                    //if (PdfViewControl.CheckHasForm())
+
+                    MenuItem fitWidthMenu = new MenuItem();
+                    fitWidthMenu.Header = "Automatically Resize";
+                    fitWidthMenu.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            PdfViewControl.PDFView?.ChangeFitMode(FitMode.FitWidth);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(fitWidthMenu);
+
+                    MenuItem fitSizeMenu = new MenuItem();
+                    fitSizeMenu.Header = "Actual Size";
+                    fitSizeMenu.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            PdfViewControl.PDFView?.ChangeFitMode(FitMode.FitSize);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(fitSizeMenu);
+
+                    MenuItem zoomInMenu = new MenuItem();
+                    zoomInMenu.Header = "Zoom In";
+                    zoomInMenu.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            double newZoom = CommandHelper.CheckZoomLevel(zoomLevelList,PdfViewControl.PDFView.ZoomFactor + 0.01, true);
+                            PdfViewControl.PDFView?.Zoom(newZoom);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(zoomInMenu);
+
+                    MenuItem zoomOutMenu = new MenuItem();
+                    zoomOutMenu.Header = "Zoom Out";
+                    zoomOutMenu.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            double newZoom = CommandHelper.CheckZoomLevel(zoomLevelList,PdfViewControl.PDFView.ZoomFactor - 0.01, false);
+                            PdfViewControl.PDFView?.Zoom(newZoom);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(zoomOutMenu);
+                    e.PopupMenu.Items.Add(new Separator());
+
+                    MenuItem singleView = new MenuItem();
+                    singleView.Header = "Single Page";
+                    singleView.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            PdfViewControl.PDFView?.ChangeViewMode(ViewMode.Single);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(singleView);
+
+                    MenuItem singleContinuousView = new MenuItem();
+                    singleContinuousView.Header = "Single Page Continuous";
+                    singleContinuousView.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            PdfViewControl.PDFView?.ChangeViewMode(ViewMode.SingleContinuous);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(singleContinuousView);
+
+                    MenuItem doubleView = new MenuItem();
+                    doubleView.Header = "Two Pages";
+                    doubleView.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            PdfViewControl.PDFView?.ChangeViewMode(ViewMode.Double);
+                        }
+                    };
+
+                    e.PopupMenu.Items.Add(doubleView);
+
+                    MenuItem doubleContinuousView = new MenuItem();
+                    doubleContinuousView.Header = "Two Pages Continuous";
+                    doubleContinuousView.Click += (o, p) =>
+                    {
+                        if (PdfViewControl != null)
+                        {
+                            PdfViewControl.PDFView?.ChangeViewMode(ViewMode.DoubleContinuous);
+                        }
+                    };
+                    e.PopupMenu.Items.Add(doubleContinuousView);
+
+                    {
+                        MenuItem resetForms = new MenuItem();
+                        resetForms.Header = "Reset Forms";
+                        resetForms.Click += (o, p) =>
+                        {
+                            if (PdfViewControl != null)
+                            {
+                                PdfViewControl.PDFView?.ResetForm(null);
+                            }
+                        };
+                        e.PopupMenu.Items.Add(new Separator());
+                        e.PopupMenu.Items.Add(resetForms);
+                    }
+                }
+            }
+
+            if (e != null && e.CommandType == CommandType.Copy)
+            {
+                e.DoCommand();
+            }
+        }
+
+        #endregion
+
+        private void UserControl_Unloaded(object sender, RoutedEventArgs e)
+        {
+            PdfViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
+            PdfViewControl.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
+        }
+    }
+}

+ 0 - 0
Demo/Examples/Compdfkit_Tools/PageEdit/PDFPageEdit/CPDFPageEditControl.xaml.cs


Some files were not shown because too many files changed in this diff