ソースを参照

compdfkit(win) - 移除搜索替换Samples

liuaoran 1 年間 前
コミット
21105dcf36

+ 8 - 6
Demo/Examples/ContentEditor/ContentEditor.csproj

@@ -41,12 +41,6 @@
     <ApplicationIcon>ComPDFKit_Logo.ico</ApplicationIcon>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="ComPDFKit.Desk, Version=1.11.0.0, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\ComPDFKit.NetFramework.1.11.0\lib\ComPDFKit.Desk.dll</HintPath>
-    </Reference>
-    <Reference Include="ComPDFKit.Viewer, Version=1.11.0.0, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\ComPDFKit.NetFramework.1.11.0\lib\ComPDFKit.Viewer.dll</HintPath>
-    </Reference>
     <Reference Include="PresentationFramework.Aero2, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\packages\PresentationFramework.Aero2.1.0.1\lib\PresentationFramework.Aero2.dll</HintPath>
     </Reference>
@@ -112,6 +106,14 @@
     <None Include="App.config" />
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\..\..\..\compdfkit\ComPDFKit\ComPDFKitCSharp\ComPDFKit.Desk.csproj">
+      <Project>{56e518ad-c126-4b48-9a09-0a64c87020e4}</Project>
+      <Name>ComPDFKit.Desk</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\..\compdfkit\ComPDFKit\ComPDFKitDesktop\ComPDFKit.Viewer\ComPDFKit.Viewer.csproj">
+      <Project>{18ec356d-8130-49d4-b4e6-ac290e1065b7}</Project>
+      <Name>ComPDFKit.Viewer</Name>
+    </ProjectReference>
     <ProjectReference Include="..\Compdfkit_Tools\Compdfkit_Tools.csproj">
       <Project>{9363bcb1-3a67-446a-8093-5708b86bf418}</Project>
       <Name>Compdfkit_Tools</Name>

+ 0 - 15
Demo/Examples/Examlpes.sln

@@ -118,8 +118,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComPDFKit.Desk", "..\..\..\
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComPDFKit.Viewer", "..\..\..\compdfkit\ComPDFKit\ComPDFKitDesktop\ComPDFKit.Viewer\ComPDFKit.Viewer.csproj", "{18EC356D-8130-49D4-B4E6-AC290E1065B7}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SearchAndReplaceTest", "Samples\SearchAndReplaceText\CS\SearchAndReplaceTest\SearchAndReplaceTest.csproj", "{5820A5E0-C471-4C44-9DA3-8B1D65424FD9}"
-EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -752,18 +750,6 @@ Global
 		{18EC356D-8130-49D4-B4E6-AC290E1065B7}.Release|x64.Build.0 = Release|x64
 		{18EC356D-8130-49D4-B4E6-AC290E1065B7}.Release|x86.ActiveCfg = Release|Any CPU
 		{18EC356D-8130-49D4-B4E6-AC290E1065B7}.Release|x86.Build.0 = Release|Any CPU
-		{5820A5E0-C471-4C44-9DA3-8B1D65424FD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{5820A5E0-C471-4C44-9DA3-8B1D65424FD9}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{5820A5E0-C471-4C44-9DA3-8B1D65424FD9}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{5820A5E0-C471-4C44-9DA3-8B1D65424FD9}.Debug|x64.Build.0 = Debug|Any CPU
-		{5820A5E0-C471-4C44-9DA3-8B1D65424FD9}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{5820A5E0-C471-4C44-9DA3-8B1D65424FD9}.Debug|x86.Build.0 = Debug|Any CPU
-		{5820A5E0-C471-4C44-9DA3-8B1D65424FD9}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{5820A5E0-C471-4C44-9DA3-8B1D65424FD9}.Release|Any CPU.Build.0 = Release|Any CPU
-		{5820A5E0-C471-4C44-9DA3-8B1D65424FD9}.Release|x64.ActiveCfg = Release|Any CPU
-		{5820A5E0-C471-4C44-9DA3-8B1D65424FD9}.Release|x64.Build.0 = Release|Any CPU
-		{5820A5E0-C471-4C44-9DA3-8B1D65424FD9}.Release|x86.ActiveCfg = Release|Any CPU
-		{5820A5E0-C471-4C44-9DA3-8B1D65424FD9}.Release|x86.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -813,7 +799,6 @@ Global
 		{8FE5F6A4-92B5-4041-B659-50C032EBB965} = {0B9A4542-3DFF-4862-973C-12308CBB2FAA}
 		{D922B3BB-3823-4506-BC8B-7C682B7F8AB9} = {0B9A4542-3DFF-4862-973C-12308CBB2FAA}
 		{84A958E6-C1DA-42C4-88E5-EBF4E3E632FE} = {0B9A4542-3DFF-4862-973C-12308CBB2FAA}
-		{5820A5E0-C471-4C44-9DA3-8B1D65424FD9} = {04BEFA57-85D7-404D-9720-55393023F118}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {8EE774F1-5FBF-482A-9A31-5ABDEC216DEF}

+ 1 - 0
Demo/Examples/PDFViewer/App.xaml.cs

@@ -59,6 +59,7 @@ namespace PDFViewer
                 return false;
 
             LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify("license_key_windows.txt", true);
+            CPDFSDKVerifier.PrintPermissions();
             return (verifyResult == LicenseErrorCode.E_LICENSE_SUCCESS);
         }
         

+ 1 - 2
Demo/Examples/PDFViewer/MainPage.xaml.cs

@@ -131,7 +131,7 @@ namespace PDFViewer
         public void InitWithFilePath(string filePath)
         {
             pdfViewer = new PDFViewControl();
-            pdfViewer.PDFView.InitDocument(filePath);
+            pdfViewer.PDFView.InitDocument(filePath); 
         }
 
         public void InitWithDocument(CPDFDocument document)
@@ -953,5 +953,4 @@ namespace PDFViewer
         }
         #endregion
     }
-
 }

+ 0 - 6
Demo/Examples/Samples/SearchAndReplaceText/CS/SearchAndReplaceTest/App.config

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

+ 0 - 36
Demo/Examples/Samples/SearchAndReplaceText/CS/SearchAndReplaceTest/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("SearchAndReplaceTest")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("SearchAndReplaceTest")]
-[assembly: AssemblyCopyright("Copyright ©  2023")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components.  If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("5820a5e0-c471-4c44-9da3-8b1d65424fd9")]
-
-// Version information for an assembly consists of the following four values:
-//
-//      Major Version
-//      Minor Version
-//      Build Number
-//      Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]

+ 0 - 175
Demo/Examples/Samples/SearchAndReplaceText/CS/SearchAndReplaceTest/SearchAndReplaceTest.cs

@@ -1,175 +0,0 @@
-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;
-
-namespace SearchAndReplaceTest
-{
-    /// <summary>
-    /// This class contains the main entry point and methods for the SearchAndReplaceTest program.
-    /// </summary>
-    internal class SearchAndReplaceTest
-    {
-        private static string parentPath =
-            Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))));
-        private static string outputPath = Path.Combine(parentPath, "Output", "CS");
-
-        static void Main(string[] args)
-        {
-            #region Perparation work
-            Console.WriteLine("Running search and replace test sample…\r\n");
-
-            SDKLicenseHelper.LicenseVerify();
-            CPDFDocument document;
-
-            if (!Directory.Exists(outputPath))
-            {
-                Directory.CreateDirectory(outputPath);
-            }
-            #endregion
-
-            #region Sample 1: Search
-
-            document = CPDFDocument.InitWithFilePath("ComPDFKit_Sample_File_Windows.pdf");
-
-            if (GetSearchResult(document))
-            {
-                Console.WriteLine("Get Search result done.");
-            }
-
-            document.Release();
-
-            Console.WriteLine("--------------------");
-
-            #endregion
-
-            #region Sample 2: Replace Text
-
-            document = CPDFDocument.InitWithFilePath("ComPDFKit_Sample_File_Windows.pdf");
-
-            if (ReplaceText(document))
-            {
-                Console.WriteLine("Replace selected words done.");
-            }
-
-            document.Release();
-
-            Console.WriteLine("--------------------");
-
-            #endregion
-
-            #region Replace all
-            document = CPDFDocument.InitWithFilePath("ComPDFKit_Sample_File_Windows.pdf");
-
-            if (ReplaceAll(document))
-            {
-                Console.WriteLine("Replace all wards done.");
-            }
-            document.Release();
-
-            #endregion
-
-            Console.WriteLine("Done!");
-            Console.WriteLine("--------------------");
-            Console.ReadLine();
-        }
-
-        /// <summary>
-        /// This method retrieves the search results in the given PDF document.
-        /// </summary>
-        /// <param name="document">The PDF document to search in.</param>
-        /// <returns>True if the search results are retrieved successfully, otherwise false.</returns>
-        private static bool GetSearchResult(CPDFDocument document)
-        {
-            CPDFPage page = document.PageAtIndex(1);
-            CPDFEditPage editPage = page.GetEditPage();
-            editPage.BeginEdit(CPDFEditType.EditText);
-            editPage.TextEditFindStart("ComPDF", C_Search_Options.Search_Case_Insensitive);
-            Console.WriteLine("Get {0} results", editPage.GetFindSelectionsCount());
-            editPage.EndEdit();
-            return true;
-        }
-
-        /// <summary>
-        /// This method replaces the specified text in the given PDF document.
-        /// </summary>
-        /// <param name="document">The PDF document to perform the text replacement in.</param>
-        /// <returns>True if the text is replaced successfully, otherwise false.</returns>
-        private static bool ReplaceText(CPDFDocument document)
-        {
-            string path = Path.Combine(outputPath, "ReplaceText.pdf");
-
-            int pageIndex = 0;
-            int count = 0;
-            CPDFPage page;
-            CPDFEditPage editPage;
-
-            while (pageIndex < document.PageCount)
-            {
-                page = document.PageAtIndex(pageIndex);
-                editPage = page.GetEditPage();
-                editPage.BeginEdit(CPDFEditType.EditText);
-                editPage.TextEditFindStart("ComPDF", C_Search_Options.Search_Case_Insensitive);
-
-                if (!(editPage.GetFindSelectionsCount() > 0))
-                {
-                    editPage.TextEditFindClose();
-                    editPage.EndEdit();
-                    pageIndex++;
-                    continue;
-                }
-                else
-                {
-                    while (editPage.FindSelectionIndex < editPage.GetFindSelectionsCount())
-                    {
-                        editPage.ReplaceSelectedText("ABCDE");
-                        Console.WriteLine("Text {0} replacement completed.", count++);
-                        editPage.TextEditFindClose();
-                        int oldFindSelectionIndex = editPage.FindSelectionIndex;
-                        editPage.TextEditFindStart("ComPDF", C_Search_Options.Search_Case_Insensitive);
-                        editPage.FindSelectionIndex = oldFindSelectionIndex;
-                    }
-                    editPage.TextEditFindClose();
-                    editPage.EndEdit();
-                    pageIndex++;
-                    continue;
-                }
-            }
-
-            Console.WriteLine("Browse the changed file in " + path);
-            return document.WriteToFilePath(path);
-        }
-
-        /// <summary>
-        /// This method replaces all occurrences of the specified text in the given PDF document.
-        /// </summary>
-        /// <param name="document">The PDF document to perform the text replacement in.</param>
-        /// <returns>True if all occurrences of the text are replaced successfully, otherwise false.</returns>
-        private static bool ReplaceAll(CPDFDocument document)
-        {
-            string path = Path.Combine(outputPath, "ReplaceAll.pdf");
-
-            for (int pageIndex = 0; pageIndex < document.PageCount; pageIndex++)
-            {
-                CPDFPage page = document.PageAtIndex(pageIndex);
-                CPDFEditPage editPage = page.GetEditPage();
-                editPage.BeginEdit(CPDFEditType.EditText);
-
-                editPage.TextEditFindStart("ComPDF", C_Search_Options.Search_Case_Insensitive);
-                Console.WriteLine("Page {0} has {1} text to replace.", pageIndex + 1, editPage.GetFindSelectionsCount());
-
-                editPage.ReplacePageText("ABCDE");
-                editPage.EndEdit();
-
-                Console.WriteLine("Page {0} replacement completed.", pageIndex + 1);
-            }
-            Console.WriteLine("Browse the changed file in " + path);
-            return document.WriteToFilePath(path);
-        }
-    }
-}
-

+ 0 - 83
Demo/Examples/Samples/SearchAndReplaceText/CS/SearchAndReplaceTest/SearchAndReplaceTest.csproj

@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{5820A5E0-C471-4C44-9DA3-8B1D65424FD9}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <RootNamespace>SearchAndReplaceTest</RootNamespace>
-    <AssemblyName>Samples_ComPDFKit</AssemblyName>
-    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
-    <Deterministic>true</Deterministic>
-    <NuGetPackageImportStamp>
-    </NuGetPackageImportStamp>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <PlatformTarget>AnyCPU</PlatformTarget>
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <Prefer32Bit>false</Prefer32Bit>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <PlatformTarget>AnyCPU</PlatformTarget>
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Net.Http" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="..\..\..\LicenseKey.cs">
-      <Link>LicenseKey.cs</Link>
-    </Compile>
-    <Compile Include="SearchAndReplaceTest.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="..\..\..\..\TestFile\ComPDFKit_Sample_File_Windows.pdf">
-      <Link>ComPDFKit_Sample_File_Windows.pdf</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
-    <None Include="App.config" />
-    <None Include="packages.config" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="..\..\..\..\license_key_windows.txt">
-      <Link>license_key_windows.txt</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\..\..\..\..\..\compdfkit\ComPDFKit\ComPDFKitCSharp\ComPDFKit.Desk.csproj">
-      <Project>{56e518ad-c126-4b48-9a09-0a64c87020e4}</Project>
-      <Name>ComPDFKit.Desk</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <Import Project="..\..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\ComPDFKit.NetFramework.targets" Condition="Exists('..\..\..\..\packages\ComPDFKit.NetFramework.1.11.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.11.0\build\ComPDFKit.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\ComPDFKit.NetFramework.1.11.0\build\ComPDFKit.NetFramework.targets'))" />
-  </Target>
-</Project>

+ 0 - 4
Demo/Examples/Samples/SearchAndReplaceText/CS/SearchAndReplaceTest/packages.config

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

BIN
Demo/Examples/TestFile/ComPDFKit_Sample_File_Windows.pdf