liuaoran пре 1 година
родитељ
комит
69b340b499
38 измењених фајлова са 1219 додато и 33 уклоњено
  1. 21 0
      Demo/Examples/Examlpes.sln
  2. 6 0
      Demo/Examples/PDFATest/App.config
  3. 45 0
      Demo/Examples/PDFATest/PDFATest.cs
  4. 82 0
      Demo/Examples/PDFATest/PDFATest.csproj
  5. 36 0
      Demo/Examples/PDFATest/Properties/AssemblyInfo.cs
  6. 4 0
      Demo/Examples/PDFATest/packages.config
  7. 2 3
      Demo/Examples/Samples/BatesTest/BatesTest.cs
  8. 1 1
      Demo/Examples/Samples/BatesTest/BatesTest.csproj
  9. 6 0
      Demo/Examples/Samples/BookmarkTest/App.config
  10. 21 0
      Demo/Examples/Samples/BookmarkTest/BookmarkTest.cs
  11. 82 0
      Demo/Examples/Samples/BookmarkTest/BookmarkTest.csproj
  12. 36 0
      Demo/Examples/Samples/BookmarkTest/Properties/AssemblyInfo.cs
  13. 4 0
      Demo/Examples/Samples/BookmarkTest/packages.config
  14. 6 0
      Demo/Examples/Samples/EncryptTest/App.config
  15. 367 0
      Demo/Examples/Samples/EncryptTest/EncryptTest.cs
  16. 86 0
      Demo/Examples/Samples/EncryptTest/EncryptTest.csproj
  17. 36 0
      Demo/Examples/Samples/EncryptTest/Properties/AssemblyInfo.cs
  18. 4 0
      Demo/Examples/Samples/EncryptTest/packages.config
  19. 6 0
      Demo/Examples/Samples/FlattenTest/App.config
  20. 15 0
      Demo/Examples/Samples/FlattenTest/FlattenTest.cs
  21. 66 0
      Demo/Examples/Samples/FlattenTest/FlattenTest.csproj
  22. 36 0
      Demo/Examples/Samples/FlattenTest/Properties/AssemblyInfo.cs
  23. 13 13
      Demo/Examples/Samples/HeaderFooterTest/HeaderFooterTest.cs
  24. 1 1
      Demo/Examples/Samples/HeaderFooterTest/HeaderFooterTest.csproj
  25. 6 0
      Demo/Examples/Samples/PDFATest/App.config
  26. 83 0
      Demo/Examples/Samples/PDFATest/PDFATest.cs
  27. 82 0
      Demo/Examples/Samples/PDFATest/PDFATest.csproj
  28. 36 0
      Demo/Examples/Samples/PDFATest/Properties/AssemblyInfo.cs
  29. 4 0
      Demo/Examples/Samples/PDFATest/packages.config
  30. 23 13
      Demo/Examples/Samples/PDFRedactTest/PDFRedactTest.cs
  31. 3 2
      Demo/Examples/Samples/PDFRedactTest/PDFRedactTest.csproj
  32. BIN
      Demo/Examples/TestFile/AllPasswords.pdf
  33. BIN
      Demo/Examples/TestFile/CommonFivePage.pdf
  34. BIN
      Demo/Examples/TestFile/EncryptUseAES128.pdf
  35. BIN
      Demo/Examples/TestFile/EncryptUseAES256.pdf
  36. BIN
      Demo/Examples/TestFile/EncryptUseNoEncryptAlgo.pdf
  37. BIN
      Demo/Examples/TestFile/EncryptUseRC4.pdf
  38. BIN
      Demo/Examples/TestFile/OwnerPassword.pdf

+ 21 - 0
Demo/Examples/Examlpes.sln

@@ -30,6 +30,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatesTest", "Samples\BatesT
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDFRedactTest", "Samples\PDFRedactTest\PDFRedactTest.csproj", "{B18AD53B-9550-489B-A814-E2783D865D9C}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDFATest", "Samples\PDFATest\PDFATest.csproj", "{463C349B-D895-4191-B1FD-C507B16B6A8C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlattenTest", "Samples\FlattenTest\FlattenTest.csproj", "{34BE4547-F57E-473C-A4D9-2EFEDAC6B87E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EncryptTest", "Samples\EncryptTest\EncryptTest.csproj", "{D225EA72-F34A-4AC6-9016-91F99D30DB81}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -76,6 +82,18 @@ Global
 		{B18AD53B-9550-489B-A814-E2783D865D9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{B18AD53B-9550-489B-A814-E2783D865D9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{B18AD53B-9550-489B-A814-E2783D865D9C}.Release|Any CPU.Build.0 = Release|Any CPU
+		{463C349B-D895-4191-B1FD-C507B16B6A8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{463C349B-D895-4191-B1FD-C507B16B6A8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{463C349B-D895-4191-B1FD-C507B16B6A8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{463C349B-D895-4191-B1FD-C507B16B6A8C}.Release|Any CPU.Build.0 = Release|Any CPU
+		{34BE4547-F57E-473C-A4D9-2EFEDAC6B87E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{34BE4547-F57E-473C-A4D9-2EFEDAC6B87E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{34BE4547-F57E-473C-A4D9-2EFEDAC6B87E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{34BE4547-F57E-473C-A4D9-2EFEDAC6B87E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{D225EA72-F34A-4AC6-9016-91F99D30DB81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D225EA72-F34A-4AC6-9016-91F99D30DB81}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D225EA72-F34A-4AC6-9016-91F99D30DB81}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D225EA72-F34A-4AC6-9016-91F99D30DB81}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -84,6 +102,9 @@ Global
 		{5AF53BD9-A085-4550-8F78-98CCFFFDCDA9} = {812D8275-2791-4CEF-A4E8-39A78E49D8FB}
 		{5CE5B624-B2B8-479C-8842-B70591B01124} = {812D8275-2791-4CEF-A4E8-39A78E49D8FB}
 		{B18AD53B-9550-489B-A814-E2783D865D9C} = {812D8275-2791-4CEF-A4E8-39A78E49D8FB}
+		{463C349B-D895-4191-B1FD-C507B16B6A8C} = {812D8275-2791-4CEF-A4E8-39A78E49D8FB}
+		{34BE4547-F57E-473C-A4D9-2EFEDAC6B87E} = {812D8275-2791-4CEF-A4E8-39A78E49D8FB}
+		{D225EA72-F34A-4AC6-9016-91F99D30DB81} = {812D8275-2791-4CEF-A4E8-39A78E49D8FB}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {8EE774F1-5FBF-482A-9A31-5ABDEC216DEF}

+ 6 - 0
Demo/Examples/PDFATest/App.config

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

+ 45 - 0
Demo/Examples/PDFATest/PDFATest.cs

@@ -0,0 +1,45 @@
+using ComPDFKit.PDFDocument;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDFATest
+{
+    internal class PDFATest
+    {
+        private static string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\PDFA";
+        public static bool CovertToPDFA(CPDFDocument document)
+        {
+            string convertToPDFAPath = outputPath + "\\ConvertToPDFATest.pdf";
+            document.WritePDFAToFilePath(CPDFType.CPDFTypePDFA1a, convertToPDFAPath);
+            return true;
+        }
+
+        public static bool CovertToPDFA1b(CPDFDocument document)
+        {
+            string convertToPDFA1bPath = outputPath + "\\ConvertToPDFA1bTest.pdf";
+            document.WritePDFAToFilePath(CPDFType.CPDFTypePDFA1a, convertToPDFA1bPath);
+            return false; 
+        }
+
+        static void Main(string[] args)
+        {
+            Console.WriteLine("Running PDFA test sample…\r\n");
+
+            SDKLicenseHelper.LicenseVerify();
+             
+            CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+
+            if (!Directory.Exists(outputPath))
+            {
+                Directory.CreateDirectory(outputPath);
+            }
+
+            CovertToPDFA(document);
+            CovertToPDFA1b(document);
+        }
+    }
+}

+ 82 - 0
Demo/Examples/PDFATest/PDFATest.csproj

@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.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>{A104D585-61BB-4CAB-A968-876CCC8FA858}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>PDFATest</RootNamespace>
+    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="ComPDFKit.Desk, Version=1.8.1.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\ComPDFKit.NetFramework.1.9.0\lib\ComPDFKit.Desk.dll</HintPath>
+    </Reference>
+    <Reference Include="ComPDFKit.Viewer, Version=1.8.1.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\ComPDFKit.NetFramework.1.9.0\lib\ComPDFKit.Viewer.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="..\Samples\LicenseKey.cs">
+      <Link>LicenseKey.cs</Link>
+    </Compile>
+    <Compile Include="PDFATest.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="..\TestFile\CommonFivePage.pdf">
+      <Link>CommonFivePage.pdf</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="App.config" />
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="..\license_key_win.xml">
+      <Link>license_key_win.xml</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+  </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')" />
+  <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'))" />
+  </Target>
+</Project>

+ 36 - 0
Demo/Examples/PDFATest/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 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("PDFATest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("PDFATest")]
+[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 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)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("a104d585-61bb-4cab-a968-876ccc8fa858")]
+
+// 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.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 4 - 0
Demo/Examples/PDFATest/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="ComPDFKit.NetFramework" version="1.9.0" targetFramework="net461" />
+</packages>

+ 2 - 3
Demo/Examples/Samples/BatesTest/BatesTest.cs

@@ -27,7 +27,7 @@ namespace BatesTest
             Console.WriteLine("Running bates test sample…\r\n");
             SDKLicenseHelper.LicenseVerify();
 
-            CPDFDocument document = CPDFDocument.InitWithFilePath("Blank Page.pdf");
+            CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
 
             if (!Directory.Exists(outputPath))
             {
@@ -89,8 +89,7 @@ namespace BatesTest
                 bates.SetText(i, @"<<#3#5#Prefix-#-Suffix>>"); 
                 bates.SetTextColor(i, color);
                 bates.SetFontSize(i, 14);
-
-
+                 
                 Console.WriteLine("Text: {0}", bates.GetText(i));
                 Console.WriteLine("Location: {0}\n", IntToLocationDic[i]);
             }

+ 1 - 1
Demo/Examples/Samples/BatesTest/BatesTest.csproj

@@ -57,7 +57,7 @@
   </ItemGroup>
   <ItemGroup>
     <None Include="App.config" />
-    <None Include="..\..\TestFile\Blank Page.pdf">
+    <None Include="..\..\TestFile\CommonFivePage.pdf">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
     <None Include="packages.config" />

+ 6 - 0
Demo/Examples/Samples/BookmarkTest/App.config

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

+ 21 - 0
Demo/Examples/Samples/BookmarkTest/BookmarkTest.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BookmarkTest
+{
+    internal class Program
+    {
+        static private string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\Bookmark";
+        static void Main(string[] args)
+        {
+            Console.WriteLine("Running Bookmark test sample…\r\n");
+            SDKLicenseHelper.LicenseVerify();
+            CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+
+        }
+    }
+}

+ 82 - 0
Demo/Examples/Samples/BookmarkTest/BookmarkTest.csproj

@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.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>{26E617CD-C1D7-4EC2-AC9F-E3F4546B2202}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>BookmarkTest</RootNamespace>
+    <AssemblyName>BookmarkTest</AssemblyName>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="ComPDFKit.Desk, Version=1.8.1.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\ComPDFKit.NetFramework.1.9.0\lib\ComPDFKit.Desk.dll</HintPath>
+    </Reference>
+    <Reference Include="ComPDFKit.Viewer, Version=1.8.1.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\ComPDFKit.NetFramework.1.9.0\lib\ComPDFKit.Viewer.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="..\LicenseKey.cs">
+      <Link>LicenseKey.cs</Link>
+    </Compile>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="..\..\TestFile\CommonFivePage.pdf">
+      <Link>CommonFivePage.pdf</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="App.config" />
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="..\..\license_key_win.xml">
+      <Link>license_key_win.xml</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+  </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')" />
+  <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'))" />
+  </Target>
+</Project>

+ 36 - 0
Demo/Examples/Samples/BookmarkTest/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 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("BookmarkTest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("BookmarkTest")]
+[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 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)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("26e617cd-c1d7-4ec2-ac9f-e3f4546b2202")]
+
+// 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.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 4 - 0
Demo/Examples/Samples/BookmarkTest/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="ComPDFKit.NetFramework" version="1.9.0" targetFramework="net461" />
+</packages>

+ 6 - 0
Demo/Examples/Samples/EncryptTest/App.config

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

+ 367 - 0
Demo/Examples/Samples/EncryptTest/EncryptTest.cs

@@ -0,0 +1,367 @@
+using ComPDFKit.PDFDocument;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EncryptTest
+{
+    internal class EncryptTest
+    {
+        static private string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\Encrypt";
+        static private string userPassword = string.Empty;
+        static private string ownerPassword = string.Empty;
+
+        static void Main(string[] args)
+        {
+            Console.WriteLine("Running Encrypt test sample…\r\n");
+
+            SDKLicenseHelper.LicenseVerify();
+
+            CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+
+            if (!Directory.Exists(outputPath))
+            {
+                Directory.CreateDirectory(outputPath);
+            }
+
+            if (EncryptByUserPassword(document))
+            {
+                Console.WriteLine("Encrypt by user password done.");
+            }
+            else
+            {
+                Console.WriteLine("Encrypt by user password failed.");
+            }
+
+            document.Release();
+            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+
+            Console.WriteLine("--------------------");
+
+            if (EncryptByOwnerPassword(document))
+            {
+                Console.WriteLine("Encrypt by owner password done.");
+            }
+            else
+            {
+                Console.WriteLine("Encrypt by owner password failed.");
+            }
+
+            Console.WriteLine("--------------------");
+
+            document.Release();
+            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+            if (EncryptByAllPasswords(document))
+            {
+                Console.WriteLine("Encrypt by Both user and owner passwords done.");
+            }
+            else
+            {
+                Console.WriteLine("Encrypt by Both user and owner passwords failed.");
+            }
+
+            Console.WriteLine("--------------------");
+
+
+            document.Release();
+            document = CPDFDocument.InitWithFilePath("AllPasswords.pdf");
+            if (Unlock(document))
+            {
+                Console.WriteLine("Unlock done.");
+            }
+            else
+            {
+                Console.WriteLine("Unlock failed.");
+            }
+
+            Console.WriteLine("--------------------");
+
+            document.Release();
+            document = CPDFDocument.InitWithFilePath("AllPasswords.pdf");
+            if (Decrypt(document))
+            {
+                Console.WriteLine("Decrypt done.");
+            }
+            else
+            {
+                Console.WriteLine("Decrypt failed.");
+            }
+            Console.WriteLine("--------------------");
+            Console.WriteLine("Done!");
+            Console.WriteLine("--------------------");
+            Console.ReadLine();
+        }
+
+        static private bool EncryptUseRC4Algo(CPDFDocument document, CPDFPermissionsInfo permissionsInfo)
+        {
+            CPDFDocumentEncryptionLevel encryptionLevel = CPDFDocumentEncryptionLevel.CPDFDocumentEncryptionLevelRC4;
+            document.Encrypt(userPassword, ownerPassword, permissionsInfo, encryptionLevel);
+            string encryptPath = outputPath + "\\EncryptUseRC4Test.pdf";
+            if (!document.WriteToFilePath(encryptPath))
+            {
+                return false;
+            }
+
+            CPDFDocument encryptedDoc = CPDFDocument.InitWithFilePath(encryptPath);
+            if (encryptedDoc.IsEncrypted)
+            {
+                Console.WriteLine("File is encrypted");
+                Console.WriteLine("Browse the changed file in: " + encryptPath);
+                Console.WriteLine("User password is: {0}", userPassword);
+            }
+            else
+            {
+                Console.WriteLine("File encrypt failed");
+                return false;
+            }
+
+            return true;
+        }
+
+        static private bool EncryptUseAES128Algo(CPDFDocument document, CPDFPermissionsInfo permissionsInfo)
+        {
+            CPDFDocumentEncryptionLevel encryptionLevel = CPDFDocumentEncryptionLevel.CPDFDocumentEncryptionLevelAES128;
+            document.Encrypt(userPassword, ownerPassword, permissionsInfo, encryptionLevel);
+            string encryptPath = outputPath + "\\EncryptUseAES128Test.pdf";
+            if (!document.WriteToFilePath(encryptPath))
+            {
+                return false;
+            }
+
+            CPDFDocument encryptedDoc = CPDFDocument.InitWithFilePath(encryptPath);
+            if (encryptedDoc.IsEncrypted)
+            {
+                Console.WriteLine("File is encrypted");
+                Console.WriteLine("Browse the changed file in: " + encryptPath);
+                Console.WriteLine("User password is: {0}", userPassword);
+            }
+            else
+            {
+                Console.WriteLine("File encrypt failed");
+                return false;
+            }
+
+            return true;
+        }
+
+        static private bool EncryptUseAES256Algo(CPDFDocument document, CPDFPermissionsInfo permissionsInfo)
+        {
+            CPDFDocumentEncryptionLevel encryptionLevel = CPDFDocumentEncryptionLevel.CPDFDocumentEncryptionLevelAES256;
+            document.Encrypt(userPassword, ownerPassword, permissionsInfo, encryptionLevel);
+            string encryptPath = outputPath + "\\EncryptUseAES256Test.pdf";
+            if (!document.WriteToFilePath(encryptPath))
+            {
+                return false;
+            }
+
+            CPDFDocument encryptedDoc = CPDFDocument.InitWithFilePath(encryptPath);
+            if (encryptedDoc.IsEncrypted)
+            {
+                Console.WriteLine("File is encrypted");
+                Console.WriteLine("Browse the changed file in " + encryptPath);
+                Console.WriteLine("User password is: {0}", userPassword);
+            }
+            else
+            {
+                Console.WriteLine("File encrypt failed");
+                return false;
+            }
+
+            return true;
+        }
+
+        static private bool EncryptUseNoEncryptAlgo(CPDFDocument document, CPDFPermissionsInfo permissionsInfo)
+        {
+            CPDFDocumentEncryptionLevel encryptionLevel = CPDFDocumentEncryptionLevel.CPDFDocumentEncryptionLevelNoEncryptAlgo;
+            document.Encrypt(userPassword, ownerPassword, permissionsInfo, encryptionLevel);
+            string encryptPath = outputPath + "\\EncryptUseNoEncryptAlgoTest.pdf";
+            if (!document.WriteToFilePath(encryptPath))
+            {
+                return false;
+            }
+
+            CPDFDocument encryptedDoc = CPDFDocument.InitWithFilePath(encryptPath);
+            if (encryptedDoc.IsEncrypted)
+            {
+                Console.WriteLine("File is encrypted.");
+                Console.WriteLine("Browse the changed file in " + encryptPath);
+                Console.WriteLine("User password is: {0}", userPassword);
+            }
+            else
+            {
+                Console.WriteLine("File encrypt failed");
+                return false;
+            }
+            return true;
+        }
+
+        static private bool EncryptByUserPassword(CPDFDocument document)
+        {
+            bool result = true;
+
+            userPassword = "User";
+            ownerPassword = string.Empty;
+            CPDFPermissionsInfo permissionsInfo = new CPDFPermissionsInfo();
+
+            if (EncryptUseRC4Algo(document, permissionsInfo))
+            {
+                Console.WriteLine("RC4 encrypt done.\n");
+            }
+            else
+            {
+                Console.WriteLine("RC4 encrypt failed.\n");
+                result = false;
+            }
+
+            if (EncryptUseAES128Algo(document, permissionsInfo))
+            {
+                Console.WriteLine("AES128 encrypt done.\n");
+            }
+            else
+            {
+                Console.WriteLine("AES128 encrypt failed.\n");
+                result = false;
+            }
+
+            if (EncryptUseAES256Algo(document, permissionsInfo))
+            {
+                Console.WriteLine("AES256 encrypt done.\n");
+            }
+            else
+            {
+                Console.WriteLine("AES256 encrypt failed.\n");
+                result = false;
+            }
+
+            if (EncryptUseNoEncryptAlgo(document, permissionsInfo))
+            {
+                Console.WriteLine("NoEncryptAlgo encrypt done.\n");
+            }
+            else
+            {
+                Console.WriteLine("NoEncryptAlgo encrypt failed.\n");
+                result = false;
+            }
+            return result;
+        }
+
+        static private bool EncryptByOwnerPassword(CPDFDocument document)
+        {
+            userPassword = null;
+            ownerPassword = "Owner";
+            CPDFPermissionsInfo permissionsInfo = new CPDFPermissionsInfo();
+            permissionsInfo.AllowsPrinting = false;
+            permissionsInfo.AllowsCopying = false;
+            CPDFDocumentEncryptionLevel encryptionLevel = CPDFDocumentEncryptionLevel.CPDFDocumentEncryptionLevelRC4;
+            document.Encrypt(userPassword, ownerPassword, permissionsInfo, encryptionLevel);
+            string encryptPath = outputPath + "\\EncryptByOwnerPasswordTest.pdf";
+            if (!document.WriteToFilePath(encryptPath))
+            {
+                return false;
+            }
+
+            CPDFDocument encryptedDoc = CPDFDocument.InitWithFilePath(encryptPath);
+            if (encryptedDoc.IsEncrypted)
+            {
+                Console.WriteLine("File is encrypted.");
+                Console.WriteLine("Browse the changed file in " + encryptPath);
+                Console.WriteLine("Owner password is: {0}", ownerPassword);
+            }
+            else
+            {
+                Console.WriteLine("File encrypt failed");
+                return false;
+            }
+            return true;
+        }
+
+        static private bool EncryptByAllPasswords(CPDFDocument document)
+        {
+            userPassword = "User";
+            ownerPassword = "Owner";
+            CPDFPermissionsInfo permissionsInfo = new CPDFPermissionsInfo();
+            permissionsInfo.AllowsPrinting = false;
+            permissionsInfo.AllowsCopying = false;
+            CPDFDocumentEncryptionLevel encryptionLevel = CPDFDocumentEncryptionLevel.CPDFDocumentEncryptionLevelRC4;
+            document.Encrypt(userPassword, ownerPassword, permissionsInfo, encryptionLevel);
+            string encryptPath = outputPath + "\\EncryptByAllPasswordsTest.pdf";
+            if (!document.WriteToFilePath(encryptPath))
+            {
+                return false;
+            }
+
+            CPDFDocument encryptedDoc = CPDFDocument.InitWithFilePath(encryptPath);
+            if (encryptedDoc.IsEncrypted)
+            {
+                Console.WriteLine("File is encrypted.");
+                Console.WriteLine("Browse the changed file in " + encryptPath);
+                Console.WriteLine("User password is: {0}", userPassword);
+                Console.WriteLine("Owner password is: {0}", ownerPassword);
+            }
+            else
+            {
+                Console.WriteLine("File encrypt failed");
+                return false;
+            }
+            return true;
+        }
+
+        static private void PrintPermissionsInfo(CPDFPermissionsInfo permissionsInfo)
+        {
+            Console.Write("AllowsPrinting: ");
+            Console.Write(permissionsInfo.AllowsPrinting == true ? "Yes\n" : "No\n");
+            Console.Write("AllowsCopying: ");
+            Console.Write(permissionsInfo.AllowsCopying == true ? "Yes\n" : "No\n");
+        }
+
+        static private bool Unlock(CPDFDocument document)
+        {
+            userPassword = "User";
+            ownerPassword = "Owner";
+            if (document.IsLocked)
+            {
+                Console.WriteLine("Document is locked");
+            }
+            Console.WriteLine("Unlock with user password");
+            document.UnlockWithPassword(userPassword);
+            if (!document.IsLocked)
+            {
+                Console.WriteLine("Document is unlocked");
+            }
+            else
+            {
+                return false;
+            }
+            PrintPermissionsInfo(document.GetPermissionsInfo());
+            Console.WriteLine("Unlock with owner password");
+            document.CheckOwnerPassword(ownerPassword);
+            PrintPermissionsInfo(document.GetPermissionsInfo());
+            return true;
+        }
+
+        static private bool Decrypt(CPDFDocument document)
+        {
+            userPassword = "User";
+            ownerPassword = "Owner";
+            string decryptPath = outputPath + "\\DecryptTest.pdf";
+            document.UnlockWithPassword(userPassword);
+            if (!document.Decrypt(decryptPath))
+            {
+                return false;
+            }
+            CPDFDocument decryptDocument = CPDFDocument.InitWithFilePath(decryptPath);
+            if (decryptDocument.IsEncrypted)
+            {
+                return false;
+            }
+            else
+            {
+                Console.WriteLine("Document decrypt done.");
+            }
+            return true;
+        }
+    }
+}

+ 86 - 0
Demo/Examples/Samples/EncryptTest/EncryptTest.csproj

@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.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>{D225EA72-F34A-4AC6-9016-91F99D30DB81}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>EncryptTest</RootNamespace>
+    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="ComPDFKit.Desk, Version=1.8.1.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\ComPDFKit.NetFramework.1.9.0\lib\ComPDFKit.Desk.dll</HintPath>
+    </Reference>
+    <Reference Include="ComPDFKit.Viewer, Version=1.8.1.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\ComPDFKit.NetFramework.1.9.0\lib\ComPDFKit.Viewer.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="..\LicenseKey.cs">
+      <Link>LicenseKey.cs</Link>
+    </Compile>
+    <Compile Include="EncryptTest.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="..\..\TestFile\CommonFivePage.pdf">
+      <Link>CommonFivePage.pdf</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="..\..\TestFile\AllPasswords.pdf">
+      <Link>AllPasswords.pdf</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="App.config" />
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="..\..\license_key_win.xml">
+      <Link>license_key_win.xml</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+  </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')" />
+  <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'))" />
+  </Target>
+</Project>

+ 36 - 0
Demo/Examples/Samples/EncryptTest/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 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("EncryptTest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("EncryptTest")]
+[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 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)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("d225ea72-f34a-4ac6-9016-91f99d30db81")]
+
+// 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.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 4 - 0
Demo/Examples/Samples/EncryptTest/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="ComPDFKit.NetFramework" version="1.9.0" targetFramework="net461" />
+</packages>

+ 6 - 0
Demo/Examples/Samples/FlattenTest/App.config

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

+ 15 - 0
Demo/Examples/Samples/FlattenTest/FlattenTest.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FlattenTest
+{
+    internal class FlattenTest
+    {
+        static void Main(string[] args)
+        {
+        }
+    }
+}

+ 66 - 0
Demo/Examples/Samples/FlattenTest/FlattenTest.csproj

@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.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>{34BE4547-F57E-473C-A4D9-2EFEDAC6B87E}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>FlattenTest</RootNamespace>
+    <AssemblyName>FlattenTest</AssemblyName>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="..\LicenseKey.cs">
+      <Link>LicenseKey.cs</Link>
+    </Compile>
+    <Compile Include="FlattenTest.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="..\..\TestFile\CommonFivePage.pdf">
+      <Link>CommonFivePage.pdf</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="App.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="..\..\license_key_win.xml">
+      <Link>license_key_win.xml</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 36 - 0
Demo/Examples/Samples/FlattenTest/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 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("FlattenTest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("FlattenTest")]
+[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 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)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("34be4547-f57e-473c-a4d9-2efedac6b87e")]
+
+// 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.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 13 - 13
Demo/Examples/Samples/HeaderFooterTest/HeaderFooterTest.cs

@@ -29,7 +29,7 @@ namespace HeaderFooterTest
             Console.WriteLine("Running header and footer test sample…\r\n");
             SDKLicenseHelper.LicenseVerify();
 
-            CPDFDocument document = CPDFDocument.InitWithFilePath("Blank Page.pdf");
+            CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
 
             if (!Directory.Exists(outputPath))
             {
@@ -44,7 +44,7 @@ namespace HeaderFooterTest
             else
             {
                 Console.WriteLine("Add common header and footer failed.");
-            } 
+            }
             #endregion
             Console.WriteLine("--------------------");
             #region Add page header and footer 
@@ -55,7 +55,7 @@ namespace HeaderFooterTest
             else
             {
                 Console.WriteLine("Add page header and footer failed.");
-            } 
+            }
             #endregion
             Console.WriteLine("--------------------");
 
@@ -67,7 +67,7 @@ namespace HeaderFooterTest
             else
             {
                 Console.WriteLine("Edit header and footer failed.");
-            } 
+            }
             #endregion
             Console.WriteLine("--------------------");
 
@@ -79,7 +79,7 @@ namespace HeaderFooterTest
             else
             {
                 Console.WriteLine("delete header and footer failed\n");
-            } 
+            }
             #endregion
             Console.WriteLine("--------------------");
             Console.WriteLine("Done");
@@ -92,7 +92,7 @@ namespace HeaderFooterTest
         /// Follow these steps to add a header and footer in a blank pages file.  
         /// </summary>
         /// <param name="document">Documents that require manipulation</param>
-        private static bool AddCommonHeaderFooter(CPDFDocument document)
+        static private bool AddCommonHeaderFooter(CPDFDocument document)
         {
 
             // Init HeaderFooter
@@ -109,7 +109,7 @@ namespace HeaderFooterTest
                 headerFooter.SetTextColor(i, color);
                 // Set font size : 14
                 headerFooter.SetFontSize(i, 14);
-                 
+
                 Console.WriteLine("Text: {0}", headerFooter.GetText(i));
                 Console.WriteLine("Location: {0}\n", IntToLocationDic[i]);
             }
@@ -131,13 +131,13 @@ namespace HeaderFooterTest
             }
         }
 
-        private static bool AddPageHeaderFooter(CPDFDocument document)
+        static private bool AddPageHeaderFooter(CPDFDocument document)
         {
             // Init HeaderFooter
             CPDFHeaderFooter headerFooter = document.GetHeaderFooter();
-            byte[] color = { 255, 0, 0 }; 
+            byte[] color = { 255, 0, 0 };
             // Set page index: all the page
-            headerFooter.SetPages("0-" + (document.PageCount - 1)); 
+            headerFooter.SetPages("0-" + (document.PageCount - 1));
             for (int i = 3; i <= 5; i++)
             {
                 // Set Text: 1
@@ -153,7 +153,7 @@ namespace HeaderFooterTest
 
             // Update header and footer after changed
             headerFooter.Update();
-             
+
             string addHeaderFooterPath = outputPath + "\\AddPageHeaderFooterTest.pdf";
 
             if (document.WriteToFilePath(addHeaderFooterPath))
@@ -171,7 +171,7 @@ namespace HeaderFooterTest
         ///  Follow these steps to delete a header and footer in a blank pages file.  
         /// </summary>
         /// <param name="document">Documents that require manipulation</param>
-        private static bool EditHeaderFooter(CPDFDocument document)
+        static private bool EditHeaderFooter(CPDFDocument document)
         {
             CPDFHeaderFooter headerFooter = document.GetHeaderFooter();
 
@@ -204,7 +204,7 @@ namespace HeaderFooterTest
             }
         }
 
-        private static bool ClearHeaderFooter(CPDFDocument document)
+        static private bool ClearHeaderFooter(CPDFDocument document)
         {
             CPDFHeaderFooter headerFooter = document.GetHeaderFooter();
 

+ 1 - 1
Demo/Examples/Samples/HeaderFooterTest/HeaderFooterTest.csproj

@@ -57,7 +57,7 @@
   </ItemGroup>
   <ItemGroup>
     <None Include="App.config" />
-    <None Include="..\..\TestFile\Blank Page.pdf">
+    <None Include="..\..\TestFile\CommonFivePage.pdf">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
     <None Include="packages.config" />

+ 6 - 0
Demo/Examples/Samples/PDFATest/App.config

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

+ 83 - 0
Demo/Examples/Samples/PDFATest/PDFATest.cs

@@ -0,0 +1,83 @@
+using ComPDFKit.PDFDocument;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDFATest
+{
+    internal class PDFATest
+    {
+        static private string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\PDFA";
+        static public bool CovertToPDFA1a(CPDFDocument document)
+        {
+            string convertToPDFA1aPath = outputPath + "\\ConvertToPDFA1aTest.pdf";
+            if (!document.WritePDFAToFilePath(CPDFType.CPDFTypePDFA1a, convertToPDFA1aPath))
+            {
+                return false;
+            }
+            Console.WriteLine("Browse the changed file in " + convertToPDFA1aPath);
+            return true;
+        }
+
+        static public bool CovertToPDFA1b(CPDFDocument document)
+        {
+            string convertToPDFA1bPath = outputPath + "\\ConvertToPDFA1bTest.pdf";
+            if (!document.WritePDFAToFilePath(CPDFType.CPDFTypePDFA1b, convertToPDFA1bPath))
+            {
+                return false;
+            }
+
+            Console.WriteLine("Browse the changed file in " + convertToPDFA1bPath);
+            return true;
+        }
+
+        static void Main(string[] args)
+        {
+            Console.WriteLine("Running PDFA test sample…\r\n");
+
+            SDKLicenseHelper.LicenseVerify();
+
+            CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+
+            if (!Directory.Exists(outputPath))
+            {
+                Directory.CreateDirectory(outputPath);
+            }
+            #region PDF/A-1a
+            if (CovertToPDFA1a(document))
+            {
+                Console.WriteLine("Convert to PDF/A-1a done.");
+            }
+            else
+            {
+                Console.WriteLine("Convert to PDF/A-1a failed.");
+            }
+            #endregion
+
+            Console.WriteLine("--------------------");
+
+            document.Release();
+            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+
+            #region PDF/A-1b
+            if (CovertToPDFA1b(document))
+            {
+                Console.WriteLine("Convert to PDF/A-1b done.");
+            }
+            else
+            {
+                Console.WriteLine("Convert to PDF/A-1b failed.");
+            }
+            #endregion
+
+            Console.WriteLine("--------------------");
+            Console.WriteLine("Done!");
+            Console.WriteLine("--------------------");
+
+            Console.ReadLine();
+        }
+    }
+}

+ 82 - 0
Demo/Examples/Samples/PDFATest/PDFATest.csproj

@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.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>{463C349B-D895-4191-B1FD-C507B16B6A8C}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>PDFATest</RootNamespace>
+    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="ComPDFKit.Desk, Version=1.8.1.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\ComPDFKit.NetFramework.1.9.0\lib\ComPDFKit.Desk.dll</HintPath>
+    </Reference>
+    <Reference Include="ComPDFKit.Viewer, Version=1.8.1.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\ComPDFKit.NetFramework.1.9.0\lib\ComPDFKit.Viewer.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="..\LicenseKey.cs">
+      <Link>LicenseKey.cs</Link>
+    </Compile>
+    <Compile Include="PDFATest.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="..\..\TestFile\CommonFivePage.pdf">
+      <Link>CommonFivePage.pdf</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="App.config" />
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="..\..\license_key_win.xml">
+      <Link>license_key_win.xml</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+  </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')" />
+  <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'))" />
+  </Target>
+</Project>

+ 36 - 0
Demo/Examples/Samples/PDFATest/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 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("PDFATest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("PDFATest")]
+[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 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)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("463c349b-d895-4191-b1fd-c507b16b6a8c")]
+
+// 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.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 4 - 0
Demo/Examples/Samples/PDFATest/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="ComPDFKit.NetFramework" version="1.9.0" targetFramework="net461" />
+</packages>

+ 23 - 13
Demo/Examples/Samples/PDFRedactTest/PDFRedactTest.cs

@@ -14,16 +14,16 @@ namespace PDFRedactTest
 {
     internal class PDFRedactTest
     {
-        private static string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\Redact";
+        static private string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\Redact";
         static void Main(string[] args)
         {
             Console.WriteLine("Running redact test sample…\r\n");
             SDKLicenseHelper.LicenseVerify();
-             
-            CPDFDocument document = CPDFDocument.InitWithFilePath("PDF32000_2008.pdf");
 
-            string str = document.PageAtIndex(0).GetTextPage().GetSelectText(new Point(60, 200), new Point(560,250), new Point(0,0));
-            Console.WriteLine("The text need to be redact is {0}", str);
+            CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+
+            string str = document.PageAtIndex(0).GetTextPage().GetSelectText(new Point(300, 240), new Point(400, 300), new Point(0, 0));
+            Console.WriteLine("The text need to be redact is: {0}", str);
 
             if (!Directory.Exists(outputPath))
             {
@@ -31,7 +31,14 @@ namespace PDFRedactTest
             }
 
             #region Redact
-            Redact(document);
+            if (Redact(document))
+            {
+                Console.WriteLine("Redact done.");
+            }
+            else
+            {
+                Console.WriteLine("Redact failed.");
+            }
             #endregion
             Console.WriteLine("--------------------");
             Console.WriteLine("Done!");
@@ -40,14 +47,14 @@ namespace PDFRedactTest
             Console.ReadLine();
         }
 
-        private static bool Redact(CPDFDocument document)
+        static private bool Redact(CPDFDocument document)
         {
             //PageIndex: 0
             CPDFPage page = document.PageAtIndex(0);
             //Initial redaction
             CPDFRedactAnnotation redact = page.CreateAnnot(C_ANNOTATION_TYPE.C_ANNOTATION_REDACT) as CPDFRedactAnnotation;
             //Set radact rect: cover the title
-            redact.SetRect(new CRect(60, 200, 560, 250));
+            redact.SetRect(new CRect(300, 240, 400, 300));
             //Set overlay text: REDACTED
             redact.SetOverlayText("REDACTED");
 
@@ -63,7 +70,7 @@ namespace PDFRedactTest
             //Fill color
             byte[] fillColor = { 255, 0, 0 };
             redact.SetFillColor(fillColor);
-             
+
             byte[] outlineColor = { 0, 255, 0 };
             redact.SetOutlineColor(outlineColor);
 
@@ -71,11 +78,14 @@ namespace PDFRedactTest
             document.ApplyRedaction();
             // Save to pointed path so you can observe the effect.
             string addHeaderFooterPath = outputPath + "\\RedactTest.pdf";
-            document.WriteToFilePath(addHeaderFooterPath);
+            if (!document.WriteToFilePath(addHeaderFooterPath))
+            {
+                return false;
+            }
 
-            CPDFDocument newDocument = CPDFDocument.InitWithFilePath(addHeaderFooterPath); 
-            var str = newDocument.PageAtIndex(0).GetTextPage().GetSelectText(new Point(60, 200), new Point(560, 250), new Point(0, 0));
-            Console.WriteLine("Text in the redacted, ");
+            CPDFDocument newDocument = CPDFDocument.InitWithFilePath(addHeaderFooterPath);
+            string str = newDocument.PageAtIndex(0).GetTextPage().GetSelectText(new Point(60, 200), new Point(560, 250), new Point(0, 0));
+            Console.WriteLine("Text in the redacted area is: {0}", str); 
             return true;
         }
     }

+ 3 - 2
Demo/Examples/Samples/PDFRedactTest/PDFRedactTest.csproj

@@ -57,10 +57,11 @@
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
-    <None Include="App.config" />
-    <None Include="..\..\TestFile\PDF32000_2008.pdf">
+    <None Include="..\..\TestFile\CommonFivePage.pdf">
+      <Link>CommonFivePage.pdf</Link>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="App.config" />
     <None Include="packages.config" />
   </ItemGroup>
   <ItemGroup>

BIN
Demo/Examples/TestFile/AllPasswords.pdf


BIN
Demo/Examples/TestFile/CommonFivePage.pdf


BIN
Demo/Examples/TestFile/EncryptUseAES128.pdf


BIN
Demo/Examples/TestFile/EncryptUseAES256.pdf


BIN
Demo/Examples/TestFile/EncryptUseNoEncryptAlgo.pdf


BIN
Demo/Examples/TestFile/EncryptUseRC4.pdf


BIN
Demo/Examples/TestFile/OwnerPassword.pdf