Prechádzať zdrojové kódy

其他 - 使用流加载文档Samples

liyuxuan 1 rok pred
rodič
commit
ab9c508c2e

+ 6 - 0
Demo/Examples/Examlpes.sln

@@ -74,6 +74,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComPDFKit.Tool", "..\..\..\
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComPDFKit.Viewer", "..\..\..\compdfkit_windows\ComPDFKit.Viewer\ComPDFKit.Viewer.csproj", "{783263CF-0DA3-4095-9DF8-2C4A6B3FF908}"
 EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UrlLoadTest", "Samples\UrlLoadTest\UrlLoadTest.csproj", "{A8AF1E5F-E8A0-43E7-91CE-615580B29325}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StreamLoadTest", "Samples\StreamLoadTest\StreamLoadTest.csproj", "{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -687,6 +691,8 @@ Global
 		{0BB38D20-C3CF-47D7-8E2E-97195672AB67} = {812D8275-2791-4CEF-A4E8-39A78E49D8FB}
 		{FB4B7306-DECC-457C-8F4C-6CE946F753D6} = {812D8275-2791-4CEF-A4E8-39A78E49D8FB}
 		{7372311C-7A31-4D97-A2C0-FC005FC345C1} = {812D8275-2791-4CEF-A4E8-39A78E49D8FB}
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325} = {812D8275-2791-4CEF-A4E8-39A78E49D8FB}
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2} = {812D8275-2791-4CEF-A4E8-39A78E49D8FB}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {8EE774F1-5FBF-482A-9A31-5ABDEC216DEF}

BIN
Demo/Examples/Samples/StreamLoadTest/ComPDFKit.Desk.dll


+ 26 - 0
Demo/Examples/Samples/StreamLoadTest/Program.cs

@@ -0,0 +1,26 @@
+#region Perparation work
+using ComPDFKit.PDFDocument;
+
+Console.WriteLine("Running Stream Load test sample…\r\n");
+bool statue = SDKLicenseHelper.LicenseVerify();
+#endregion
+
+#region Sample 1: Open Local File With Stream
+if (statue && File.Exists("PDF32000_2008.pdf"))
+{
+    FileStream fs = File.OpenRead("PDF32000_2008.pdf");
+    CPDFDocument pdfDoc = CPDFDocument.InitWithStream(fs);
+    if (pdfDoc != null)
+    {
+        Console.WriteLine("Load File With Stream Done.");
+        pdfDoc.Release();
+        fs.Close();
+    }
+}
+
+#endregion
+
+Console.WriteLine("Done.");
+Console.WriteLine("--------------------");
+
+Console.ReadLine();

+ 43 - 0
Demo/Examples/Samples/StreamLoadTest/StreamLoadTest.csproj

@@ -0,0 +1,43 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net6.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Compile Include="..\LicenseKey.cs" Link="LicenseKey.cs" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Include="..\..\license_key_windows.xml" Link="license_key_windows.xml">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Include="..\..\TestFile\PDF32000_2008.pdf" Link="PDF32000_2008.pdf">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+
+  <ItemGroup>
+    <PackageReference Include="ComPDFKit.NetFramework" Version="1.10.0" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Reference Include="ComPDFKit.Desk">
+      <HintPath>ComPDFKit.Desk.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Update="ComPDFKit.Desk.dll">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+
+</Project>

BIN
Demo/Examples/Samples/UrlLoadTest/ComPDFKit.Desk.dll


+ 25 - 0
Demo/Examples/Samples/UrlLoadTest/Program.cs

@@ -0,0 +1,25 @@
+#region Perparation work
+using ComPDFKit.PDFDocument;
+
+Console.WriteLine("Running Url Load test sample…\r\n");
+bool statue= SDKLicenseHelper.LicenseVerify();
+#endregion
+
+#region Sample 1: Open File With Url
+if (statue)
+{
+    string url = "https://www.compdf.com/webviewer/example/developer_guide_web.pdf";
+    CPDFDocument pdfDoc = CPDFDocument.InitWithUrl(url);
+    if(pdfDoc != null)
+    {
+        Console.WriteLine("Load File With Url Done.");
+        pdfDoc.Release();
+    }
+}
+
+#endregion
+
+Console.WriteLine("Done.");
+Console.WriteLine("--------------------");
+
+Console.ReadLine();

+ 61 - 0
Demo/Examples/Samples/UrlLoadTest/UrlLoadTest.csproj

@@ -0,0 +1,61 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net6.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <None Remove="C:\Users\holee\.nuget\packages\compdfkit.netframework\1.10.0\build\PDFA\**" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Remove="C:\Users\holee\.nuget\packages\compdfkit.netframework\1.10.0\build\PDFA\sRGB2014.icc" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Remove="C:\Users\holee\.nuget\packages\compdfkit.netframework\1.10.0\build\x64\**" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Remove="C:\Users\holee\.nuget\packages\compdfkit.netframework\1.10.0\build\x64\ComPDFKit.dll" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Remove="C:\Users\holee\.nuget\packages\compdfkit.netframework\1.10.0\build\x86\**" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Remove="C:\Users\holee\.nuget\packages\compdfkit.netframework\1.10.0\build\x86\ComPDFKit.dll" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Compile Include="..\LicenseKey.cs" Link="LicenseKey.cs" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Include="..\..\license_key_windows.xml" Link="license_key_windows.xml">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+
+  <ItemGroup>
+    <PackageReference Include="ComPDFKit.NetFramework" Version="1.10.0" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Reference Include="ComPDFKit.Desk">
+      <HintPath>ComPDFKit.Desk.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Update="ComPDFKit.Desk.dll">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+
+</Project>