Browse Source

compdfkit(win) - Samples同步与bug处理

liuaoran 1 year ago
parent
commit
119ef0d9d3
64 changed files with 921 additions and 372 deletions
  1. 45 20
      Demo/Examples/Samples/AnnotationImportExportTest/AnnotationImportExportTest.cs
  2. 47 1
      Demo/Examples/Samples/AnnotationImportExportTest/AnnotationImportExportTest.csproj
  3. 3 3
      Demo/Examples/Samples/AnnotationImportExportTest/App.config
  4. 3 3
      Demo/Examples/Samples/AnnotationImportExportTest/Properties/AssemblyInfo.cs
  5. 44 12
      Demo/Examples/Samples/AnnotationTest/AnnotationTest.cs
  6. 28 1
      Demo/Examples/Samples/AnnotationTest/AnnotationTest.csproj
  7. 3 3
      Demo/Examples/Samples/AnnotationTest/Properties/AssemblyInfo.cs
  8. 44 23
      Demo/Examples/Samples/BackgroundTest/BackgroundTest.cs
  9. 27 0
      Demo/Examples/Samples/BackgroundTest/BackgroundTest.csproj
  10. 3 3
      Demo/Examples/Samples/BackgroundTest/Properties/AssemblyInfo.cs
  11. 47 19
      Demo/Examples/Samples/BatesTest/BatesTest.cs
  12. 4 1
      Demo/Examples/Samples/BatesTest/BatesTest.csproj
  13. 3 3
      Demo/Examples/Samples/BatesTest/Properties/AssemblyInfo.cs
  14. 33 14
      Demo/Examples/Samples/BookmarkTest/BookmarkTest.cs
  15. 1 1
      Demo/Examples/Samples/BookmarkTest/BookmarkTest.csproj
  16. 3 3
      Demo/Examples/Samples/BookmarkTest/Properties/AssemblyInfo.cs
  17. 42 11
      Demo/Examples/Samples/DocumentCompare/DocumentCompare.cs
  18. 8 1
      Demo/Examples/Samples/DocumentCompare/DocumentCompareTest.csproj
  19. 3 3
      Demo/Examples/Samples/DocumentCompare/Properties/AssemblyInfo.cs
  20. BIN
      Demo/Examples/Samples/DocumentCompare/TextChanged.pdf
  21. 8 2
      Demo/Examples/Samples/DocumentInfoTest/DocumentInfoTest.cs
  22. 28 1
      Demo/Examples/Samples/DocumentInfoTest/DocumentInfoTest.csproj
  23. 3 3
      Demo/Examples/Samples/DocumentInfoTest/Properties/AssemblyInfo.cs
  24. 69 20
      Demo/Examples/Samples/EncryptTest/EncryptTest.cs
  25. 1 1
      Demo/Examples/Samples/EncryptTest/EncryptTest.csproj
  26. 3 3
      Demo/Examples/Samples/EncryptTest/Properties/AssemblyInfo.cs
  27. 25 18
      Demo/Examples/Samples/FlattenTest/FlattenTest.cs
  28. 1 1
      Demo/Examples/Samples/FlattenTest/FlattenTest.csproj
  29. 3 3
      Demo/Examples/Samples/FlattenTest/Properties/AssemblyInfo.cs
  30. 11 27
      Demo/Examples/Samples/HeaderFooterTest/HeaderFooterTest.cs
  31. 1 1
      Demo/Examples/Samples/HeaderFooterTest/HeaderFooterTest.csproj
  32. 5 5
      Demo/Examples/Samples/HeaderFooterTest/Properties/AssemblyInfo.cs
  33. 15 13
      Demo/Examples/Samples/ImageExtractTest/ImageExtractTest.cs
  34. 1 1
      Demo/Examples/Samples/ImageExtractTest/ImageExtractTest.csproj
  35. 3 3
      Demo/Examples/Samples/ImageExtractTest/Properties/AssemblyInfo.cs
  36. 24 0
      Demo/Examples/Samples/InteractiveFormsTest/InteractiveFormsTest.cs
  37. 1 1
      Demo/Examples/Samples/InteractiveFormsTest/InteractiveFormsTest.csproj
  38. 3 3
      Demo/Examples/Samples/InteractiveFormsTest/Properties/AssemblyInfo.cs
  39. 18 16
      Demo/Examples/Samples/LicenseKey.cs
  40. 51 8
      Demo/Examples/Samples/OutlineTest/OutlineTest.cs
  41. 1 1
      Demo/Examples/Samples/OutlineTest/OutlineTest.csproj
  42. 3 3
      Demo/Examples/Samples/OutlineTest/Properties/AssemblyInfo.cs
  43. 22 9
      Demo/Examples/Samples/PDFATest/PDFATest.cs
  44. 1 1
      Demo/Examples/Samples/PDFATest/PDFATest.csproj
  45. 3 3
      Demo/Examples/Samples/PDFATest/Properties/AssemblyInfo.cs
  46. 93 42
      Demo/Examples/Samples/PDFPageTest/PDFPageTest.cs
  47. 1 1
      Demo/Examples/Samples/PDFPageTest/PDFPageTest.csproj
  48. 3 3
      Demo/Examples/Samples/PDFPageTest/Properties/AssemblyInfo.cs
  49. 15 11
      Demo/Examples/Samples/PDFRedactTest/PDFRedactTest.cs
  50. 1 1
      Demo/Examples/Samples/PDFRedactTest/PDFRedactTest.csproj
  51. 3 3
      Demo/Examples/Samples/PDFRedactTest/Properties/AssemblyInfo.cs
  52. 8 0
      Demo/Examples/Samples/PDFToImage/PDFToImage.cs
  53. 1 1
      Demo/Examples/Samples/PDFToImage/PDFToImageTest.csproj
  54. 3 3
      Demo/Examples/Samples/PDFToImage/Properties/AssemblyInfo.cs
  55. 3 3
      Demo/Examples/Samples/TextExtractTest/Properties/AssemblyInfo.cs
  56. 6 6
      Demo/Examples/Samples/TextExtractTest/TextExtractTest.cs
  57. 1 1
      Demo/Examples/Samples/TextExtractTest/TextExtractTest.csproj
  58. 3 3
      Demo/Examples/Samples/TextSearchTest/Properties/AssemblyInfo.cs
  59. 34 9
      Demo/Examples/Samples/TextSearchTest/TextSearch.cs
  60. 1 1
      Demo/Examples/Samples/TextSearchTest/TextSearchTest.csproj
  61. 3 3
      Demo/Examples/Samples/WatermarkTest/Properties/AssemblyInfo.cs
  62. 45 8
      Demo/Examples/Samples/WatermarkTest/WatermarkTest.cs
  63. 2 1
      Demo/Examples/Samples/WatermarkTest/WatermarkTest.csproj
  64. BIN
      Demo/Examples/TestFile/Bates.pdf

+ 45 - 20
Demo/Examples/Samples/AnnotationImportExportTest/AnnotationImportExportTest.cs

@@ -1,24 +1,23 @@
 using ComPDFKit.PDFDocument;
 using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.IO; 
 
 namespace AnnotationImportExportTest
 {
     internal class AnnotationImportExportTest
     {
         private static string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\AnnotationImportExportTest";
-        private static string tempPath = outputPath + "//temp";
+        private static string tempPath = outputPath + "\\temp";
 
         static void Main(string[] args)
         {
+
             Console.WriteLine("Running header and footer test sample…\r\n");
-            SDKLicenseHelper.LicenseVerify();
 
+            #region Preparation work
 
+            SDKLicenseHelper.LicenseVerify();
+             
             if (!Directory.Exists(outputPath))
             {
                 Directory.CreateDirectory(outputPath);
@@ -28,6 +27,10 @@ namespace AnnotationImportExportTest
                 Directory.CreateDirectory(tempPath);
             }
 
+            #endregion
+
+            #region Sample 1: Export Annotation 
+
             CPDFDocument annotationsDocument = CPDFDocument.InitWithFilePath("Annotations.pdf"); 
             if (ExportAnnotaiton(annotationsDocument))
             {
@@ -38,9 +41,12 @@ namespace AnnotationImportExportTest
                 Console.WriteLine("Export annotaiton failed.");
             } 
             Console.WriteLine("--------------------");
+            
+            #endregion
 
-            CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+            #region Sample 2: Import Annotations
 
+            CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf"); 
             if (ImportAnnotaiton(document))
             {
                 Console.WriteLine("Import annotaiton done.");
@@ -50,11 +56,42 @@ namespace AnnotationImportExportTest
                 Console.WriteLine("Import annotaiton failed.");
             }
             Console.WriteLine("--------------------");
+            
+            #endregion
+             
             Console.WriteLine("Done");
             Console.WriteLine("--------------------");
             Console.ReadLine();
         }
 
+        /// <summary>
+        ///  Export the annotations in the document to XFDF format.
+        ///  Parameters in function "ImportAnnotationFromXFDFPath":
+        ///  1. path: The path to the exported XFDF file
+        ///  2. tempPath: The path for storing temporary files. 
+        /// </summary>
+        /// <param name="document">A document with multiple annotations</param>
+        /// <returns></returns>
+        static private bool ExportAnnotaiton(CPDFDocument document)
+        {
+            var path = outputPath + "\\ExportAnnotationTest.xfdf";
+            if (!document.ExportAnnotationToXFDFPath(path, tempPath))
+            {
+                return false;
+            }
+            Console.WriteLine("Xfdf file in " + path);
+
+            return true;
+        }
+
+        /// <summary>
+        ///  Importing XFDF into the document.
+        ///  Parameters in function "ImportAnnotationFromXFDFPath":
+        ///  1. The path to the XFDF file for importing.
+        ///  2. The path for storing temporary files.  
+        /// </summary>
+        /// <param name="document">A document without annotations used for importing XFDF.</param>
+        /// <returns></returns>
         static private bool ImportAnnotaiton(CPDFDocument document)
         {
             var path = outputPath + "//ImportAnnotationTest.pdf";
@@ -70,17 +107,5 @@ namespace AnnotationImportExportTest
             Console.WriteLine("Browse the changed file in " + path); 
             return true;
         }
-
-        static private bool ExportAnnotaiton(CPDFDocument document)
-        {
-            var path = outputPath+ "//ExportAnnotationTest.xfdf";
-            if (document.ExportAnnotationToXFDFPath(path, tempPath)) 
-            {
-                return false;
-            }
-            Console.WriteLine("Xfdf file in " + path);
-
-            return true;
-        }
     }
 }

+ 47 - 1
Demo/Examples/Samples/AnnotationImportExportTest/AnnotationImportExportTest.csproj

@@ -7,13 +7,30 @@
     <ProjectGuid>{E2693237-D8F2-4E1C-B3C3-0B3ACFB73728}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>AnnotationImportExportTest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
     <Deterministic>true</Deterministic>
     <NuGetPackageImportStamp>
     </NuGetPackageImportStamp>
+    <TargetFrameworkProfile />
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.0</ApplicationVersion>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <PublishWizardCompleted>true</PublishWizardCompleted>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -34,6 +51,22 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
+  <PropertyGroup>
+    <ManifestCertificateThumbprint>25DADB233E62F3B3C59C7DCD1B72EE4F90D61C27</ManifestCertificateThumbprint>
+  </PropertyGroup>
+  <PropertyGroup>
+    <ManifestKeyFile>AnnotationImportExportTest_TemporaryKey.pfx</ManifestKeyFile>
+  </PropertyGroup>
+  <PropertyGroup>
+    <GenerateManifests>true</GenerateManifests>
+  </PropertyGroup>
+  <PropertyGroup>
+    <TargetZone>LocalIntranet</TargetZone>
+  </PropertyGroup>
+  <PropertyGroup />
+  <PropertyGroup>
+    <SignManifests>true</SignManifests>
+  </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>
@@ -70,6 +103,7 @@
       <Link>CommonFivePage.pdf</Link>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="AnnotationImportExportTest_TemporaryKey.pfx" />
     <None Include="App.config" />
     <None Include="packages.config" />
   </ItemGroup>
@@ -79,6 +113,18 @@
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
   </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.6">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4.6 %28x86 和 x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+  </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">

+ 3 - 3
Demo/Examples/Samples/AnnotationImportExportTest/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 - 3
Demo/Examples/Samples/AnnotationImportExportTest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("AnnotationImportExportTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 44 - 12
Demo/Examples/Samples/AnnotationTest/AnnotationTest.cs

@@ -7,11 +7,7 @@ using System.Collections.Generic;
 using System.Drawing;
 using System.Drawing.Imaging;
 using System.IO;
-using System.Linq;
 using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-using System.Xml.Linq;
 
 namespace AnnotationTest
 {
@@ -77,6 +73,10 @@ namespace AnnotationTest
             freeText.UpdateAp();
         }
 
+        /// <summary>
+        /// Create freehand annotations
+        /// </summary>
+        /// <param name="document"></param>
         static private void CreateFreehandAnnotation(CPDFDocument document)
         {
             CPDFPage page = document.PageAtIndex(0);
@@ -100,6 +100,12 @@ namespace AnnotationTest
             ink.UpdateAp();
         }
 
+        /// <summary>
+        /// Create Shape annotations
+        /// Include:
+        /// Square, Circle, Line
+        /// </summary>
+        /// <param name="document"></param>
         static private void CreateShapeAnnotation(CPDFDocument document)
         {
             CPDFPage page = document.PageAtIndex(0);
@@ -138,6 +144,10 @@ namespace AnnotationTest
             line.UpdateAp();
         }
 
+        /// <summary>
+        /// Create note annotations
+        /// </summary>
+        /// <param name="document"></param>
         static private void CreateNoteAnnotation(CPDFDocument document)
         {
             CPDFPage page = document.PageAtIndex(0);
@@ -149,6 +159,10 @@ namespace AnnotationTest
             textAnnotation.UpdateAp();
         }
 
+        /// <summary>
+        /// Create sound annotations
+        /// </summary>
+        /// <param name="document"></param>
         static private void CreateSoundAnnotation(CPDFDocument document)
         {
             CPDFPage page = document.PageAtIndex(0);
@@ -158,6 +172,10 @@ namespace AnnotationTest
             sound.UpdateAp();
         }
 
+        /// <summary>
+        /// Create Markup annotations
+        /// </summary>
+        /// <param name="document"></param>
         static private void CreateMarkupAnnotation(CPDFDocument document)
         {
             List<CRect> cRectList = new List<CRect>();
@@ -227,17 +245,21 @@ namespace AnnotationTest
 
         }
 
+        /// <summary>
+        /// Create stamp annotation
+        /// </summary>
+        /// <param name="document"></param>
         static private void CreateStampAnnotation(CPDFDocument document)
         {
             CPDFPage page = document.PageAtIndex(0);
             // Standard
             CPDFStampAnnotation standard = page.CreateAnnot(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP) as CPDFStampAnnotation;
             standard.SetStandardStamp("Approved");
-            standard.SetRect(new CRect(300,100, 450, 160));
+            standard.SetRect(new CRect(300, 100, 450, 160));
             standard.UpdateAp();
 
             // Text
-            CPDFStampAnnotation text = page.CreateAnnot(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP) as CPDFStampAnnotation; 
+            CPDFStampAnnotation text = page.CreateAnnot(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP) as CPDFStampAnnotation;
             text.SetTextStamp("test", "detail text", C_TEXTSTAMP_SHAPE.TEXTSTAMP_LEFT_TRIANGLE, C_TEXTSTAMP_COLOR.TEXTSTAMP_RED);
             text.SetRect(new CRect(300, 220, 450, 300));
 
@@ -245,13 +267,18 @@ namespace AnnotationTest
 
             // Image
             Bitmap bitmap = new Bitmap("logo.png");
-            CPDFStampAnnotation image = page.CreateAnnot(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP) as CPDFStampAnnotation; 
+            CPDFStampAnnotation image = page.CreateAnnot(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP) as CPDFStampAnnotation;
             image.SetImageStamp(BitmapToByteArray(bitmap), bitmap.Width, bitmap.Height);
             image.SetRect(new CRect(300, 320, 380, 400));
             image.SetTransparency(255);
             image.UpdateAp();
         }
 
+        /// <summary>
+        /// Create annotations
+        /// </summary>
+        /// <param name="document"></param>
+        /// <returns></returns>
         static private bool CreateAnnots(CPDFDocument document)
         {
             CreateFreetextAnnotation(document);
@@ -267,23 +294,28 @@ namespace AnnotationTest
             {
                 return false;
             }
-            Console.WriteLine("Browse the changed file in " + path); 
+            Console.WriteLine("Browse the changed file in " + path);
             return true;
         }
 
+        /// <summary>
+        /// Delete the first annotation
+        /// </summary>
+        /// <param name="document"></param>
+        /// <returns></returns>
         static private bool DeleteAnnotations(CPDFDocument document)
         {
             CPDFPage page = document.PageAtIndex(0);
 
             List<CPDFAnnotation> annotList = page.GetAnnotations();
             var annotNum = annotList.Count;
-            annotList[0].RemoveAnnot();
-
-            if (annotNum - annotList.Count != 1)
+             
+            if (!annotList[0].RemoveAnnot())
             {
                 return false;
             }
-            string path = outputPath + "\\DeleteAnnotsTest.pdf";
+
+            string path = outputPath + "\\DeleteAnnotsTest.pdf"; 
             if (!document.WriteToFilePath(path))
             {
                 return false;

+ 28 - 1
Demo/Examples/Samples/AnnotationTest/AnnotationTest.csproj

@@ -7,13 +7,28 @@
     <ProjectGuid>{ED8A0C73-FA4E-4FAC-93F7-27C67A940628}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>AnnotationTest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
     <Deterministic>true</Deterministic>
     <NuGetPackageImportStamp>
     </NuGetPackageImportStamp>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.0</ApplicationVersion>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -86,6 +101,18 @@
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
   </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4.6.1 %28x86 和 x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+  </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">

+ 3 - 3
Demo/Examples/Samples/AnnotationTest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("AnnotationTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

File diff suppressed because it is too large
+ 44 - 23
Demo/Examples/Samples/BackgroundTest/BackgroundTest.cs


+ 27 - 0
Demo/Examples/Samples/BackgroundTest/BackgroundTest.csproj

@@ -14,6 +14,21 @@
     <Deterministic>true</Deterministic>
     <NuGetPackageImportStamp>
     </NuGetPackageImportStamp>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.0</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -84,6 +99,18 @@
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
   </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4.6.1 %28x86 和 x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+  </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">

+ 3 - 3
Demo/Examples/Samples/BackgroundTest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("BackgroundTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 47 - 19
Demo/Examples/Samples/BatesTest/BatesTest.cs

@@ -1,10 +1,7 @@
 using ComPDFKit.PDFDocument;
 using System;
 using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.IO; 
 
 namespace BatesTest
 {
@@ -24,17 +21,22 @@ namespace BatesTest
 
         static void Main(string[] args)
         {
+            #region Preparation work
+
             Console.WriteLine("Running bates test sample…\r\n");
             SDKLicenseHelper.LicenseVerify();
 
-            CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
 
             if (!Directory.Exists(outputPath))
             {
                 Directory.CreateDirectory(outputPath);
             }
 
-            #region Add bates
+            #endregion
+
+            #region Sample 1: Add bates
+            CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+
             if (AddBates(document))
             {
                 Console.WriteLine("Add bates done.");
@@ -43,10 +45,15 @@ namespace BatesTest
             {
                 Console.WriteLine("Add bates failed.");
             }
-            #endregion
+
+            document.Release();
+
             Console.WriteLine("--------------------");
+            #endregion
+
+            #region Samles 2: Edit bates
+             document = CPDFDocument.InitWithFilePath("Bates.pdf");
 
-            #region Edit bates
             if (EditBates(document))
             {
                 Console.WriteLine("Edit bates done.");
@@ -55,10 +62,16 @@ namespace BatesTest
             {
                 Console.WriteLine("Edit bates failed.");
             }
-            #endregion
+
+            document.Release();
+
             Console.WriteLine("--------------------");
 
-            #region Clear bates
+            #endregion
+
+            #region Sample 3: Clear bates
+            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+
             if (ClearBates(document))
             {
                 Console.WriteLine("Clear bates done.");
@@ -67,14 +80,22 @@ namespace BatesTest
             {
                 Console.WriteLine("Clear bates failed.");
             }
-            #endregion
+
+            document.Release();
             Console.WriteLine("--------------------");
+
+            #endregion
+
             Console.WriteLine("Done!");
             Console.WriteLine("--------------------");
              
             Console.ReadLine();
         }
 
+        /// <summary>
+        /// Add a new bates
+        /// </summary>
+        /// <param name="document">Regular document</param> 
         private static bool AddBates(CPDFDocument document)
         {
             string addBatesPath = outputPath + "\\AddBatesTest.pdf";
@@ -82,11 +103,11 @@ namespace BatesTest
             CPDFBates bates = document.GetBates();
             byte[] color = { 255, 0, 0 };
              
-            bates.SetPages("0-" + (document.PageCount - 1));
+            bates.SetPages("0-" + (document.PageCount - 1));//Page numbering from 0
 
             for (int i = 0; i <= 5; i++)
             {
-                bates.SetText(i, @"<<#3#5#Prefix-#-Suffix>>"); 
+                bates.SetText(i, @"<<#3#5#Prefix-#-Suffix>>");  //3 digits, starting from 5
                 bates.SetTextColor(i, color);
                 bates.SetFontSize(i, 14);
                  
@@ -96,17 +117,20 @@ namespace BatesTest
 
             bates.Update();
 
-            if (document.WriteToFilePath(addBatesPath))
-            {
-                Console.WriteLine("Browse the changed file in " + addBatesPath);
-                return true;
-            }
-            else
+            if (!document.WriteToFilePath(addBatesPath))
             {
                 return false;
             }
+            Console.WriteLine("Browse the changed file in " + addBatesPath);
+            return true;
         }
 
+        /// <summary>
+        /// Edit bates, <<#3#5#Prefix-#-Suffix>> -> <<#3#1#ComPDFKit-#-ComPDFKit>>
+        /// get current bates,
+        /// then edit it
+        /// </summary>
+        /// <param name="document">documet with bates</param> 
         private static bool EditBates(CPDFDocument document)
         {
 
@@ -140,6 +164,10 @@ namespace BatesTest
             }
         }
 
+        /// <summary>
+        /// Clear bates.
+        /// </summary>
+        /// <param name="document">documet with bates</param> 
         private static bool ClearBates(CPDFDocument document)
         {
             CPDFBates bates = document.GetBates();

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

@@ -7,7 +7,7 @@
     <ProjectGuid>{5CE5B624-B2B8-479C-8842-B70591B01124}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>BatesTest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
@@ -59,6 +59,9 @@
     <None Include="App.config" />
     <None Include="..\..\TestFile\CommonFivePage.pdf">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+     <None Include="..\..\TestFile\Bates.pdf">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
     <None Include="packages.config" />
   </ItemGroup>

+ 3 - 3
Demo/Examples/Samples/BatesTest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("BatesTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 33 - 14
Demo/Examples/Samples/BookmarkTest/BookmarkTest.cs

@@ -1,12 +1,7 @@
 using ComPDFKit.PDFDocument;
-using ComPDFKit.PDFPage;
 using System;
 using System.Collections.Generic;
 using System.IO;
-using System.Linq;
-using System.Net.NetworkInformation;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace BookmarkTest
 {
@@ -26,6 +21,8 @@ namespace BookmarkTest
                 Directory.CreateDirectory(outputPath);
             }
 
+            #region Sample 1: Access bookmark
+
             if (AccessBookmark(document))
             {
                 Console.WriteLine("Check bookmark list done.");
@@ -39,9 +36,13 @@ namespace BookmarkTest
                 Console.ReadLine();
                 return;
             }
+            document.Release();
             Console.WriteLine("--------------------");
+             
+            #endregion
+
+            #region Sample 2: Create bookmark
 
-            document.Release();
             document = CPDFDocument.InitWithFilePath("ThreeBookmark.pdf");
 
             if (CreateBookmark(document))
@@ -52,9 +53,13 @@ namespace BookmarkTest
             {
                 Console.WriteLine("Add bookmark failed.");
             }
+            document.Release();
             Console.WriteLine("--------------------");
 
-            document.Release();
+            #endregion
+
+            #region Sample 3: Create bookmark
+
             document = CPDFDocument.InitWithFilePath("ThreeBookmark.pdf");
 
             if (RemoveBookmark(document))
@@ -65,11 +70,20 @@ namespace BookmarkTest
             {
                 Console.WriteLine("Remove bookmark done.");
             }
+
+            document.Release();
             Console.WriteLine("--------------------");
+
+            #endregion
+            
             Console.WriteLine("Done!");
             Console.WriteLine("--------------------");
             Console.ReadLine();
         }
+
+        /// <summary>
+        /// Access bookmark
+        /// </summary> 
         static private bool AccessBookmark(CPDFDocument document)
         {
             List<CPDFBookmark> bookmarkList = document.GetBookmarkList();
@@ -80,8 +94,8 @@ namespace BookmarkTest
             else
             {
                 return false;
-            } 
-            if(document.BookmarkForPageIndex(0).Title == "Bookmark1")
+            }
+            if (document.BookmarkForPageIndex(0).Title == "Bookmark1")
             {
                 Console.WriteLine("Access bookmark for a page done.");
             }
@@ -89,10 +103,12 @@ namespace BookmarkTest
             {
                 return false;
             }
-
             return true;
         }
 
+        /// <summary>
+        /// Create bookmark
+        /// </summary> 
         static private bool CreateBookmark(CPDFDocument document)
         {
             var bookmarkCount = document.GetBookmarkList().Count;
@@ -100,11 +116,11 @@ namespace BookmarkTest
             bookmark.Title = "new bookmark";
             bookmark.PageIndex = 4;
             document.AddBookmark(bookmark);
-            if(!(document.GetBookmarkList().Count - bookmarkCount == 1))
+            if (!(document.GetBookmarkList().Count - bookmarkCount == 1))
             {
                 return false;
             }
-            Console.WriteLine("Add bookmark in page {0}. ", bookmark.PageIndex+1);
+            Console.WriteLine("Add bookmark in page {0}. ", bookmark.PageIndex + 1);
             string addBookmarkPath = outputPath + "//AddBookmarkTest.pdf";
             if (document.WriteToFilePath(addBookmarkPath))
             {
@@ -114,14 +130,17 @@ namespace BookmarkTest
             else
             {
                 return false;
-            } 
+            }
         }
 
+        /// <summary>
+        /// Remove bookmark
+        /// </summary> 
         static private bool RemoveBookmark(CPDFDocument document)
         {
             var bookmarkCount = document.GetBookmarkList().Count;
             document.RemoveBookmark(0);
-            if (!(bookmarkCount - document.GetBookmarkList().Count  == 1))
+            if (!(bookmarkCount - document.GetBookmarkList().Count == 1))
             {
                 return false;
             }

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

@@ -7,7 +7,7 @@
     <ProjectGuid>{26E617CD-C1D7-4EC2-AC9F-E3F4546B2202}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>BookmarkTest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

+ 3 - 3
Demo/Examples/Samples/BookmarkTest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("BookmarkTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 42 - 11
Demo/Examples/Samples/DocumentCompare/DocumentCompare.cs

@@ -1,12 +1,7 @@
 using ComPDFKit.Compare;
 using ComPDFKit.PDFDocument;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Xml.Linq;
+using System; 
+using System.IO; 
 
 namespace DocumentCompareTest
 {
@@ -19,15 +14,16 @@ namespace DocumentCompareTest
             Console.WriteLine("Running PDFPage test sample…\r\n");
 
             SDKLicenseHelper.LicenseVerify();
-            CPDFDocument document1 = CPDFDocument.InitWithFilePath("ElectricalDiagram.pdf");
-            CPDFDocument document2 = CPDFDocument.InitWithFilePath("ElectricalDiagram_New.pdf");
+            
 
             if (!Directory.Exists(outputPath))
             {
                 Directory.CreateDirectory(outputPath);
             }
 
-            if (CompareDocument(document1, document2))
+            CPDFDocument document1 = CPDFDocument.InitWithFilePath("ElectricalDiagram.pdf");
+            CPDFDocument document2 = CPDFDocument.InitWithFilePath("ElectricalDiagram_New.pdf");
+            if (OverlayCompareDocument(document1, document2))
             {
                 Console.WriteLine("Compare document done.");
             }
@@ -35,13 +31,30 @@ namespace DocumentCompareTest
             {
                 Console.WriteLine("Compare document failed."); 
             }
+            document1.Release();
+            document2.Release();
+            Console.WriteLine("--------------------");
+
+            CPDFDocument document3 = CPDFDocument.InitWithFilePath("Text.pdf");
+            CPDFDocument document4 = CPDFDocument.InitWithFilePath("TextChanged.pdf");
+            if (ContentCompareDocument(document3, document4))
+            {
+                Console.WriteLine("Compare document done.");
+            }
+            else
+            {
+                Console.WriteLine("Compare document failed.");
+            }
+            document3.Release();
+            document4.Release();
             Console.WriteLine("--------------------");
+
             Console.WriteLine("Done!");
             Console.WriteLine("--------------------");
             Console.ReadLine();
         }
 
-        static private bool CompareDocument(CPDFDocument document1, CPDFDocument document2)
+        static private bool OverlayCompareDocument(CPDFDocument document1, CPDFDocument document2)
         {
             CPDFCompareOverlay compareOverlay = new CPDFCompareOverlay(document1, "1-5", document2, "1-5");
             compareOverlay.Compare();
@@ -54,5 +67,23 @@ namespace DocumentCompareTest
             Console.WriteLine("Browse the changed file in " + path);
             return true;
         }
+
+        static private bool ContentCompareDocument(CPDFDocument document, CPDFDocument documentNew)
+        {
+            CPDFCompareContent compareContent = new CPDFCompareContent(document, documentNew);
+            int pageCount = Math.Min(document.PageCount, documentNew.PageCount);
+            for (int i = 0; i < pageCount; i++)
+            {
+                Console.WriteLine("Page: {0}", i);
+
+                CPDFCompareResults compareResults = compareContent.Compare(i, i, CPDFCompareType.CPDFCompareTypeAll, true);
+                Console.WriteLine("Replace count: {0}", compareResults.ReplaceCount);
+                Console.WriteLine("TextResults count: {0}", compareResults.TextResults.Count);
+                Console.WriteLine("Delete count: {0}", compareResults.DeleteCount);
+                Console.WriteLine("Insert count: {0}", compareResults.InsertCount); 
+            }
+           
+            return true;
+        }
     }
 }

+ 8 - 1
Demo/Examples/Samples/DocumentCompare/DocumentCompareTest.csproj

@@ -7,7 +7,7 @@
     <ProjectGuid>{0BB38D20-C3CF-47D7-8E2E-97195672AB67}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>DocumentCompare</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
@@ -66,8 +66,15 @@
       <Link>ElectricalDiagram_New.pdf</Link>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="..\..\TestFile\Text.pdf">
+      <Link>Text.pdf</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
     <None Include="App.config" />
     <None Include="packages.config" />
+    <None Include="TextChanged.pdf">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\license_key_windows.xml">

+ 3 - 3
Demo/Examples/Samples/DocumentCompare/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("DocumentCompare")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

BIN
Demo/Examples/Samples/DocumentCompare/TextChanged.pdf


+ 8 - 2
Demo/Examples/Samples/DocumentInfoTest/DocumentInfoTest.cs

@@ -14,10 +14,13 @@ namespace DocumentInfoTest
         { 
             Console.WriteLine("Running DocumentInfo test sample…\r\n");
             SDKLicenseHelper.LicenseVerify();
-            CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
-            PrintDocumentInfo(document);
 
+            #region Sample 1: Print information
+            CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+            PrintDocumentInfo(document); 
             Console.WriteLine("--------------------");
+            #endregion
+
             Console.WriteLine("Done.");
             Console.WriteLine("--------------------");
 
@@ -74,6 +77,9 @@ namespace DocumentInfoTest
             return "0B";
         }
 
+        /// <summary>
+        /// Print all of the infomations
+        /// </summary> 
         static private void PrintDocumentInfo(CPDFDocument document)
         {
             Console.WriteLine("File Name: {0}", document.FileName);

+ 28 - 1
Demo/Examples/Samples/DocumentInfoTest/DocumentInfoTest.csproj

@@ -7,13 +7,28 @@
     <ProjectGuid>{274E1BD3-627D-46BC-8281-5440D7703EBF}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>DocumentInfoTest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
     <Deterministic>true</Deterministic>
     <NuGetPackageImportStamp>
     </NuGetPackageImportStamp>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -71,6 +86,18 @@
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
   </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4.6.1 %28x86 和 x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+  </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">

+ 3 - 3
Demo/Examples/Samples/DocumentInfoTest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("DocumentInfoTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 69 - 20
Demo/Examples/Samples/EncryptTest/EncryptTest.cs

@@ -16,17 +16,23 @@ namespace EncryptTest
 
         static void Main(string[] args)
         {
+            #region Perparation work
+
             Console.WriteLine("Running Encrypt test sample…\r\n");
 
             SDKLicenseHelper.LicenseVerify();
 
-            CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
-
             if (!Directory.Exists(outputPath))
             {
                 Directory.CreateDirectory(outputPath);
             }
 
+            #endregion
+
+            #region Sample 1: Encrypt by user password
+
+            CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+
             if (EncryptByUserPassword(document))
             {
                 Console.WriteLine("Encrypt by user password done.");
@@ -37,10 +43,14 @@ namespace EncryptTest
             }
 
             document.Release();
-            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
-
             Console.WriteLine("--------------------");
 
+            #endregion
+
+            #region Sample 2:  Encrypt by owner password
+
+            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+
             if (EncryptByOwnerPassword(document))
             {
                 Console.WriteLine("Encrypt by owner password done.");
@@ -49,11 +59,16 @@ namespace EncryptTest
             {
                 Console.WriteLine("Encrypt by owner password failed.");
             }
+            document.Release();
 
             Console.WriteLine("--------------------");
 
-            document.Release();
+            #endregion
+
+            #region Sample 3: Encrypt by all passwords
+
             document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+
             if (EncryptByAllPasswords(document))
             {
                 Console.WriteLine("Encrypt by Both user and owner passwords done.");
@@ -63,10 +78,13 @@ namespace EncryptTest
                 Console.WriteLine("Encrypt by Both user and owner passwords failed.");
             }
 
+            document.Release();
+
             Console.WriteLine("--------------------");
 
+            #endregion
 
-            document.Release();
+            #region Sample 4: Unlock
             document = CPDFDocument.InitWithFilePath("AllPasswords.pdf");
             if (Unlock(document))
             {
@@ -76,10 +94,14 @@ namespace EncryptTest
             {
                 Console.WriteLine("Unlock failed.");
             }
+            document.Release();
 
             Console.WriteLine("--------------------");
 
-            document.Release();
+            #endregion
+
+            #region Sample 5: Decrypt
+
             document = CPDFDocument.InitWithFilePath("AllPasswords.pdf");
             if (Decrypt(document))
             {
@@ -89,8 +111,11 @@ namespace EncryptTest
             {
                 Console.WriteLine("Decrypt failed.");
             }
-
+            document.Release();
             Console.WriteLine("--------------------");
+
+            #endregion
+
             Console.WriteLine("Done!");
             Console.WriteLine("--------------------");
             Console.ReadLine();
@@ -199,6 +224,12 @@ namespace EncryptTest
             return true;
         }
 
+        /// <summary>
+        /// Using RC4, AES128, AES256, NoEncrypt algorithm to encrypt document. 
+        /// User password: User
+        /// No owner password
+        /// </summary>
+        /// <param name="document">Regular document</param>
         static private bool EncryptByUserPassword(CPDFDocument document)
         {
             bool result = true;
@@ -249,6 +280,12 @@ namespace EncryptTest
             return result;
         }
 
+        /// <summary>
+        /// Encrypt by owner password
+        /// No user password
+        /// Owner password: Owner
+        /// </summary>
+        /// <param name="document">Regular document</param> 
         static private bool EncryptByOwnerPassword(CPDFDocument document)
         {
             userPassword = null;
@@ -279,6 +316,12 @@ namespace EncryptTest
             return true;
         }
 
+        /// <summary>
+        /// Encrypt by all passwords
+        /// User password: User
+        /// Owner password: Owner
+        /// </summary>
+        /// <param name="document">Regular document</param> 
         static private bool EncryptByAllPasswords(CPDFDocument document)
         {
             userPassword = "User";
@@ -310,6 +353,10 @@ namespace EncryptTest
             return true;
         }
 
+        /// <summary>
+        /// Print printing and copying permissions info.
+        /// </summary>
+        /// <param name="permissionsInfo">Permissions info about a document</param>
         static private void PrintPermissionsInfo(CPDFPermissionsInfo permissionsInfo)
         {
             Console.Write("AllowsPrinting: ");
@@ -318,31 +365,33 @@ namespace EncryptTest
             Console.Write(permissionsInfo.AllowsCopying == true ? "Yes\n" : "No\n");
         }
 
+        /// <summary>
+        /// Unlock document
+        /// </summary>
+        /// <param name="document"></param>
         static private bool Unlock(CPDFDocument document)
         {
             userPassword = "User";
             ownerPassword = "Owner";
+            //Check if document is locked
             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);
+            document.CheckOwnerPassword("123");
+            //Check permissions info.
             PrintPermissionsInfo(document.GetPermissionsInfo());
             return true;
         }
 
+        /// <summary>
+        /// Decrypted
+        /// </summary>
+        /// <param name="document"></param>
         static private bool Decrypt(CPDFDocument document)
         {
             userPassword = "User";
@@ -361,7 +410,7 @@ namespace EncryptTest
             else
             {
                 Console.WriteLine("Document decrypt done.");
-            }
+            } 
             return true;
         }
     }

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

@@ -7,7 +7,7 @@
     <ProjectGuid>{D225EA72-F34A-4AC6-9016-91F99D30DB81}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>EncryptTest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

+ 3 - 3
Demo/Examples/Samples/EncryptTest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("EncryptTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 25 - 18
Demo/Examples/Samples/FlattenTest/FlattenTest.cs

@@ -1,11 +1,7 @@
 using ComPDFKit.PDFDocument;
 using ComPDFKit.PDFPage;
 using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.IO; 
 
 namespace FlattenTest
 {
@@ -14,13 +10,18 @@ namespace FlattenTest
         static private string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\Flatten";
         static void Main(string[] args)
         {
+            #region Perparation work
             Console.WriteLine("Running Flatten test sample…\r\n");
             SDKLicenseHelper.LicenseVerify();
-            CPDFDocument document = CPDFDocument.InitWithFilePath("Annotations.pdf");
             if (!Directory.Exists(outputPath))
             {
                 Directory.CreateDirectory(outputPath);
             }
+            #endregion
+
+            #region Sample1: Flatten
+
+            CPDFDocument document = CPDFDocument.InitWithFilePath("Annotations.pdf");
 
             if (Flatten(document))
             {
@@ -31,12 +32,21 @@ namespace FlattenTest
                 Console.WriteLine("Flatten failed.");
             }
             Console.WriteLine("--------------------");
+            document.Release();
+
+            #endregion
+
             Console.WriteLine("Done");
             Console.WriteLine("--------------------");
 
             Console.ReadLine();
         }
 
+        /// <summary>
+        /// Flatten documentation with comments
+        /// </summary>
+        /// <param name="document">document with many annotation. </param>
+        /// <returns></returns>
         static private bool Flatten(CPDFDocument document)
         {
             int annotationCount = 0;
@@ -47,30 +57,27 @@ namespace FlattenTest
             }
             Console.Write("{0} annotations in the file. ", annotationCount);
             string flattenPath = outputPath + "\\FlattenTest.pdf";
-            if (document.WriteFlattenToFilePath(flattenPath))
-            {
-                Console.WriteLine("Browse the changed file in " + flattenPath);
-            }
-            else
+            if (!document.WriteFlattenToFilePath(flattenPath))
             {
                 return false;
             }
+            Console.WriteLine("Browse the changed file in " + flattenPath);
+
+            //Verify: Check if the number of comments in the new document is 0
             CPDFDocument flattenDocument = CPDFDocument.InitWithFilePath(flattenPath);
             int newCount = 0;
             for (int i = 0; i < flattenDocument.PageCount; i++)
             {
                 CPDFPage page = flattenDocument.PageAtIndex(i);
                 newCount += page.GetAnnotCount();
-            } 
-            Console.WriteLine("{0} annotations in the new file. ", newCount);
-            if (newCount == 0)
-            {
-                return true;
             }
-            else
+            Console.WriteLine("{0} annotations in the new file. ", newCount);
+            if (!(newCount == 0))
             {
                 return false;
-            } 
+            }
+            return true;
+
         }
     }
 }

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

@@ -7,7 +7,7 @@
     <ProjectGuid>{34BE4547-F57E-473C-A4D9-2EFEDAC6B87E}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>FlattenTest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

+ 3 - 3
Demo/Examples/Samples/FlattenTest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("FlattenTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 11 - 27
Demo/Examples/Samples/HeaderFooterTest/HeaderFooterTest.cs

@@ -2,11 +2,6 @@
 using System;
 using System.Collections.Generic;
 using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Xml.Linq;
-using static System.Net.Mime.MediaTypeNames;
 
 namespace HeaderFooterTest
 {
@@ -45,8 +40,9 @@ namespace HeaderFooterTest
             {
                 Console.WriteLine("Add common header and footer failed.");
             }
-            #endregion
             Console.WriteLine("--------------------");
+
+            #endregion
             #region Add page header and footer 
             if (AddPageHeaderFooter(document))
             {
@@ -91,67 +87,55 @@ namespace HeaderFooterTest
         /// <summary>
         /// Follow these steps to add a header and footer in a blank pages file.  
         /// </summary>
-        /// <param name="document">Documents that require manipulation</param>
+        /// <param name="document">Regular document</param>
         static private bool AddCommonHeaderFooter(CPDFDocument document)
         {
 
-            // Init HeaderFooter
             CPDFHeaderFooter headerFooter = document.GetHeaderFooter();
             byte[] color = { 255, 0, 0 };
             headerFooter.SetPages("0-" + (document.PageCount - 1));
 
             for (int i = 0; i <= 2; i++)
             {
-                // Set Text: ComPDFKit
                 headerFooter.SetText(i, "ComPDFKit");
-                // Set page index: all the page
-                // Set color : red
                 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]);
             }
 
-            // Update header and footer after changed
             headerFooter.Update();
 
-            // Save to pointed path so you can observe the effect.
             string addHeaderFooterPath = outputPath + "\\AddCommonHeaderFooterTest.pdf";
 
-            if (document.WriteToFilePath(addHeaderFooterPath))
+            if (!document.WriteToFilePath(addHeaderFooterPath))
             {
-                Console.WriteLine("Browse the changed file in " + addHeaderFooterPath);
-                return true;
-            }
-            else
-            {
-                return false;
+                return false; 
             }
+            Console.WriteLine("Browse the changed file in " + addHeaderFooterPath);
+            return true;
         }
 
+        /// <summary>
+        /// Add headers and footers that automatically display page numbers
+        /// </summary>
+        /// <param name="document">Regular document</param>
         static private bool AddPageHeaderFooter(CPDFDocument document)
         {
-            // Init HeaderFooter
             CPDFHeaderFooter headerFooter = document.GetHeaderFooter();
             byte[] color = { 255, 0, 0 };
-            // Set page index: all the page
             headerFooter.SetPages("0-" + (document.PageCount - 1));
             for (int i = 3; i <= 5; i++)
             {
-                // Set Text: 1
                 headerFooter.SetText(i, "<<1,2>>");
-                // Set color : red
                 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]);
             }
 
-            // Update header and footer after changed
             headerFooter.Update();
 
             string addHeaderFooterPath = outputPath + "\\AddPageHeaderFooterTest.pdf";

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

@@ -7,7 +7,7 @@
     <ProjectGuid>{5AF53BD9-A085-4550-8F78-98CCFFFDCDA9}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>HeaderFooterTest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

+ 5 - 5
Demo/Examples/Samples/HeaderFooterTest/Properties/AssemblyInfo.cs

@@ -5,12 +5,12 @@ 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("HeaderFooterTest")]
+[assembly: AssemblyTitle("Samples_ComPDFKit")]
 [assembly: AssemblyDescription("")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("HeaderFooterTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyProduct("Samples_ComPDFKit")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 15 - 13
Demo/Examples/Samples/ImageExtractTest/ImageExtractTest.cs

@@ -1,15 +1,6 @@
-using ComPDFKit.Import;
-using ComPDFKit.PDFDocument;
-using ComPDFKit.PDFPage;
+using ComPDFKit.PDFDocument;
 using System;
-using System.Collections.Generic; 
 using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
 
 namespace ImageExtractTest
 {
@@ -19,6 +10,7 @@ namespace ImageExtractTest
 
         static void Main(string[] args)
         {
+            #region Perparation work
             Console.WriteLine("Running Bookmark test sample…\r\n");
 
             SDKLicenseHelper.LicenseVerify();
@@ -30,18 +22,28 @@ namespace ImageExtractTest
                 Directory.CreateDirectory(outputPath);
             }
 
+            #endregion
+
+            #region Sample 1: Extract image
+
             ExtractImage(document);
-            
+            document.Release();
             Console.WriteLine("--------------------");
+
+            #endregion
+
             Console.WriteLine("Done");
             Console.WriteLine("--------------------");
             Console.ReadLine();
         }
 
-        static private bool ExtractImage(CPDFDocument document)
+        /// <summary>
+        /// Extract all images from document
+        /// </summary>
+        /// <param name="document">Regular documet with some picture</param>
+        static private void ExtractImage(CPDFDocument document)
         { 
             document.ExtractImage("1-5", outputPath);
-            return true;
         }
     }
 }

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

@@ -7,7 +7,7 @@
     <ProjectGuid>{DEAF0496-2E3D-4A76-B24E-0E672B21ED3F}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>ImageExtractTest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

+ 3 - 3
Demo/Examples/Samples/ImageExtractTest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("ImageExtractTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 24 - 0
Demo/Examples/Samples/InteractiveFormsTest/InteractiveFormsTest.cs

@@ -41,6 +41,10 @@ namespace InteractiveFormsTest
             Console.ReadLine();
         }
 
+        /// <summary>
+        /// Create text field.
+        /// Text field: used to input text
+        /// </summary> 
         static private void CreateTextField(CPDFDocument document)
         {
             CPDFPage page = document.PageAtIndex(0);
@@ -50,6 +54,10 @@ namespace InteractiveFormsTest
             textField.SetWidgetBgRGBColor(new byte[] {240,255,240});
         }
 
+        /// <summary>
+        ///  Create push button.
+        ///  Push button:  Click to perform some actions, such as jumping to a page or website.
+        /// </summary> 
         static private void CreatePushButton(CPDFDocument document)
         {
             CPDFPage page = document.PageAtIndex(0);
@@ -88,6 +96,9 @@ namespace InteractiveFormsTest
             pushButton2.UpdateFormAp();
         }
 
+        /// <summary>
+        /// Create ListBox
+        /// </summary> 
         static private void CreateListBox(CPDFDocument document)
         {
             CPDFPage page = document.PageAtIndex(0);
@@ -99,6 +110,10 @@ namespace InteractiveFormsTest
             listbox.SetWidgetBgRGBColor(new byte[] { 200, 180, 180 });
         }
 
+        /// <summary>
+        /// Create SignatureField
+        /// Provide an area for electronic signatures.
+        /// </summary> 
         static private void CreateSignatureField(CPDFDocument document)
         {
             CPDFPage page = document.PageAtIndex(0);
@@ -109,6 +124,9 @@ namespace InteractiveFormsTest
             signatureField.SetWidgetBgRGBColor(new byte[] { 150, 180, 210 });
         }
 
+        /// <summary>
+        /// Create CheckBox
+        /// </summary>
         static private void CreateCheckBox(CPDFDocument document)
         {
             CPDFPage page = document.PageAtIndex(0);
@@ -128,6 +146,9 @@ namespace InteractiveFormsTest
             checkBox3.SetWidgetBgRGBColor(new byte[] { 150, 180, 210 });
         }
 
+        /// <summary>
+        /// Create RadioButton
+        /// </summary>
         static private void CreateRadioButton(CPDFDocument document)
         {
             CPDFPage page = document.PageAtIndex(0);
@@ -150,6 +171,9 @@ namespace InteractiveFormsTest
             radioButton3.SetWidgetCheckStyle(C_CHECK_STYLE.CK_CIRCLE);
         }
 
+        /// <summary>
+        /// Generate various signatures.
+        /// </summary>
         static private bool CreateForms(CPDFDocument document)
         {
             CreateTextField(document);

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

@@ -7,7 +7,7 @@
     <ProjectGuid>{FB4B7306-DECC-457C-8F4C-6CE946F753D6}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>InteractiveFormsTest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

+ 3 - 3
Demo/Examples/Samples/InteractiveFormsTest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("InteractiveFormsTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 18 - 16
Demo/Examples/Samples/LicenseKey.cs

@@ -1,35 +1,37 @@
 using ComPDFKit.NativeMethod;
+using System;
 using System.Xml;
 
-public class SDKLicenseHelper
+public static class SDKLicenseHelper
 {
-    public string key = string.Empty;
-    public string secret = string.Empty;
+    public static string key = string.Empty;
+    public static string secret = string.Empty; 
 
-    public SDKLicenseHelper()
+    public static bool LicenseVerify()
     {
         string sdkLicensePath = "license_key_windows.xml";
         XmlDocument xmlDocument = new XmlDocument();
         xmlDocument.Load(sdkLicensePath);
-        var node = xmlDocument.SelectSingleNode("License");
-        if (node != null)
+
+        XmlNode keyNode = xmlDocument.SelectSingleNode("/license/key");
+        XmlNode secretNode = xmlDocument.SelectSingleNode("/license/secret");
+
+        if (keyNode != null && secretNode != null)
         {
-            key = node.Attributes["key"].Value;
-            secret = node.Attributes["secret"].Value;
+            key = keyNode.InnerText;
+            secret = secretNode.InnerText; 
+        }
+        else
+        {
+            Console.WriteLine("Key or secret element not found in the XML.");
         }
-    }
-
-    public static bool LicenseVerify()
-    {
         bool result = CPDFSDKVerifier.LoadNativeLibrary();
         if (!result)
             return false;
 
-        SDKLicenseHelper sdkLicenseHelper = new SDKLicenseHelper();
-
-        LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(sdkLicenseHelper.key, sdkLicenseHelper.secret);
+        LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(key, secret);
         if (verifyResult != LicenseErrorCode.LICENSE_ERR_SUCCESS)
             return false;
         return result;
     }
-}
+}

+ 51 - 8
Demo/Examples/Samples/OutlineTest/OutlineTest.cs

@@ -1,10 +1,7 @@
 using ComPDFKit.PDFDocument;
 using System;
 using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.IO; 
 
 namespace OutlineTest
 {
@@ -16,14 +13,23 @@ namespace OutlineTest
 
         static void Main(string[] args)
         {
+            #region Perparation work
+
             Console.WriteLine("Running Outline test sample…\r\n");
 
             SDKLicenseHelper.LicenseVerify();
-            CPDFDocument document = CPDFDocument.InitWithFilePath("FourOutline.pdf");
+
             if (!Directory.Exists(outputPath))
             {
                 Directory.CreateDirectory(outputPath);
             }
+
+            #endregion
+
+            #region Sample 1: Print outline
+
+            CPDFDocument document = CPDFDocument.InitWithFilePath("FourOutline.pdf");
+                                                                                                
             if (PrintOutline(document))
             {
                 Console.WriteLine("Print outline done.");
@@ -32,10 +38,14 @@ namespace OutlineTest
             {
                 Console.WriteLine("Print outline failed.");
             }
+            document.Release();
 
             Console.WriteLine("--------------------");
 
-            document.Release();
+            #endregion
+
+            #region Sample 2: Create outline
+
             document = CPDFDocument.InitWithFilePath("FourOutline.pdf");
 
             if (CreateOutline(document))
@@ -46,9 +56,14 @@ namespace OutlineTest
             {
                 Console.WriteLine("Create outline failed.");
             }
+            document.Release();
+
             Console.WriteLine("--------------------");
 
-            document.Release();
+            #endregion
+
+            #region Sample 3: Move outline
+
             document = CPDFDocument.InitWithFilePath("FourOutline.pdf");
             if (MoveOutline(document))
             {
@@ -58,9 +73,14 @@ namespace OutlineTest
             {
                 Console.WriteLine("Move outline failed.");
             }
+            document.Release();
+
             Console.WriteLine("--------------------");
 
-            document.Release();
+            #endregion
+
+            #region Sample 4: Remove outline
+
             document = CPDFDocument.InitWithFilePath("FourOutline.pdf");
             if (RemoveOutline(document))
             {
@@ -70,13 +90,20 @@ namespace OutlineTest
             {
                 Console.WriteLine("Remove outline failed.");
             }
+            document.Release();
             Console.WriteLine("--------------------");
+
+            #endregion
+
             Console.WriteLine("Done.");
             Console.WriteLine("--------------------");
 
             Console.ReadLine();
         }
 
+        /// <summary>
+        /// Traverse outline and print it as a list
+        /// </summary>
         static private void TraverseOutline(List<CPDFOutline> outlineList)
         {
             foreach (var outline in outlineList)
@@ -104,6 +131,10 @@ namespace OutlineTest
             }
         }
 
+        /// <summary>
+        /// Print all outlines in the file
+        /// </summary>
+        /// <param name="document">Document with some outlines</param> 
         static private bool PrintOutline(CPDFDocument document)
         {
             List<CPDFOutline> outlineList = document.GetOutlineList();
@@ -114,6 +145,10 @@ namespace OutlineTest
             return true;
         }
 
+        /// <summary>
+        /// Create an outline at the top of the first page
+        /// </summary>
+        /// <param name="document">Document with some outlines</param>
         static private bool CreateOutline(CPDFDocument document)
         {
             CPDFOutline outline = document.GetOutlineRoot();
@@ -125,6 +160,11 @@ namespace OutlineTest
             return true;
         }
 
+        /// <summary>
+        /// Create an outline at the top of the first page
+        /// </summary>
+        /// <param name="document"></param>
+        /// <returns></returns>
         static private bool MoveOutline(CPDFDocument document)
         {
             CPDFOutline outline = document.GetOutlineRoot();
@@ -143,6 +183,9 @@ namespace OutlineTest
             return true;
         }
 
+        /// <summary>
+        /// Remove outline
+        /// </summary>
         static private bool RemoveOutline(CPDFDocument document)
         { 
             document.GetOutlineList()[0].RemoveFromParent(document);

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

@@ -7,7 +7,7 @@
     <ProjectGuid>{7323B63A-6073-4A22-82F5-29023702F2C1}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>OutlineTest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

+ 3 - 3
Demo/Examples/Samples/OutlineTest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("OutlineTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 22 - 9
Demo/Examples/Samples/PDFATest/PDFATest.cs

@@ -1,10 +1,6 @@
 using ComPDFKit.PDFDocument;
 using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.IO; 
 
 namespace PDFATest
 {
@@ -14,6 +10,8 @@ namespace PDFATest
 
         static void Main(string[] args)
         {
+            #region Perparation work
+             
             Console.WriteLine("Running PDFA test sample…\r\n");
 
             SDKLicenseHelper.LicenseVerify();
@@ -24,7 +22,10 @@ namespace PDFATest
             {
                 Directory.CreateDirectory(outputPath);
             }
+            #endregion
+             
             #region PDF/A-1a
+
             if (CovertToPDFA1a(document))
             {
                 Console.WriteLine("Convert to PDF/A-1a done.");
@@ -33,14 +34,17 @@ namespace PDFATest
             {
                 Console.WriteLine("Convert to PDF/A-1a failed.");
             }
-            #endregion
 
+            document.Release();
+            
             Console.WriteLine("--------------------");
 
-            document.Release();
+            #endregion
+             
+            #region PDF/A-1b
+
             document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
 
-            #region PDF/A-1b
             if (CovertToPDFA1b(document))
             {
                 Console.WriteLine("Convert to PDF/A-1b done.");
@@ -49,15 +53,20 @@ namespace PDFATest
             {
                 Console.WriteLine("Convert to PDF/A-1b failed.");
             }
+            document.Release();
+            Console.WriteLine("--------------------");
             #endregion
 
-            Console.WriteLine("--------------------");
             Console.WriteLine("Done!");
             Console.WriteLine("--------------------");
 
             Console.ReadLine();
         }
 
+        /// <summary>
+        /// Save PDF as PDFA1a
+        /// </summary>
+        /// <param name="document">Regular document</param> 
         static public bool CovertToPDFA1a(CPDFDocument document)
         {
             string convertToPDFA1aPath = outputPath + "\\ConvertToPDFA1aTest.pdf";
@@ -69,6 +78,10 @@ namespace PDFATest
             return true;
         }
 
+        /// <summary>
+        /// Save PDF as PDFA1b
+        /// </summary>
+        /// <param name="document">Regular document</param> 
         static public bool CovertToPDFA1b(CPDFDocument document)
         {
             string convertToPDFA1bPath = outputPath + "\\ConvertToPDFA1bTest.pdf";

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

@@ -7,7 +7,7 @@
     <ProjectGuid>{463C349B-D895-4191-B1FD-C507B16B6A8C}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>PDFATest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

+ 3 - 3
Demo/Examples/Samples/PDFATest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("PDFATest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 93 - 42
Demo/Examples/Samples/PDFPageTest/PDFPageTest.cs

@@ -14,6 +14,7 @@ namespace PDFPageTest
         static private string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\PDFPageTest";
         static void Main(string[] args)
         {
+            #region Perparation work
             Console.WriteLine("Running PDFPage test sample…\r\n");
 
             SDKLicenseHelper.LicenseVerify();
@@ -22,6 +23,9 @@ namespace PDFPageTest
             {
                 Directory.CreateDirectory(outputPath);
             }
+            #endregion
+
+            #region Sample 1: Insert blank page
 
             if (InsertBlankPage(document))
             {
@@ -32,8 +36,13 @@ namespace PDFPageTest
                 Console.WriteLine("Insert blank page failed.");
             }
             document.Release();
-            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
             Console.WriteLine("--------------------");
+
+            #endregion
+
+            #region Sample 2: Insert PDF page
+
+            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
             if (InsertPDFPPage(document))
             {
                 Console.WriteLine("Insert PDF page done.");
@@ -43,8 +52,13 @@ namespace PDFPageTest
                 Console.WriteLine("Insert PDF page failed.");
             }
             document.Release();
-            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
             Console.WriteLine("--------------------");
+
+            #endregion
+
+            #region Sample 3: Split pages
+
+            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
             if (SplitPages(document))
             {
                 Console.WriteLine("Split page done.");
@@ -52,21 +66,31 @@ namespace PDFPageTest
             else
             {
                 Console.WriteLine("Split failed.");
-            } 
+            }
             document.Release();
-            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
             Console.WriteLine("--------------------");
-            if (RemovePaes(document))
+
+            #endregion
+
+            #region Sample 4: Remove pages
+
+            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+            if (RemovePages(document))
             {
                 Console.WriteLine("Delete even page done.");
             }
             else
             {
                 Console.WriteLine("Delete even page failed.");
-            } 
+            }
             document.Release();
-            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
             Console.WriteLine("--------------------");
+
+            #endregion
+
+            #region Sample 5: Rotate page
+
+            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
             if (RotatePage(document))
             {
                 Console.WriteLine("Rotate page done.");
@@ -77,8 +101,13 @@ namespace PDFPageTest
             }
 
             document.Release();
-            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
             Console.WriteLine("--------------------");
+
+            #endregion
+
+            #region Sample 6: Repalce pages
+
+            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
             if (RepalcePages(document))
             {
                 Console.WriteLine("Repalce page done.");
@@ -89,8 +118,12 @@ namespace PDFPageTest
             }
 
             document.Release();
-            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
             Console.WriteLine("--------------------");
+
+            #endregion
+
+            #region Sample 7: Extract pages
+            document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
             if (ExtractPages(document))
             {
                 Console.WriteLine("Extract page done.");
@@ -99,14 +132,21 @@ namespace PDFPageTest
             {
                 Console.WriteLine("Extract page failed.");
             }
-
+            document.Release();
             Console.WriteLine("--------------------");
+
+            #endregion
+
             Console.WriteLine("Done");
             Console.WriteLine("--------------------");
 
             Console.ReadLine();
         }
 
+        /// <summary>
+        /// Insert a new page of A4 size at the second page
+        /// </summary>
+        /// <param name="document">Regular five page document</param>
         static private bool InsertBlankPage(CPDFDocument document)
         {
             int pageIndex = 1;
@@ -114,12 +154,7 @@ namespace PDFPageTest
             int pageHeight = 842;
             document.InsertPage(pageIndex, pageWidth, pageHeight, null);
             Console.WriteLine("Insert PageIndex: {0}", pageIndex);
-            Console.WriteLine("Size; {0}*{1}", pageWidth, pageHeight);
-
-            if (document.PageCount != 6)
-            {
-                return false;
-            }
+            Console.WriteLine("Size: {0}*{1}", pageWidth, pageHeight);
 
             string path = outputPath + "\\InsertBlankPageTest.pdf";
             if (!document.WriteToFilePath(path))
@@ -130,14 +165,15 @@ namespace PDFPageTest
             return true;
         }
 
+        /// <summary>
+        /// Select pages from other PDF files and insert them into the current document
+        /// </summary>
+        /// <param name="document">Regular five page document</param>
         static private bool InsertPDFPPage(CPDFDocument document)
         {
             CPDFDocument documentForInsert = CPDFDocument.InitWithFilePath("Text.pdf");
             document.ImportPagesAtIndex(documentForInsert, "1", 1);
-            if (document.PageCount != 6)
-            {
-                return false;
-            }
+
             string path = outputPath + "\\InsertPDFPPageTest.pdf";
             if (!document.WriteToFilePath(path))
             {
@@ -147,46 +183,49 @@ namespace PDFPageTest
             return true;
         }
 
+        /// <summary>
+        /// Split the current document into two documents according to the first 2 pages and the last 3 pages
+        /// </summary>
+        /// <param name="document">Regular five page document</param>
         static private bool SplitPages(CPDFDocument document)
         {
+            //Split 1-2 pages
             CPDFDocument documentPart1 = CPDFDocument.CreateDocument();
-            CPDFDocument documentPart2 = CPDFDocument.CreateDocument();
             documentPart1.ImportPagesAtIndex(document, "1-2", 0);
-            documentPart2.ImportPagesAtIndex(document, "3-5", 0);
-            if (documentPart1.PageCount != 2)
-            {
-                return false;
-            }
+
             string pathPart1 = outputPath + "\\SplitPart1Test.pdf";
             if (!documentPart1.WriteToFilePath(pathPart1))
             {
                 return false;
             }
-            if (documentPart2.PageCount != 3)
-            {
-                return false;
-            }
+            Console.WriteLine("Browse the changed file in " + pathPart1);
+
+            //Split 3-5 pages
+            CPDFDocument documentPart2 = CPDFDocument.CreateDocument();
+            documentPart2.ImportPagesAtIndex(document, "3-5", 0);
+
             string pathPart2 = outputPath + "\\SplitPart2Test.pdf";
             if (!documentPart2.WriteToFilePath(pathPart2))
             {
                 return false;
             }
-            Console.WriteLine("Browse the changed file in " + pathPart1);
             Console.WriteLine("Browse the changed file in " + pathPart2);
             return true;
         }
 
-        static private bool RemovePaes(CPDFDocument document)
+        /// <summary>
+        /// Remove even-numbered pages from a document
+        /// </summary>
+        /// <param name="document">Regular five page document</param> 
+        static private bool RemovePages(CPDFDocument document)
         {
             ArrayList arr = new ArrayList();
-            for (int i = 2; i < document.PageCount; i += 2){
+            for (int i = 1; i < document.PageCount; i += 2)
+            {
                 arr.Add(i);
             }
             document.RemovePages((int[])arr.ToArray(typeof(int)));
-            if(document.PageCount != 3)
-            {
-                return false;
-            } 
+
             string path = outputPath + "\\RemoveEvenPagesTest.pdf";
             if (!document.WriteToFilePath(path))
             {
@@ -196,9 +235,13 @@ namespace PDFPageTest
             return true;
         }
 
+        /// <summary>
+        ///  Rotate the first page 90 degrees clockwise
+        /// </summary>
+        /// <param name="document">Regular five page document</param>
         static private bool RotatePage(CPDFDocument document)
         {
-            document.RotatePage(0, 1);
+            document.RotatePage(0, 1);//Rotation: Rotate 90 degrees per unit
             string path = outputPath + "\\RotatePageTest.pdf";
             if (!document.WriteToFilePath(path))
             {
@@ -208,6 +251,12 @@ namespace PDFPageTest
             return true;
         }
 
+        /// <summary>
+        /// Replace the first page of the current document with a page from another document
+        /// Delete the pages that need to be replaced first
+        /// Insert the required pages into the document
+        /// </summary>
+        /// <param name="document">Regular five page document</param>
         static private bool RepalcePages(CPDFDocument document)
         {
             int[] pageArr = new int[1];
@@ -224,14 +273,16 @@ namespace PDFPageTest
             return true;
         }
 
+        /// <summary>
+        /// Extract pages from a document
+        /// Create a new document
+        /// Insert the required pages into a new document
+        /// </summary>
+        /// <param name="document">Regular five page document</param>
         static private bool ExtractPages(CPDFDocument document)
         {
             CPDFDocument extractDocument = CPDFDocument.CreateDocument();
             extractDocument.ImportPagesAtIndex(document, "1", 0);
-            if (!(extractDocument.PageCount == 1))
-            {
-                return false;
-            }
             string path = outputPath + "\\ExtractPagesTest.pdf";
             if (!extractDocument.WriteToFilePath(path))
             {

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

@@ -7,7 +7,7 @@
     <ProjectGuid>{B776A04B-C674-4A8B-88FC-2431034E8F78}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>PDFPageTest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

+ 3 - 3
Demo/Examples/Samples/PDFPageTest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("PDFPageTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 15 - 11
Demo/Examples/Samples/PDFRedactTest/PDFRedactTest.cs

@@ -2,12 +2,8 @@
 using ComPDFKit.PDFAnnotation;
 using ComPDFKit.PDFDocument;
 using ComPDFKit.PDFPage;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System; 
+using System.IO; 
 using System.Windows;
 
 namespace PDFRedactTest
@@ -17,6 +13,7 @@ namespace PDFRedactTest
         static private string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\Redact";
         static void Main(string[] args)
         {
+            #region Perparation work
             Console.WriteLine("Running redact test sample…\r\n");
             SDKLicenseHelper.LicenseVerify();
 
@@ -29,6 +26,7 @@ namespace PDFRedactTest
             {
                 Directory.CreateDirectory(outputPath);
             }
+            #endregion
 
             #region Redact
             if (Redact(document))
@@ -39,19 +37,24 @@ namespace PDFRedactTest
             {
                 Console.WriteLine("Redact failed.");
             }
-            #endregion
+
             Console.WriteLine("--------------------");
+            #endregion
+
             Console.WriteLine("Done!");
             Console.WriteLine("--------------------");
 
             Console.ReadLine();
         }
 
+        /// <summary>
+        /// Redact an area in PDF
+        /// </summary>
+        /// <param name="document">Regular document with some text</param>
+        /// <returns></returns>
         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(300, 240, 400, 300));
@@ -67,10 +70,9 @@ namespace PDFRedactTest
             redact.SetTextDa(textAttribute);
             redact.SetTextAlignment(C_TEXT_ALIGNMENT.ALIGNMENT_LEFT);
 
-            //Fill color
+            //Properties of cover square
             byte[] fillColor = { 255, 0, 0 };
             redact.SetFillColor(fillColor);
-
             byte[] outlineColor = { 0, 255, 0 };
             redact.SetOutlineColor(outlineColor);
 
@@ -84,6 +86,8 @@ namespace PDFRedactTest
             }
             Console.WriteLine("Browse the changed file in " + path);
             CPDFDocument newDocument = CPDFDocument.InitWithFilePath(path);
+
+            //Validation: try to get the text of the covered area
             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;

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

@@ -7,7 +7,7 @@
     <ProjectGuid>{B18AD53B-9550-489B-A814-E2783D865D9C}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>PDFRedactTest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

+ 3 - 3
Demo/Examples/Samples/PDFRedactTest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("PDFRedactTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 8 - 0
Demo/Examples/Samples/PDFToImage/PDFToImage.cs

@@ -28,6 +28,11 @@ namespace PDFToImageTest
             }
 
             PDFPageToImage(document);
+
+            Console.WriteLine("--------------------");
+            Console.WriteLine("Done!");
+            Console.WriteLine("--------------------");
+
             Console.ReadLine();
         }
 
@@ -41,6 +46,9 @@ namespace PDFToImageTest
             } 
         }
 
+        /// <summary>
+        /// Convert PDF to image
+        /// </summary>
         static private bool PDFPageToImage(CPDFDocument document)
         {
             for (int i = 0; i < document.PageCount; i++)

+ 1 - 1
Demo/Examples/Samples/PDFToImage/PDFToImageTest.csproj

@@ -7,7 +7,7 @@
     <ProjectGuid>{82A11207-3CA9-47D2-9F1C-94FE057DABFE}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>PDFToImage</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

+ 3 - 3
Demo/Examples/Samples/PDFToImage/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("PDFToImage")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 3 - 3
Demo/Examples/Samples/TextExtractTest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("TextExtractTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 6 - 6
Demo/Examples/Samples/TextExtractTest/TextExtractTest.cs

@@ -1,10 +1,6 @@
 using ComPDFKit.PDFDocument;
 using System;
-using System.Collections.Generic;
 using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace TextExtractTest
 {
@@ -14,6 +10,7 @@ namespace TextExtractTest
 
         static void Main(string[] args)
         {
+            #region Perparation work
             Console.WriteLine("Running PDFPage test sample…\r\n");
 
             SDKLicenseHelper.LicenseVerify();
@@ -23,8 +20,9 @@ namespace TextExtractTest
             {
                 Directory.CreateDirectory(outputPath);
             }
+            #endregion
 
-           if(PDFToText(document))
+            if (PDFToText(document))
             {
                 Console.WriteLine("PDF to text done.");
             }
@@ -38,10 +36,12 @@ namespace TextExtractTest
             Console.ReadLine();
         }
 
+        //
         static private bool PDFToText(CPDFDocument document)
         {
             string path = outputPath + "//PDFToText.txt";
-            if (!document.PdfToText("1-" + document.PageCount.ToString(), path)){
+            if (!document.PdfToText("1-" + document.PageCount.ToString(), path))//Page ranges are counted from 1
+            {
                 return false;
             }
             Console.WriteLine("Browse the generated file in " + path);

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

@@ -7,7 +7,7 @@
     <ProjectGuid>{7D255150-76CB-4A65-AFEA-F88778ABF03B}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>TextExtractTest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

+ 3 - 3
Demo/Examples/Samples/TextSearchTest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("TextSearchTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 34 - 9
Demo/Examples/Samples/TextSearchTest/TextSearch.cs

@@ -4,10 +4,7 @@ using ComPDFKit.PDFDocument;
 using ComPDFKit.PDFPage;
 using System;
 using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.IO; 
 using System.Windows;
 
 namespace TextSearchTest
@@ -17,24 +14,35 @@ namespace TextSearchTest
         static private string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\TextSearch";
         static void Main(string[] args)
         {
+            #region Perparation work
             Console.WriteLine("Running text search test sample…\r\n");
-                        if (!Directory.Exists(outputPath))
+            if (!Directory.Exists(outputPath))
             {
                 Directory.CreateDirectory(outputPath);
             }
             SDKLicenseHelper.LicenseVerify();
+
+            #endregion
+
+            #region Sample 1: Search text
+
             CPDFDocument document = CPDFDocument.InitWithFilePath("Text.pdf");
 
             SearchText(document);
-
+            document.Release();
             Console.WriteLine("--------------------");
+
+            #endregion
+            
             Console.WriteLine("Done");
             Console.WriteLine("--------------------");
-
             Console.ReadLine();
         }
 
-        static void SearchForPage(CPDFPage page, string searchKeywords, C_Search_Options option, ref List<Rect> rects, ref List<string> strings)
+        /// <summary>
+        /// Search for keywords in the current page and record the search results.
+        /// </summary> 
+        static private void SearchForPage(CPDFPage page, string searchKeywords, C_Search_Options option, ref List<Rect> rects, ref List<string> strings)
         {
             rects = new List<Rect>();
             strings = new List<string>();
@@ -55,6 +63,9 @@ namespace TextSearchTest
             }
         }
 
+        /// <summary>
+        ///  Highlight the first result
+        /// </summary> 
         static private bool HighlightTheFirstResult(CPDFPage page, Rect rect)
         {
             List<CRect> cRectList = new List<CRect>();
@@ -69,16 +80,30 @@ namespace TextSearchTest
             return true;
         }
 
+        /// <summary>
+        /// Search PDF keywords on the first page of the article, 
+        /// after the search is completed, 
+        /// highlight the first searched keyword and save it
+        /// </summary>
+        /// <param name="document">PDF with text</param> 
         static private bool SearchText(CPDFDocument document)
         {
             CPDFPage page = document.PageAtIndex(0);
+            //rects: The collection of locales where keywords are located.
             List<Rect> rects = new List<Rect>();
+            //strings: The full text of the keyword's area
             List<string> strings = new List<string>();
+
+            //Search for single page
             SearchForPage(page, "PDF", C_Search_Options.Search_Case_Insensitive, ref rects, ref strings);
-            Console.WriteLine("the key PDF have {0} results", rects.Count);
+
+            Console.WriteLine("The pdf have {0} results", rects.Count);
 
             Console.WriteLine("Search finished, now highlight the first result. ");
+
+            //Highlight the first result
             HighlightTheFirstResult(page, rects[0]);
+
             string path = outputPath + "\\HighlightFirstTest.pdf";
             if (!document.WriteToFilePath(path))
             {

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

@@ -7,7 +7,7 @@
     <ProjectGuid>{DD2E08EE-0E64-4AB9-B8DC-03DE7E8B4E04}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>TextSearchTest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

+ 3 - 3
Demo/Examples/Samples/WatermarkTest/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("WatermarkTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyCopyright("Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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")]
+[assembly: AssemblyVersion("1.9.1.0")]
+[assembly: AssemblyFileVersion("1.9.1.0")]

+ 45 - 8
Demo/Examples/Samples/WatermarkTest/WatermarkTest.cs

@@ -1,15 +1,10 @@
 using ComPDFKit.PDFDocument;
 using ComPDFKit.PDFWatermark;
 using System;
-using System.Collections.Generic;
 using System.Drawing;
 using System.Drawing.Imaging;
 using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-using System.Xml.Linq;
+using System.Runtime.InteropServices; 
 
 namespace WatermarkTest
 {
@@ -18,6 +13,7 @@ namespace WatermarkTest
         static private string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\Watermark";
         static void Main(string[] args)
         {
+            #region Perparation work
             Console.WriteLine("Running Watermark test sample…\r\n");
             SDKLicenseHelper.LicenseVerify();
             CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
@@ -26,6 +22,8 @@ namespace WatermarkTest
             {
                 Directory.CreateDirectory(outputPath);
             }
+            #endregion
+            #region Sample 1: Add text watermark.
 
             if (AddTextWatermark(document))
             {
@@ -36,9 +34,16 @@ namespace WatermarkTest
                 Console.WriteLine("Add text watermark failed.");
             }
 
-            Console.WriteLine("--------------------"); 
             document.Release();
+
+            Console.WriteLine("--------------------");
+
+            #endregion
+
+            #region Sample 2: Add image watermark
+
             document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
+
             if (AddImageWatermark(document))
             {
                 Console.WriteLine("Add image watermark done.");
@@ -47,7 +52,15 @@ namespace WatermarkTest
             {
                 Console.WriteLine("Add image watermark failed.");
             }
+
+            document.Release();
+
             Console.WriteLine("--------------------");
+
+            #endregion
+
+            #region Sample 3: Delete watermark
+             
             CPDFDocument textWatermarkDocument = CPDFDocument.InitWithFilePath("Watermark.pdf");
 
             if (DeleteWatermark(textWatermarkDocument))
@@ -58,11 +71,22 @@ namespace WatermarkTest
             {
                 Console.WriteLine("Delete watermark failed.");
             }
+
+            textWatermarkDocument.Release();
+
             Console.WriteLine("--------------------");
+
+            #endregion
+
             Console.WriteLine("Done!");
             Console.WriteLine("--------------------");
             Console.ReadLine();
         }
+
+        /// <summary>
+        /// Add text watermark
+        /// </summary>
+        /// <param name="document">Regular document without watermark.</param> 
         static private bool AddTextWatermark(CPDFDocument document)
         {
             CPDFWatermark watermark = document.InitWatermark(C_Watermark_Type.WATERMARK_TYPE_TEXT);
@@ -93,6 +117,11 @@ namespace WatermarkTest
             return true;
         }
 
+        /// <summary>
+        ///  Convert the bitmap to an array that can be set as an image watermark
+        /// </summary>
+        /// <param name="bitmap">Image source to be used as a image watermark.</param>
+        /// <returns>An array for setting image</returns>
         public static byte[] BitmapToByteArray(Bitmap bitmap)
         {
 
@@ -114,8 +143,12 @@ namespace WatermarkTest
                 if (bmpdata != null)
                     bitmap.UnlockBits(bmpdata);
             }
-
         }
+
+        /// <summary>
+        /// Add image watermark
+        /// </summary>
+        /// <param name="document">Image source to be used as a image watermark.</param> 
         static private bool AddImageWatermark(CPDFDocument document)
         {
             CPDFWatermark watermark = document.InitWatermark(C_Watermark_Type.WATERMARK_TYPE_IMG);
@@ -145,6 +178,10 @@ namespace WatermarkTest
             return true; 
         }
 
+        /// <summary>
+        /// Delete watermark
+        /// </summary>
+        /// <param name="watermarkDocument">Documents with text watermarks</param> 
         static private bool DeleteWatermark(CPDFDocument watermarkDocument)
         {
             watermarkDocument.DeleteWatermarks();

+ 2 - 1
Demo/Examples/Samples/WatermarkTest/WatermarkTest.csproj

@@ -7,7 +7,7 @@
     <ProjectGuid>{8E440DCB-FCBC-4308-AB3D-50C38D017A40}</ProjectGuid>
     <OutputType>Exe</OutputType>
     <RootNamespace>WatermarkTest</RootNamespace>
-    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
@@ -24,6 +24,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>

BIN
Demo/Examples/TestFile/Bates.pdf