Skip to content

Commit 7829103

Browse files
committed
V2.0.0 - 更新文档
1 parent c5e2536 commit 7829103

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ In this guide, we take ***"PDFViewer"*** as an example to show how to run it in
3030

3131
2. Find ***"Examples.sln"*** in the ***"Examples"*** folder and open it in Visual Studio 2022.
3232

33-
<img src="images-windows/image.png" alt="2.4" width="50%" height="50%"/>
33+
<img src="images-windows/imagev2.png" alt="2.4" width="50%" height="50%"/>
3434

3535
3. Select ***"PDFViewer"*** and right-click to set it as a startup project.
3636

37-
<img src="images-windows/image-2.png" alt="2.4" width="50%" height="50%"/>
37+
<img src="images-windows/image-2v2.png" alt="2.4" width="50%" height="50%"/>
3838

3939
4. Run the project and then you can open the multifunctional ***"PDFViewer"*** demo.
4040

@@ -76,7 +76,7 @@ There are two ways to add ComPDFKit to your Project: [Nuget Repository](https://
7676

7777
2. Go to [ComPDFKit.NetFramework](https://www.nuget.org/packages/ComPDFKit.NetFramework) in Nuget, and click on the **Install** button to install the package.
7878

79-
<img src="images-windows/2.4.2.3.png" alt="2.4" width="65%" height="65%"/>
79+
<img src="images-windows/2.4.2.3v2.png" alt="2.4" width="65%" height="65%"/>
8080

8181
3. Once that is complete, you'll see a reference to the package in the Solution Explorer under **References**.
8282

@@ -117,7 +117,7 @@ Rather than targeting a package held at Nuget, you may set up a configuration to
117117

118118
5. On the right side, in the panel describing the package, click on the **Install** button to install the package.
119119

120-
<img src="images-windows/2.4.2.8.png" alt="2.4" width="50%" height="50%"/>
120+
<img src="images-windows/2.4.2.8v2.png" alt="2.4" width="50%" height="50%"/>
121121

122122
6. Once that's complete, you'll see a reference to the package in the Solution Explorer under **References**.
123123

@@ -132,16 +132,15 @@ You can [contact the ComPDFKit team](https://www.compdf.com/contact-us) to obtai
132132
You can perform online authentication using the following approach:
133133

134134
```c#
135-
public static async Task<bool> LicenseVerify()
135+
public static bool LicenseVerify()
136136
{
137-
if (!CPDFSDKVerifier.LoadNativeLibrary())
138-
{
139-
return false;
140-
}
141-
LicenseErrorCode status = await CPDFSDKVerifier.OnlineLicenseVerify("Input your license here.");
142-
return status == LicenseErrorCode.E_LICENSE_SUCCESS;
137+
if (!CPDFSDKVerifier.LoadNativeLibrary())
138+
{
139+
return false;
140+
}
141+
LicenseErrorCode status = CPDFSDKVerifier.OnlineLicenseVerify("Input your license here.");
142+
return status == LicenseErrorCode.E_LICENSE_SUCCESS;
143143
}
144-
145144
```
146145

147146
Additionally, if you need to confirm the communication status with the server during online authentication, you can implement the `CPDFSDKVerifier.LicenseRefreshed` callback:
@@ -194,14 +193,20 @@ We have finished all prepare steps. Let's display a PDF file.
194193
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
195194
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
196195
xmlns:local="clr-namespace:ComPDFKit_Demo"
196+
xmlns:compdfkitviewer="clr-namespace:ComPDFKitViewer;assembly=ComPDFKit.Viewer"
197197
mc:Ignorable="d"
198-
Title="MainWindow" Height="450" Width="800" UseLayoutRounding="True">
198+
Focusable="True"
199+
Title="MainWindow" Height="600" Width="800" UseLayoutRounding="True">
199200
<Grid>
200201
<Grid.RowDefinitions>
201202
<RowDefinition Height="*"/>
202203
<RowDefinition Height="52"/>
203204
</Grid.RowDefinitions>
204-
<Grid Name="PDFGrid" Grid.Row="0" />
205+
<Grid Name="PDFGrid" Grid.Row="0">
206+
<ScrollViewer Focusable="False" CanContentScroll="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
207+
<compdfkitviewer:CPDFViewer x:Name="PDFViewer"/>
208+
</ScrollViewer>
209+
</Grid>
205210
<Button Content="Open PDF" Grid.Row="1" HorizontalAlignment="Left" Margin="10" Click="OpenPDF_Click"/>
206211
</Grid>
207212
</Window>
@@ -212,27 +217,27 @@ We have finished all prepare steps. Let's display a PDF file.
212217
```c#
213218
using ComPDFKit.NativeMethod;
214219
using ComPDFKit.PDFDocument;
215-
using ComPDFKitViewer.PdfViewer;
216220
using Microsoft.Win32;
217221
using System.Windows;
218222

219223
namespace ComPDFKit_Demo
220224
{
221-
public partial class MainWindow : Window
225+
public partial class MainWindow : Window
222226
{
223227
public MainWindow()
224228
{
225229
InitializeComponent();
226230
LicenseVerify();
227231
}
228-
232+
229233
bool LicenseVerify()
230234
{
231235
if (!CPDFSDKVerifier.LoadNativeLibrary())
232-
return false;
236+
return false;
233237

234-
LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify("license_key_windows.txt", true);
235-
return (verifyResult == LicenseErrorCode.E_LICENSE_SUCCESS);
238+
// Input your license.
239+
LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify("Input your license here.");
240+
return (verifyResult == LicenseErrorCode.E_LICENSE_SUCCESS);
236241
}
237242

238243
private void OpenPDF_Click(object sender, RoutedEventArgs e)
@@ -243,14 +248,9 @@ namespace ComPDFKit_Demo
243248
if (dlg.ShowDialog() == true)
244249
{
245250
// Use the PDF file path to open the document in CPDFViewer.
246-
CPDFViewer pdfViewer = new CPDFViewer();
247-
pdfViewer.InitDocument(dlg.FileName);
248-
if (pdfViewer.Document != null &&
249-
pdfViewer.Document.ErrorType == CPDFDocumentError.CPDFDocumentErrorSuccess)
250-
{
251-
pdfViewer.Load();
252-
PDFGrid.Children.Add(pdfViewer);
253-
}
251+
CPDFDocument doc = CPDFDocument.InitWithFilePath(dlg.FileName);
252+
if (doc != null && doc.ErrorType == CPDFDocumentError.CPDFDocumentErrorSuccess)
253+
PDFViewer.InitDoc(doc);
254254
}
255255
}
256256
}

images-windows/2.4.2.3v2.png

99.1 KB
Loading

images-windows/2.4.2.8v2.png

74.2 KB
Loading

images-windows/image-2v2.png

1.73 MB
Loading

images-windows/imagev2.png

20.9 KB
Loading

0 commit comments

Comments
 (0)