Quellcode durchsuchen

compdfkit(win) - Samples 代码调整

weixiangjie vor 11 Monaten
Ursprung
Commit
43f209cadb
37 geänderte Dateien mit 165 neuen und 384 gelöschten Zeilen
  1. 7 5
      Demo/Examples/Samples/AnnotationImportExportTest/CS/AnnotationImportExportTest.csproj
  2. 0 36
      Demo/Examples/Samples/AnnotationImportExportTest/CS/Properties/AssemblyInfo.cs
  3. 1 5
      Demo/Examples/Samples/AnnotationImportExportTest/VB/AnnotationImportExportTest.vbproj
  4. 12 30
      Demo/Examples/Samples/AnnotationTest/CS/AnnotationTest.cs
  5. 16 4
      Demo/Examples/Samples/AnnotationTest/CS/AnnotationTest.csproj
  6. 3 1
      Demo/Examples/Samples/AnnotationTest/CS/Properties/AssemblyInfo.cs
  7. 8 32
      Demo/Examples/Samples/BackgroundTest/CS/BackgroundTest.cs
  8. 10 4
      Demo/Examples/Samples/BackgroundTest/CS/BackgroundTest.csproj
  9. 3 1
      Demo/Examples/Samples/BackgroundTest/CS/Properties/AssemblyInfo.cs
  10. 3 4
      Demo/Examples/Samples/BatesTest/CS/BatesTest.csproj
  11. 3 4
      Demo/Examples/Samples/BookmarkTest/CS/BookmarkTest.csproj
  12. 3 4
      Demo/Examples/Samples/DigitalSignatureTest/CS/DigitalSignatureTest.csproj
  13. 3 0
      Demo/Examples/Samples/DocumentCompare/CS/DocumentCompareTest.csproj
  14. 3 4
      Demo/Examples/Samples/DocumentInfoTest/CS/DocumentInfoTest.csproj
  15. 3 4
      Demo/Examples/Samples/EncryptTest/CS/EncryptTest.csproj
  16. 3 4
      Demo/Examples/Samples/FlattenTest/CS/FlattenTest.csproj
  17. 3 4
      Demo/Examples/Samples/HeaderFooterTest/CS/HeaderFooterTest.csproj
  18. 3 4
      Demo/Examples/Samples/ImageExtractTest/CS/ImageExtractTest.csproj
  19. 3 4
      Demo/Examples/Samples/InteractiveFormsTest/CS/InteractiveFormsTest.csproj
  20. 2 1
      Demo/Examples/Samples/LicenseKey.cs
  21. 3 4
      Demo/Examples/Samples/OutlineTest/CS/OutlineTest.csproj
  22. 3 4
      Demo/Examples/Samples/PDFATest/CS/PDFATest.csproj
  23. 3 4
      Demo/Examples/Samples/PDFPageTest/CS/PDFPageTest.csproj
  24. 3 4
      Demo/Examples/Samples/PDFRedactTest/CS/PDFRedactTest.csproj
  25. 7 6
      Demo/Examples/Samples/PDFToImage/CS/PDFToImage.cs
  26. 6 1
      Demo/Examples/Samples/PDFToImage/CS/PDFToImageTest.csproj
  27. 0 36
      Demo/Examples/Samples/PDFToImage/CS/Properties/AssemblyInfo.cs
  28. 4 2
      Demo/Examples/Samples/PDFToImage/VB/PDFToImageTest.vb
  29. 6 0
      Demo/Examples/Samples/PDFToImage/VB/PDFToImageTest.vbproj
  30. 3 4
      Demo/Examples/Samples/TextExtractTest/CS/TextExtractTest.csproj
  31. 4 1
      Demo/Examples/Samples/TextSearchTest/CS/Properties/AssemblyInfo.cs
  32. 0 119
      Demo/Examples/Samples/TextSearchTest/CS/TextSearch.cs
  33. 6 6
      Demo/Examples/Samples/TextSearchTest/CS/TextSearchTest.cs
  34. 3 4
      Demo/Examples/Samples/TextSearchTest/CS/TextSearchTest.csproj
  35. 4 1
      Demo/Examples/Samples/WatermarkTest/CS/Properties/AssemblyInfo.cs
  36. 9 29
      Demo/Examples/Samples/WatermarkTest/CS/WatermarkTest.cs
  37. 9 4
      Demo/Examples/Samples/WatermarkTest/CS/WatermarkTest.csproj

+ 7 - 5
Demo/Examples/Samples/AnnotationImportExportTest/CS/AnnotationImportExportTest.csproj

@@ -2,16 +2,20 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
       <PlatformTarget>AnyCPU</PlatformTarget>
     </PropertyGroup>
 
+    <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+      <DebugType>full</DebugType>
+    </PropertyGroup>
+
     <ItemGroup>
       <Compile Include="..\..\LicenseKey.cs">
         <Link>LicenseKey.cs</Link>
@@ -19,11 +23,9 @@
     </ItemGroup>
 
     <ItemGroup>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+        <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
-        </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
         <Content Include="..\..\..\TestFile\Annotations.pdf">
             <Link>Annotations.pdf</Link>

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

@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("AnnotationImportExportTest")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("PDF Technologies, Inc.")]
-[assembly: AssemblyProduct("AnnotationImportExportTest")]
-[assembly: AssemblyCopyright("Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components.  If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("e2693237-d8f2-4e1c-b3c3-0b3acfb73728")]
-
-// Version information for an assembly consists of the following four values:
-//
-//      Major Version
-//      Minor Version
-//      Build Number
-//      Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.13.0.0")]
-[assembly: AssemblyFileVersion("1.13.0.0")]

+ 1 - 5
Demo/Examples/Samples/AnnotationImportExportTest/VB/AnnotationImportExportTest.vbproj

@@ -130,14 +130,10 @@
       <Link>license_key_windows.xml</Link>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
-    <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+    <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
       <Link>x64\ComPDFKit.dll</Link>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-      <Link>x86\ComPDFKit.dll</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="ComPDFKit_Logo.ico" />
   </ItemGroup>
   <ItemGroup>

+ 12 - 30
Demo/Examples/Samples/AnnotationTest/CS/AnnotationTest.cs

@@ -8,6 +8,7 @@ using System.Drawing;
 using System.Drawing.Imaging;
 using System.IO;
 using System.Runtime.InteropServices;
+using ImageMagick;
 
 namespace AnnotationTest
 {
@@ -226,30 +227,7 @@ namespace AnnotationTest
             squiggy.UpdateAp();
 
         }
-
-        public static byte[] BitmapToByteArray(Bitmap bitmap)
-        {
-
-            BitmapData bmpdata = null;
-
-            try
-            {
-                bmpdata = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, bitmap.PixelFormat);
-                int numbytes = bmpdata.Stride * bitmap.Height;
-                byte[] bytedata = new byte[numbytes];
-                IntPtr ptr = bmpdata.Scan0;
-
-                Marshal.Copy(ptr, bytedata, 0, numbytes);
-
-                return bytedata;
-            }
-            finally
-            {
-                if (bmpdata != null)
-                    bitmap.UnlockBits(bmpdata);
-            }
-
-        }
+        
 
         /// <summary>
         /// Create stamp annotation
@@ -272,13 +250,17 @@ namespace AnnotationTest
             text.UpdateAp();
 
             // Image
-            byte[] imageBytes = File.ReadAllBytes("logo.png");
+            CPDFStampAnnotation stampAnnotation = page.CreateAnnot(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP) as CPDFStampAnnotation;
+            
+            using (var image = new MagickImage("ComPDFKit_Logo.ico"))
+            {
+                byte[] byteArray = image.ToByteArray(MagickFormat.Bgra);
+                stampAnnotation.SetImageStamp(byteArray, image.Width, image.Height);
+            }
             
-            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();
+            stampAnnotation.SetRect(new CRect(300, 320, 380, 400));
+            stampAnnotation.SetTransparency(255);
+            stampAnnotation.UpdateAp();
         }
 
 

+ 16 - 4
Demo/Examples/Samples/AnnotationTest/CS/AnnotationTest.csproj

@@ -6,6 +6,7 @@
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
@@ -19,12 +20,19 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+      <Content Include="..\..\..\TestFile\Annotations.pdf">
+        <Link>Annotations.pdf</Link>
+        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+      </Content>
+      <Content Include="..\..\..\TestFile\Bird.wav">
+        <Link>Bird.wav</Link>
+        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+      </Content>
+        
 
       <Content Include="..\..\..\TestFile\CommonFivePage.pdf">
         <Link>CommonFivePage.pdf</Link>
@@ -47,4 +55,8 @@
     </ProjectReference>
   </ItemGroup>
 
+    <ItemGroup>
+      <PackageReference Include="Magick.NET-Q8-x64" Version="13.6.0" />
+    </ItemGroup>
+
 </Project>

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

@@ -1,4 +1,5 @@
-using System.Reflection;
+/*
+using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
@@ -34,3 +35,4 @@ using System.Runtime.InteropServices;
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.13.0.0")]
 [assembly: AssemblyFileVersion("1.13.0.0")]
+*/

+ 8 - 32
Demo/Examples/Samples/BackgroundTest/CS/BackgroundTest.cs

@@ -3,7 +3,8 @@ using System;
 using System.Drawing;
 using System.Drawing.Imaging;
 using System.IO;
-using System.Runtime.InteropServices; 
+using System.Runtime.InteropServices;
+using ImageMagick;
 
 namespace BackgroundTest
 {
@@ -89,35 +90,6 @@ namespace BackgroundTest
             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)
-        {
-
-            BitmapData bmpdata = null;
-
-            try
-            {
-                bmpdata = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, bitmap.PixelFormat);
-                int numbytes = bmpdata.Stride * bitmap.Height;
-                byte[] bytedata = new byte[numbytes];
-                IntPtr ptr = bmpdata.Scan0;
-
-                Marshal.Copy(ptr, bytedata, 0, numbytes);
-
-                return bytedata;
-            }
-            finally
-            {
-                if (bmpdata != null)
-                    bitmap.UnlockBits(bmpdata);
-            }
-
-        }
-
         /// <summary>
         /// Add image background.
         /// </summary>
@@ -126,8 +98,12 @@ namespace BackgroundTest
         {
             CPDFBackground background = document.GetBackground();
             background.SetBackgroundType(C_Background_Type.BG_TYPE_IMAGE);
-            Bitmap bitmap = new Bitmap("logo.png");
-            background.SetImage(BitmapToByteArray(bitmap), bitmap.Width, bitmap.Height, ComPDFKit.Import.C_Scale_Type.fitCenter);
+            
+            using (var image = new MagickImage("ComPDFKit_Logo.ico"))
+            {
+                byte[] byteArray = image.ToByteArray(MagickFormat.Bgra);
+                background.SetImage(byteArray, image.Width, image.Height, ComPDFKit.Import.C_Scale_Type.fitCenter);
+            }
             background.SetOpacity(128);//0-255
             background.SetScale(1);//1 == 100%
             background.SetRotation(1f);//Use radians

+ 10 - 4
Demo/Examples/Samples/BackgroundTest/CS/BackgroundTest.csproj

@@ -6,6 +6,7 @@
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
@@ -19,14 +20,14 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
       <Content Include="..\..\..\TestFile\ColorBackground.pdf">
         <Link>ColorBackground.pdf</Link>
+        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       </Content>
       <Content Include="..\..\..\TestFile\CommonFivePage.pdf">
         <Link>CommonFivePage.pdf</Link>
@@ -34,6 +35,7 @@
       </Content>
       <Content Include="..\..\..\TestFile\ImageBackground.pdf">
         <Link>ImageBackground.pdf</Link>
+        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       </Content>
       <Content Include="..\..\ComPDFKit_Logo.ico">
         <Link>ComPDFKit_Logo.ico</Link>
@@ -52,4 +54,8 @@
     </ProjectReference>
   </ItemGroup>
 
+    <ItemGroup>
+      <PackageReference Include="Magick.NET-Q8-x64" Version="13.6.0" />
+    </ItemGroup>
+
 </Project>

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

@@ -1,4 +1,5 @@
-using System.Reflection;
+/*
+using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
@@ -34,3 +35,4 @@ using System.Runtime.InteropServices;
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.13.0.0")]
 [assembly: AssemblyFileVersion("1.13.0.0")]
+*/

+ 3 - 4
Demo/Examples/Samples/BatesTest/CS/BatesTest.csproj

@@ -12,12 +12,11 @@
     </PropertyGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
       <Content Include="..\..\..\TestFile\Bates.pdf">
         <Link>Bates.pdf</Link>
       </Content>

+ 3 - 4
Demo/Examples/Samples/BookmarkTest/CS/BookmarkTest.csproj

@@ -19,12 +19,11 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
       <Content Include="..\..\..\TestFile\CommonFivePage.pdf">
         <Link>CommonFivePage.pdf</Link>
         <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

+ 3 - 4
Demo/Examples/Samples/DigitalSignatureTest/CS/DigitalSignatureTest.csproj

@@ -19,12 +19,11 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
       <Content Include="..\..\..\TestFile\a.pfx">
         <Link>a.pfx</Link>
       </Content>

+ 3 - 0
Demo/Examples/Samples/DocumentCompare/CS/DocumentCompareTest.csproj

@@ -85,6 +85,9 @@
       <Link>license_key_windows.xml</Link>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
+      <Link>x64\ComPDFKit.dll</Link>
+    </Content>
     <Content Include="ComPDFKit_Logo.ico" />
   </ItemGroup>
   <ItemGroup>

+ 3 - 4
Demo/Examples/Samples/DocumentInfoTest/CS/DocumentInfoTest.csproj

@@ -19,12 +19,11 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
       <Content Include="..\..\..\TestFile\CommonFivePage.pdf">
         <Link>CommonFivePage.pdf</Link>
         <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

+ 3 - 4
Demo/Examples/Samples/EncryptTest/CS/EncryptTest.csproj

@@ -19,12 +19,11 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
       <Content Include="..\..\..\TestFile\AllPasswords.pdf">
         <Link>AllPasswords.pdf</Link>
       </Content>

+ 3 - 4
Demo/Examples/Samples/FlattenTest/CS/FlattenTest.csproj

@@ -19,12 +19,11 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
       <Content Include="..\..\..\TestFile\Annotations.pdf">
         <Link>Annotations.pdf</Link>
         <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

+ 3 - 4
Demo/Examples/Samples/HeaderFooterTest/CS/HeaderFooterTest.csproj

@@ -19,12 +19,11 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
       <Content Include="..\..\..\TestFile\CommonFivePage.pdf">
         <Link>CommonFivePage.pdf</Link>
         <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

+ 3 - 4
Demo/Examples/Samples/ImageExtractTest/CS/ImageExtractTest.csproj

@@ -19,12 +19,11 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
       <Content Include="..\..\..\TestFile\CommonFivePage.pdf">
         <Link>CommonFivePage.pdf</Link>
         <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

+ 3 - 4
Demo/Examples/Samples/InteractiveFormsTest/CS/InteractiveFormsTest.csproj

@@ -19,12 +19,11 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
 
       <Content Include="..\..\..\TestFile\CommonFivePage.pdf">
         <Link>CommonFivePage.pdf</Link>

Datei-Diff unterdrückt, da er zu groß ist
+ 2 - 1
Demo/Examples/Samples/LicenseKey.cs


+ 3 - 4
Demo/Examples/Samples/OutlineTest/CS/OutlineTest.csproj

@@ -19,12 +19,11 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
 
       <Content Include="..\..\..\TestFile\CommonFivePage.pdf">
         <Link>CommonFivePage.pdf</Link>

+ 3 - 4
Demo/Examples/Samples/PDFATest/CS/PDFATest.csproj

@@ -19,12 +19,11 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
 
       <Content Include="..\..\..\TestFile\CommonFivePage.pdf">
         <Link>CommonFivePage.pdf</Link>

+ 3 - 4
Demo/Examples/Samples/PDFPageTest/CS/PDFPageTest.csproj

@@ -19,12 +19,11 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
 
       <Content Include="..\..\..\TestFile\CommonFivePage.pdf">
         <Link>CommonFivePage.pdf</Link>

+ 3 - 4
Demo/Examples/Samples/PDFRedactTest/CS/PDFRedactTest.csproj

@@ -19,12 +19,11 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
 
       <Content Include="..\..\..\TestFile\CommonFivePage.pdf">
         <Link>CommonFivePage.pdf</Link>

+ 7 - 6
Demo/Examples/Samples/PDFToImage/CS/PDFToImage.cs

@@ -9,6 +9,7 @@ using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
+using ComPDFKit.Import;
 
 namespace PDFToImageTest
 {
@@ -61,14 +62,14 @@ namespace PDFToImageTest
             for (int i = 0; i < document.PageCount; i++)
             {
                 CPDFPage pdfPage = document.PageAtIndex(i, true);
-                Size pageSize = document.GetPageSize(0);
-                Rect pageRect = new Rect(0, 0, (int)(pageSize.Width / 72.0 * 96), (int)(pageSize.Height / 72.0 * 96));
-                byte[] bmpData = new byte[(int)(pageRect.Width * pageRect.Height * (96 / 72.0) * (96 / 72.0) * 4)];
+                CSize cSize = document.GetPageSize(0);
+                Size pageSize = new Size(cSize.width, cSize.height);
+                CRect pageRect = new CRect(0, (int)(pageSize.Height / 72.0 * 96), (int)(pageSize.Width / 72.0 * 96), 0);
+                byte[] bmpData = new byte[(int)(pageRect.width() * pageRect.height() * (96 / 72.0) * (96 / 72.0) * 4)];
                 pdfPage.RenderPageBitmapWithMatrix((float)(96 / 72.0), pageRect, 0xFFFFFFFF, bmpData, 0, true);
+                WriteableBitmap writeableBitmap = new WriteableBitmap((int)pageRect.width(), (int)pageRect.height(), 96, 96, PixelFormats.Bgra32, null);
 
-                WriteableBitmap writeableBitmap = new WriteableBitmap((int)pageRect.Width, (int)pageRect.Height, 96, 96, PixelFormats.Bgra32, null);
-
-                writeableBitmap.WritePixels(new Int32Rect(0, 0, (int)pageRect.Width, (int)pageRect.Height), bmpData, writeableBitmap.BackBufferStride, 0);
+                writeableBitmap.WritePixels(new Int32Rect(0, 0, (int)pageRect.width(), (int)pageRect.height()), bmpData, writeableBitmap.BackBufferStride, 0);
                 var path = outputPath + @"\PDFToImageTest" + i + ".png";
                 SaveWriteableBitmapAsPng(writeableBitmap, path);
                 Console.WriteLine("Png image saved in {0}", path);

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

@@ -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>
@@ -33,6 +34,7 @@
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <Prefer32bit>false</Prefer32bit>
   </PropertyGroup>
   <PropertyGroup>
     <ApplicationIcon>ComPDFKit_Logo.ico</ApplicationIcon>
@@ -57,7 +59,6 @@
       <Link>LicenseKey.cs</Link>
     </Compile>
     <Compile Include="PDFToImage.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\..\TestFile\CommonFivePage.pdf">
@@ -72,6 +73,10 @@
       <Link>license_key_windows.xml</Link>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
+      <Link>x64\ComPDFKit.dll</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="ComPDFKit_Logo.ico" />
   </ItemGroup>
   <ItemGroup>

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

@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("PDFToImage")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("PDF Technologies, Inc.")]
-[assembly: AssemblyProduct("PDFToImage")]
-[assembly: AssemblyCopyright("Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components.  If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("82a11207-3ca9-47d2-9f1c-94fe057dabfe")]
-
-// Version information for an assembly consists of the following four values:
-//
-//      Major Version
-//      Minor Version
-//      Build Number
-//      Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.13.0.0")]
-[assembly: AssemblyFileVersion("1.13.0.0")]

+ 4 - 2
Demo/Examples/Samples/PDFToImage/VB/PDFToImageTest.vb

@@ -7,6 +7,7 @@ Imports System.IO
 Imports System.Windows
 Imports System.Windows.Media
 Imports System.Windows.Media.Imaging
+Imports ComPDFKit.Import
 
 Module PDFToImageTest
     Private parentPath As String =
@@ -44,8 +45,9 @@ Module PDFToImageTest
     Private Function PDFPageToImage(document As CPDFDocument) As Boolean
         For i As Integer = 0 To document.PageCount - 1
             Dim pdfPage As CPDFPage = document.PageAtIndex(i, True)
-            Dim pageSize As Windows.Size = document.GetPageSize(0)
-            Dim pageRect As New Rect(0, 0, CInt(pageSize.Width / 72.0 * 96), CInt(pageSize.Height / 72.0 * 96))
+            Dim cSize As CSize = document.GetPageSize(0)
+            Dim pageSize As Windows.Size = New Windows.Size(cSize.Width, cSize.Height)
+            Dim pageRect As New CRect(0, CInt(pageSize.Height / 72.0 * 96), CInt(pageSize.Width / 72.0 * 96), 0)
             Dim bmpData As Byte() = New Byte(CInt(pageRect.Width * pageRect.Height * (96 / 72.0) * (96 / 72.0) * 4) - 1) {}
             pdfPage.RenderPageBitmapWithMatrix(CSng(96 / 72.0), pageRect, Convert.ToUInt32(&HFFFFFFF), bmpData, 0, True)
 

+ 6 - 0
Demo/Examples/Samples/PDFToImage/VB/PDFToImageTest.vbproj

@@ -26,6 +26,7 @@
     <OutputPath>bin\Debug\</OutputPath>
     <DocumentationFile>Samples_ComPDFKit.xml</DocumentationFile>
     <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+    <Prefer32bit>false</Prefer32bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -36,6 +37,7 @@
     <OutputPath>bin\Release\</OutputPath>
     <DocumentationFile>Samples_ComPDFKit.xml</DocumentationFile>
     <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+    <Prefer32bit>false</Prefer32bit>
   </PropertyGroup>
   <PropertyGroup>
     <OptionExplicit>On</OptionExplicit>
@@ -126,6 +128,10 @@
       <Link>license_key_windows.xml</Link>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
+      <Link>x64\ComPDFKit.dll</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="ComPDFKit_Logo.ico" />
   </ItemGroup>
   <ItemGroup>

+ 3 - 4
Demo/Examples/Samples/TextExtractTest/CS/TextExtractTest.csproj

@@ -19,12 +19,11 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
 
       <Content Include="..\..\..\TestFile\CommonFivePage.pdf">
         <Link>CommonFivePage.pdf</Link>

+ 4 - 1
Demo/Examples/Samples/TextSearchTest/CS/Properties/AssemblyInfo.cs

@@ -1,4 +1,6 @@
-using System.Reflection;
+#if NET7_0
+#else
+using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
@@ -34,3 +36,4 @@ using System.Runtime.InteropServices;
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.13.0.0")]
 [assembly: AssemblyFileVersion("1.13.0.0")]
+#endif

+ 0 - 119
Demo/Examples/Samples/TextSearchTest/CS/TextSearch.cs

@@ -1,119 +0,0 @@
-using ComPDFKit.Import;
-using ComPDFKit.PDFAnnotation;
-using ComPDFKit.PDFDocument;
-using ComPDFKit.PDFPage;
-using System;
-using System.Collections.Generic;
-using System.IO; 
-using System.Windows;
-
-namespace TextSearchTest
-{
-    internal class TextSearch
-    {
-        private static string parentPath =
-            Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory())));
-        private static string outputPath = parentPath + "\\Output\\CS";
-        static void Main(string[] args)
-        {
-            #region Perparation work
-            Console.WriteLine("Running text search test sample…\r\n");
-            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();
-        }
-
-        /// <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>();
-            int findIndex = 0;
-
-            CPDFTextPage textPage = page.GetTextPage();
-            CPDFTextSearcher searcher = new CPDFTextSearcher();
-
-            if (searcher.FindStart(textPage, searchKeywords, option, 0))
-            {
-                CRect textRect = new CRect();
-                string textContent = "";
-                while (searcher.FindNext(page, textPage, ref textRect, ref textContent, ref findIndex))
-                {
-                    strings.Add(textContent);
-                    rects.Add(new Rect(textRect.left, textRect.top, textRect.width(), textRect.height()));
-                }
-            }
-        }
-
-        /// <summary>
-        ///  Highlight the first result
-        /// </summary> 
-        static private bool HighlightTheFirstResult(CPDFPage page, Rect rect)
-        {
-            List<CRect> cRectList = new List<CRect>();
-            cRectList.Add(new CRect((float)rect.Left, (float)rect.Top, (float)rect.Right, (float)rect.Bottom));
-
-            CPDFHighlightAnnotation annotation = page.CreateAnnot(C_ANNOTATION_TYPE.C_ANNOTATION_HIGHLIGHT) as CPDFHighlightAnnotation;
-            byte[] color = { 0, 255, 0 };
-            annotation.SetColor(color);
-            annotation.SetTransparency(120);
-            annotation.SetQuardRects(cRectList);
-            annotation.UpdateAp();
-            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 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))
-            {
-                return false;
-            }
-            Console.WriteLine("Browse the changed file in " + path);
-            return true;
-        }
-
-    }
-}

+ 6 - 6
Demo/Examples/Samples/TextSearchTest/CS/TextSearchTest.cs

@@ -44,9 +44,9 @@ namespace TextSearchTest
         /// <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)
+        static private void SearchForPage(CPDFPage page, string searchKeywords, C_Search_Options option, ref List<CRect> rects, ref List<string> strings)
         {
-            rects = new List<Rect>();
+            rects = new List<CRect>();
             strings = new List<string>();
             int findIndex = 0;
 
@@ -60,7 +60,7 @@ namespace TextSearchTest
                 while (searcher.FindNext(page, textPage, ref textRect, ref textContent, ref findIndex))
                 {
                     strings.Add(textContent);
-                    rects.Add(new Rect(textRect.left, textRect.top, textRect.width(), textRect.height()));
+                    rects.Add(new CRect(textRect.left, textRect.top, textRect.width(), textRect.height()));
                 }
             }
         }
@@ -68,10 +68,10 @@ namespace TextSearchTest
         /// <summary>
         ///  Highlight the first result
         /// </summary> 
-        static private bool HighlightTheFirstResult(CPDFPage page, Rect rect)
+        static private bool HighlightTheFirstResult(CPDFPage page, CRect rect)
         {
             List<CRect> cRectList = new List<CRect>();
-            cRectList.Add(new CRect((float)rect.Left, (float)rect.Top, (float)rect.Right, (float)rect.Bottom));
+            cRectList.Add(new CRect((float)rect.left, (float)rect.bottom, (float)rect.right, (float)rect.top));
 
             CPDFHighlightAnnotation annotation = page.CreateAnnot(C_ANNOTATION_TYPE.C_ANNOTATION_HIGHLIGHT) as CPDFHighlightAnnotation;
             byte[] color = { 0, 255, 0 };
@@ -92,7 +92,7 @@ namespace TextSearchTest
         {
             CPDFPage page = document.PageAtIndex(0);
             //rects: The collection of locales where keywords are located.
-            List<Rect> rects = new List<Rect>();
+            List<CRect> rects = new List<CRect>();
             //strings: The full text of the keyword's area
             List<string> strings = new List<string>();
 

+ 3 - 4
Demo/Examples/Samples/TextSearchTest/CS/TextSearchTest.csproj

@@ -19,12 +19,11 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
 
       <Content Include="..\..\..\TestFile\CommonFivePage.pdf">
         <Link>CommonFivePage.pdf</Link>

+ 4 - 1
Demo/Examples/Samples/WatermarkTest/CS/Properties/AssemblyInfo.cs

@@ -1,4 +1,6 @@
-using System.Reflection;
+#if NET7_0
+#else
+using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
@@ -34,3 +36,4 @@ using System.Runtime.InteropServices;
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.13.0.0")]
 [assembly: AssemblyFileVersion("1.13.0.0")]
+#endif

+ 9 - 29
Demo/Examples/Samples/WatermarkTest/CS/WatermarkTest.cs

@@ -4,7 +4,8 @@ using System;
 using System.Drawing;
 using System.Drawing.Imaging;
 using System.IO;
-using System.Runtime.InteropServices; 
+using System.Runtime.InteropServices;
+using ImageMagick;
 
 namespace WatermarkTest
 {
@@ -117,32 +118,7 @@ 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)
-        {
-            BitmapData bmpdata = null;
-            try
-            {
-                bmpdata = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, bitmap.PixelFormat);
-                int numbytes = bmpdata.Stride * bitmap.Height;
-                byte[] bytedata = new byte[numbytes];
-                IntPtr ptr = bmpdata.Scan0;
-
-                Marshal.Copy(ptr, bytedata, 0, numbytes);
-
-                return bytedata;
-            }
-            finally
-            {
-                if (bmpdata != null)
-                    bitmap.UnlockBits(bmpdata);
-            }
-        }
+        
 
         /// <summary>
         /// Add image watermark
@@ -151,8 +127,12 @@ namespace WatermarkTest
         static private bool AddImageWatermark(CPDFDocument document)
         {
             CPDFWatermark watermark = document.InitWatermark(C_Watermark_Type.WATERMARK_TYPE_IMG);
-            Bitmap bitmap = new Bitmap("logo.png");
-            watermark.SetImage(BitmapToByteArray(bitmap), bitmap.Width, bitmap.Height);
+            
+            using (var image = new MagickImage("ComPDFKit_Logo.ico"))
+            {
+                byte[] byteArray = image.ToByteArray(MagickFormat.Bgra);
+                watermark.SetImage(byteArray, image.Width, image.Height);
+            }
             watermark.SetPages("0-3");
             watermark.SetScale(2);
             watermark.SetRotation(1);

+ 9 - 4
Demo/Examples/Samples/WatermarkTest/CS/WatermarkTest.csproj

@@ -6,6 +6,7 @@
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
@@ -19,12 +20,11 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x64\ComPDFKit.dll">
+      <Content Include="..\..\..\..\..\..\x64\ComPDFKit.dll">
           <Link>x64\ComPDFKit.dll</Link>
+          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
         </Content>
-        <Content Include="..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\x86\ComPDFKit.dll">
-          <Link>x86\ComPDFKit.dll</Link>
-        </Content>
+        
 
       <Content Include="..\..\..\TestFile\CommonFivePage.pdf">
         <Link>CommonFivePage.pdf</Link>
@@ -33,6 +33,7 @@
 
       <Content Include="..\..\..\TestFile\Watermark.pdf">
         <Link>Watermark.pdf</Link>
+        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       </Content>
       <Content Include="..\..\ComPDFKit_Logo.ico">
         <Link>ComPDFKit_Logo.ico</Link>
@@ -51,4 +52,8 @@
     </ProjectReference>
   </ItemGroup>
 
+    <ItemGroup>
+      <PackageReference Include="Magick.NET-Q8-x64" Version="13.6.0" />
+    </ItemGroup>
+
 </Project>