Browse Source

ComPDFKit(win)-Redact

liuaoran 1 năm trước cách đây
mục cha
commit
fb6b2d5003

+ 7 - 0
Demo/Examples/Examlpes.sln

@@ -28,6 +28,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeaderFooterTest", "Samples
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatesTest", "Samples\BatesTest\BatesTest.csproj", "{5CE5B624-B2B8-479C-8842-B70591B01124}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDFRedactTest", "Samples\PDFRedactTest\PDFRedactTest.csproj", "{B18AD53B-9550-489B-A814-E2783D865D9C}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -70,6 +72,10 @@ Global
 		{5CE5B624-B2B8-479C-8842-B70591B01124}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{5CE5B624-B2B8-479C-8842-B70591B01124}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{5CE5B624-B2B8-479C-8842-B70591B01124}.Release|Any CPU.Build.0 = Release|Any CPU
+		{B18AD53B-9550-489B-A814-E2783D865D9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{B18AD53B-9550-489B-A814-E2783D865D9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{B18AD53B-9550-489B-A814-E2783D865D9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{B18AD53B-9550-489B-A814-E2783D865D9C}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -77,6 +83,7 @@ Global
 	GlobalSection(NestedProjects) = preSolution
 		{5AF53BD9-A085-4550-8F78-98CCFFFDCDA9} = {812D8275-2791-4CEF-A4E8-39A78E49D8FB}
 		{5CE5B624-B2B8-479C-8842-B70591B01124} = {812D8275-2791-4CEF-A4E8-39A78E49D8FB}
+		{B18AD53B-9550-489B-A814-E2783D865D9C} = {812D8275-2791-4CEF-A4E8-39A78E49D8FB}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {8EE774F1-5FBF-482A-9A31-5ABDEC216DEF}

+ 0 - 15
Demo/Examples/HeaderFooterTest/Program.cs

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

+ 117 - 10
Demo/Examples/Samples/BatesTest/BatesTest.cs

@@ -11,9 +11,20 @@ namespace BatesTest
     internal class BatesTest
     {
         private static string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\Bates";
+        
+        private static Dictionary<int, string> IntToLocationDic = new Dictionary<int, string>()
+        {
+            {0, "Top Left" },
+            {1, "Top Middle" },
+            {2, "Top Right" },
+            {3, "Bottom Left" },
+            {4, "Bottom Middle" },
+            {5, "Bottom Right" }
+        };
 
         static void Main(string[] args)
         {
+            Console.WriteLine("Running bates test sample…\r\n");
             SDKLicenseHelper.LicenseVerify();
 
             CPDFDocument document = CPDFDocument.InitWithFilePath("Blank Page.pdf");
@@ -23,33 +34,129 @@ namespace BatesTest
                 Directory.CreateDirectory(outputPath);
             }
 
-            AddBates(document); 
+            #region Add bates
+            if (AddBates(document))
+            {
+                Console.WriteLine("Add bates done.");
+            }
+            else
+            {
+                Console.WriteLine("Add bates failed.");
+            }
+            #endregion
+            Console.WriteLine("--------------------");
+
+            #region Edit bates
+            if (EditBates(document))
+            {
+                Console.WriteLine("Edit bates done.");
+            }
+            else
+            {
+                Console.WriteLine("Edit bates failed.");
+            }
+            #endregion
+            Console.WriteLine("--------------------");
 
+            #region Clear bates
+            if (ClearBates(document))
+            {
+                Console.WriteLine("Clear bates done.");
+            }
+            else
+            {
+                Console.WriteLine("Clear bates failed.");
+            }
+            #endregion
+            Console.WriteLine("--------------------");
+            Console.WriteLine("Done!");
+            Console.WriteLine("--------------------");
+             
             Console.ReadLine();
         }
 
-        private static void AddBates(CPDFDocument document)
+        private static bool AddBates(CPDFDocument document)
         {
-            string addBatesPath = outputPath + "\\Blank Page_AddBates.pdf";
-
+            string addBatesPath = outputPath + "\\AddBatesTest.pdf";
 
             CPDFBates bates = document.GetBates();
-            bates.SetText(4, @"<<#3#5#Prefix-#-Suffix>>");
             byte[] color = { 255, 0, 0 };
-            bates.SetTextColor(4, color);
-            bates.SetFontSize(4, 14);
+             
             bates.SetPages("0-" + (document.PageCount - 1));
+
+            for (int i = 0; i <= 5; i++)
+            {
+                bates.SetText(i, @"<<#3#5#Prefix-#-Suffix>>"); 
+                bates.SetTextColor(i, color);
+                bates.SetFontSize(i, 14);
+
+
+                Console.WriteLine("Text: {0}", bates.GetText(i));
+                Console.WriteLine("Location: {0}\n", IntToLocationDic[i]);
+            }
+
             bates.Update();
 
             if (document.WriteToFilePath(addBatesPath))
             {
                 Console.WriteLine("Browse the changed file in " + addBatesPath);
-                Console.WriteLine("********** Add Bates succeeded **********");
-                return;
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        private static bool EditBates(CPDFDocument document)
+        {
+
+            CPDFBates bates = document.GetBates();
+            if(bates.GetText(0) != string.Empty)
+            {
+                Console.WriteLine("Get old bates 0 succeeded, text is {0}", bates.GetText(0));
+            }
+            else
+            {
+                Console.WriteLine("Get bates 0 failed, or it does not exist");
+                return false;
+            }
+
+            bates.SetText(0, @"<<#3#1#ComPDFKit-#-ComPDFKit>>");
+
+            bates.Update();
+             
+            Console.WriteLine("Change bates 0 succeeded, new text is {0}", bates.GetText(0));
+
+            string editBatesPath = outputPath + "\\EditBatesTest.pdf";
+
+            if (document.WriteToFilePath(editBatesPath))
+            {
+                Console.WriteLine("Browse the changed file in " + editBatesPath);
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        private static bool ClearBates(CPDFDocument document)
+        {
+            CPDFBates bates = document.GetBates();
+
+            bates.Clear();
+
+            string clearBatesPath = outputPath + "\\ClearBatesTest.pdf";
+
+            if (document.WriteToFilePath(clearBatesPath))
+            {
+                Console.WriteLine("Browse the changed file in " + clearBatesPath);
+                return true;
             }
             else
             {
-                Console.WriteLine("********** Add Bates failed **********");
+                return false;
             }
         }
     }

+ 0 - 45
Demo/Examples/Samples/BatesTest/Blank Page.pdf

@@ -1,45 +0,0 @@
-%PDF-1.7
-%¡³Å×
-1 0 obj
-<</Pages 2 0 R /Type/Catalog>>
-endobj
-2 0 obj
-<</Count 5/Kids[ 4 0 R  5 0 R  8 0 R  7 0 R  6 0 R ]/Type/Pages>>
-endobj
-3 0 obj
-<</CreationDate(D:20230704151320)>>
-endobj
-4 0 obj
-<</MediaBox[ 0 0 595 842]/Parent 2 0 R /Resources<<>>/Rotate 0/Type/Page>>
-endobj
-5 0 obj
-<</MediaBox[ 0 0 595 842]/Parent 2 0 R /Resources<<>>/Rotate 0/Type/Page>>
-endobj
-6 0 obj
-<</MediaBox[ 0 0 595 842]/Parent 2 0 R /Resources<<>>/Rotate 0/Type/Page>>
-endobj
-7 0 obj
-<</MediaBox[ 0 0 595 842]/Parent 2 0 R /Resources<<>>/Rotate 0/Type/Page>>
-endobj
-8 0 obj
-<</MediaBox[ 0 0 595 842]/Parent 2 0 R /Resources<<>>/Rotate 0/Type/Page>>
-endobj
-xref
-0 9
-0000000000 65535 f
-0000000017 00000 n
-0000000066 00000 n
-0000000150 00000 n
-0000000204 00000 n
-0000000297 00000 n
-0000000390 00000 n
-0000000483 00000 n
-0000000576 00000 n
-trailer
-<<
-/Root 1 0 R
-/Info 3 0 R
-/Size 9/ID[<7800A4991AF561A4D70D3004F5E43166><7800A4991AF561A4D70D3004F5E43166>]>>
-startxref
-669
-%%EOF

+ 0 - 45
Demo/Examples/Samples/HeaderFooterTest/Blank Page.pdf

@@ -1,45 +0,0 @@
-%PDF-1.7
-%¡³Å×
-1 0 obj
-<</Pages 2 0 R /Type/Catalog>>
-endobj
-2 0 obj
-<</Count 5/Kids[ 4 0 R  5 0 R  8 0 R  7 0 R  6 0 R ]/Type/Pages>>
-endobj
-3 0 obj
-<</CreationDate(D:20230704151320)>>
-endobj
-4 0 obj
-<</MediaBox[ 0 0 595 842]/Parent 2 0 R /Resources<<>>/Rotate 0/Type/Page>>
-endobj
-5 0 obj
-<</MediaBox[ 0 0 595 842]/Parent 2 0 R /Resources<<>>/Rotate 0/Type/Page>>
-endobj
-6 0 obj
-<</MediaBox[ 0 0 595 842]/Parent 2 0 R /Resources<<>>/Rotate 0/Type/Page>>
-endobj
-7 0 obj
-<</MediaBox[ 0 0 595 842]/Parent 2 0 R /Resources<<>>/Rotate 0/Type/Page>>
-endobj
-8 0 obj
-<</MediaBox[ 0 0 595 842]/Parent 2 0 R /Resources<<>>/Rotate 0/Type/Page>>
-endobj
-xref
-0 9
-0000000000 65535 f
-0000000017 00000 n
-0000000066 00000 n
-0000000150 00000 n
-0000000204 00000 n
-0000000297 00000 n
-0000000390 00000 n
-0000000483 00000 n
-0000000576 00000 n
-trailer
-<<
-/Root 1 0 R
-/Info 3 0 R
-/Size 9/ID[<7800A4991AF561A4D70D3004F5E43166><7800A4991AF561A4D70D3004F5E43166>]>>
-startxref
-669
-%%EOF

+ 25 - 23
Demo/Examples/Samples/HeaderFooterTest/HeaderFooterTest.cs

@@ -14,7 +14,7 @@ namespace HeaderFooterTest
     {
         private static string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\HeaderFooter";
 
-        private static Dictionary<int, string> IntToLocateDic = new Dictionary<int, string>()
+        private static Dictionary<int, string> IntToLocationDic = new Dictionary<int, string>()
         {
             {0, "Top Left" },
             {1, "Top Middle" },
@@ -26,7 +26,7 @@ namespace HeaderFooterTest
 
         static void Main(string[] args)
         {
-            Console.WriteLine("");
+            Console.WriteLine("Running header and footer test sample…\r\n");
             SDKLicenseHelper.LicenseVerify();
 
             CPDFDocument document = CPDFDocument.InitWithFilePath("Blank Page.pdf");
@@ -72,16 +72,18 @@ namespace HeaderFooterTest
             Console.WriteLine("--------------------");
 
             #region Delete header and footer 
-            if (DeleteHeaderFooter(document))
+            if (ClearHeaderFooter(document))
             {
                 Console.WriteLine("Delete header and footer done.\n");
             }
             else
             {
                 Console.WriteLine("delete header and footer failed\n");
-            }
-            Console.WriteLine();
+            } 
             #endregion
+            Console.WriteLine("--------------------");
+            Console.WriteLine("Done");
+            Console.WriteLine("--------------------");
 
             Console.ReadLine();
         }
@@ -95,24 +97,24 @@ namespace HeaderFooterTest
 
             // 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
-                headerFooter.SetPages("0-" + (document.PageCount - 1));
                 // Set color : red
-                byte[] color = { 255, 0, 0 };
                 headerFooter.SetTextColor(i, color);
                 // Set font size : 14
                 headerFooter.SetFontSize(i, 14);
-
-
+                 
                 Console.WriteLine("Text: {0}", headerFooter.GetText(i));
-                Console.WriteLine("Location: {0}\n", IntToLocateDic[i]);
+                Console.WriteLine("Location: {0}\n", IntToLocationDic[i]);
             }
 
-            // Update HeaderFooter
+            // Update header and footer after changed
             headerFooter.Update();
 
             // Save to pointed path so you can observe the effect.
@@ -133,25 +135,25 @@ namespace HeaderFooterTest
         {
             // 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 page index: all the page
-                headerFooter.SetPages("0-" + (document.PageCount - 1));
                 // Set color : red
-                byte[] color = { 255, 0, 0 };
                 headerFooter.SetTextColor(i, color);
                 // Set font size : 14
                 headerFooter.SetFontSize(i, 14);
 
                 Console.WriteLine("Text: {0}", headerFooter.GetText(i));
-                Console.WriteLine("Location: {0}\n", IntToLocateDic[i]);
+                Console.WriteLine("Location: {0}\n", IntToLocationDic[i]);
             }
-            // Update HeaderFooter
-            headerFooter.Update();
 
-            // Save to pointed path so you can observe the effect.
+            // Update header and footer after changed
+            headerFooter.Update();
+             
             string addHeaderFooterPath = outputPath + "\\AddPageHeaderFooterTest.pdf";
 
             if (document.WriteToFilePath(addHeaderFooterPath))
@@ -179,7 +181,7 @@ namespace HeaderFooterTest
             }
             else
             {
-                Console.WriteLine("Get head and footer 0 failed");
+                Console.WriteLine("Get head and footer 0 failed, or it does not exist");
                 return false;
             }
 
@@ -202,17 +204,17 @@ namespace HeaderFooterTest
             }
         }
 
-        private static bool DeleteHeaderFooter(CPDFDocument document)
+        private static bool ClearHeaderFooter(CPDFDocument document)
         {
             CPDFHeaderFooter headerFooter = document.GetHeaderFooter();
 
             headerFooter.Clear();
 
-            string deleteHeaderFooterPath = outputPath + "\\DeleteHeaderFooterTest.pdf";
+            string clearHeaderFooterPath = outputPath + "\\ClearHeaderFooterTest.pdf";
 
-            if (document.WriteToFilePath(deleteHeaderFooterPath))
+            if (document.WriteToFilePath(clearHeaderFooterPath))
             {
-                Console.WriteLine("Browse the changed file in " + deleteHeaderFooterPath);
+                Console.WriteLine("Browse the changed file in " + clearHeaderFooterPath);
                 return true;
             }
             else

BIN
Demo/Examples/Samples/Output/HeaderFooter/AddCommonHeaderFooterTest.pdf


BIN
Demo/Examples/Samples/Output/HeaderFooter/AddPageHeaderFooterTest.pdf


BIN
Demo/Examples/Samples/Output/HeaderFooter/DeleteHeaderFooterTest.pdf


BIN
Demo/Examples/Samples/Output/HeaderFooter/EditHeaderFooterTest.pdf


+ 1 - 1
Demo/Examples/HeaderFooterTest/App.config

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

+ 82 - 0
Demo/Examples/Samples/PDFRedactTest/PDFRedactTest.cs

@@ -0,0 +1,82 @@
+using ComPDFKit.Import;
+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.Windows;
+
+namespace PDFRedactTest
+{
+    internal class PDFRedactTest
+    {
+        private static string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\Redact";
+        static void Main(string[] args)
+        {
+            Console.WriteLine("Running redact test sample…\r\n");
+            SDKLicenseHelper.LicenseVerify();
+             
+            CPDFDocument document = CPDFDocument.InitWithFilePath("PDF32000_2008.pdf");
+
+            string str = document.PageAtIndex(0).GetTextPage().GetSelectText(new Point(60, 200), new Point(560,250), new Point(0,0));
+            Console.WriteLine("The text need to be redact is {0}", str);
+
+            if (!Directory.Exists(outputPath))
+            {
+                Directory.CreateDirectory(outputPath);
+            }
+
+            #region Redact
+            Redact(document);
+            #endregion
+            Console.WriteLine("--------------------");
+            Console.WriteLine("Done!");
+            Console.WriteLine("--------------------");
+
+            Console.ReadLine();
+        }
+
+        private static bool Redact(CPDFDocument document)
+        {
+            //PageIndex: 0
+            CPDFPage page = document.PageAtIndex(0);
+            //Initial redaction
+            CPDFRedactAnnotation redact = page.CreateAnnot(C_ANNOTATION_TYPE.C_ANNOTATION_REDACT) as CPDFRedactAnnotation;
+            //Set radact rect: cover the title
+            redact.SetRect(new CRect(60, 200, 560, 250));
+            //Set overlay text: REDACTED
+            redact.SetOverlayText("REDACTED");
+
+            //Properties of cover text
+            CTextAttribute textAttribute = new CTextAttribute();
+            textAttribute.FontName = "Helvetica";
+            textAttribute.FontSize = 12;
+            byte[] fontColor = { 255, 0, 0 };
+            textAttribute.FontColor = fontColor;
+            redact.SetTextDa(textAttribute);
+            redact.SetTextAlignment(C_TEXT_ALIGNMENT.ALIGNMENT_LEFT);
+
+            //Fill color
+            byte[] fillColor = { 255, 0, 0 };
+            redact.SetFillColor(fillColor);
+             
+            byte[] outlineColor = { 0, 255, 0 };
+            redact.SetOutlineColor(outlineColor);
+
+            redact.UpdateAp();
+            document.ApplyRedaction();
+            // Save to pointed path so you can observe the effect.
+            string addHeaderFooterPath = outputPath + "\\RedactTest.pdf";
+            document.WriteToFilePath(addHeaderFooterPath);
+
+            CPDFDocument newDocument = CPDFDocument.InitWithFilePath(addHeaderFooterPath); 
+            var str = newDocument.PageAtIndex(0).GetTextPage().GetSelectText(new Point(60, 200), new Point(560, 250), new Point(0, 0));
+            Console.WriteLine("Text in the redacted, ");
+            return true;
+        }
+    }
+}

+ 31 - 5
Demo/Examples/HeaderFooterTest/HeaderFooterTest.csproj

@@ -4,14 +4,16 @@
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{B8D17EB7-A582-4107-889F-1D78D23D41AF}</ProjectGuid>
+    <ProjectGuid>{B18AD53B-9550-489B-A814-E2783D865D9C}</ProjectGuid>
     <OutputType>Exe</OutputType>
-    <RootNamespace>HeaderFooterTest</RootNamespace>
-    <AssemblyName>HeaderFooterTest</AssemblyName>
-    <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
+    <RootNamespace>PDFRedactTest</RootNamespace>
+    <AssemblyName>Viewer_ComPDFKit</AssemblyName>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
     <Deterministic>true</Deterministic>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -33,6 +35,12 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="ComPDFKit.Desk, Version=1.8.1.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\ComPDFKit.NetFramework.1.9.0\lib\ComPDFKit.Desk.dll</HintPath>
+    </Reference>
+    <Reference Include="ComPDFKit.Viewer, Version=1.8.1.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\ComPDFKit.NetFramework.1.9.0\lib\ComPDFKit.Viewer.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Xml.Linq" />
@@ -41,13 +49,31 @@
     <Reference Include="System.Data" />
     <Reference Include="System.Net.Http" />
     <Reference Include="System.Xml" />
+    <Reference Include="WindowsBase" />
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="Program.cs" />
+    <Compile Include="..\LicenseKey.cs" />
+    <Compile Include="PDFRedactTest.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="App.config" />
+    <None Include="..\..\TestFile\PDF32000_2008.pdf">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="..\..\license_key_win.xml">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Import Project="..\..\packages\ComPDFKit.NetFramework.1.9.0\build\ComPDFKit.NetFramework.targets" Condition="Exists('..\..\packages\ComPDFKit.NetFramework.1.9.0\build\ComPDFKit.NetFramework.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\..\packages\ComPDFKit.NetFramework.1.9.0\build\ComPDFKit.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\ComPDFKit.NetFramework.1.9.0\build\ComPDFKit.NetFramework.targets'))" />
+  </Target>
 </Project>

+ 3 - 3
Demo/Examples/HeaderFooterTest/Properties/AssemblyInfo.cs

@@ -5,11 +5,11 @@ 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("PDFRedactTest")]
 [assembly: AssemblyDescription("")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("HeaderFooterTest")]
+[assembly: AssemblyProduct("PDFRedactTest")]
 [assembly: AssemblyCopyright("Copyright ©  2023")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
@@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
 [assembly: ComVisible(false)]
 
 // The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("b8d17eb7-a582-4107-889f-1d78d23d41af")]
+[assembly: Guid("b18ad53b-9550-489b-a814-e2783d865d9c")]
 
 // Version information for an assembly consists of the following four values:
 //

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

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