ComPDFKit.NetFramework 2.1.3

dotnet add package ComPDFKit.NetFramework --version 2.1.3                
NuGet\Install-Package ComPDFKit.NetFramework -Version 2.1.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ComPDFKit.NetFramework" Version="2.1.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ComPDFKit.NetFramework --version 2.1.3                
#r "nuget: ComPDFKit.NetFramework, 2.1.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ComPDFKit.NetFramework as a Cake Addin
#addin nuget:?package=ComPDFKit.NetFramework&version=2.1.3

// Install ComPDFKit.NetFramework as a Cake Tool
#tool nuget:?package=ComPDFKit.NetFramework&version=2.1.3                

Introduction

ComPDFKit PDF SDK is a robust PDF library, which offers comprehensive functions for quickly viewing, annotating, editing, and signing PDFs. It is feature-rich and battle-tested, making PDF files process and manipulation easier and faster.

ComPDFKit for Windows allows you to quickly add PDF functions to any Windows application, elevating your Window programs to ensure efficient development. It is available at Nuget and github.com.

Get Started

It is easy to embed ComPDFKit PDF SDK in your Windows application with a few lines of C# code. The following sections introduce the requirements, the structure of the installation package, and how to make a Windows PDF Reader in C# with ComPDFKit PDF SDK. Take just a few minutes and get started.

Requirements

  • Windows 7, 8, 10, and 11 (32-bit and 64-bit).
  • Visual Studio 2017 or higher (Make sure the .NET Desktop Development is installed).
  • .NET Framework 4.5 or higher.

How to Run a Demo

ComPDFKit PDF SDK for Windows provides multiple demos in C# for developers to learn how to call the SDK on Windows. You can find them in the "Examples" folder.

In this guide, we take "PDFViewer" as an example to show how to run it in Visual Studio 2022.

  1. Copy your "license_key_windows.xml" to the "Examples" folder (The file is the license to make your project run).

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

    alternate text is missing from this package README image

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

    alternate text is missing from this package README image

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

    alternate text is missing from this package README image

Note: This is a demo project, presenting completed ComPDFKit PDF SDK functions. The functions might be different based on the license you have purchased. Please check that the functions you choose work fine in this demo project.

How to Make a Windows Program in C#

Create a New Project

  1. Open Visual Studio 2022, and click Create a new project.

    alternate text is missing from this package README image

  2. Choose WPF App (.NET Framework) and click Next.

    alternate text is missing from this package README image

  3. Configure your project: Set your project name and choose the location to store your program. The project name is called "ComPDFKit Demo" in this example. This sample project uses .NET Framework 4.6.1 as the programming framework.

    alternate text is missing from this package README image

  4. Click the Create button. Then, the new project will be created.

Add ComPDFKit to Your Project

There are two ways to add ComPDFKit to your Project: Nuget Repository and Local Package, you can choose one or the other according to your needs.

Nuget Repository

  1. Open your project's solution, and in the Solution Explorer, right-click on References and click on the menu item Manage NuGet Packages. This will open the NuGet Package Manager for your solution.

    alternate text is missing from this package README image

  2. Go to ComPDFKit.NetFramework in Nuget, and click on the Install button to install the package.

    alternate text is missing from this package README image

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

    alternate text is missing from this package README image

Local Package

Rather than targeting a package held at Nuget, you may set up a configuration to point to a local package. This can be useful for some situations, for example, your build machines don't have access to the internet.

  1. You can find "ComPDFKit.NetFramework....nupkg" file in the SDK Package

  2. Create or edit a "nuget.config" file in the same directory as your solution file (e.g. "ComPDFKit Demo.sln").

alternate text is missing from this package README image

  • The contents of the file should contain an XML element, packageSources - which describes where to find NuGet packages - as a child of a root node named configuration. If the file already exists, add the extra packageSources entry shown below. If the file is blank, copy and paste the entirety of the following contents:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <add key="ComPDFKitSource" value="path\to\directoryContainingNupkg" />
    </packageSources>
</configuration>
  • Edit the value of the contents to correctly refer to the location of the directory containing the "ComPDFKit.NetFramework....nupkg" package - for example, C:\Users\me\nugetPackages. Now save the file, and close and reopen your solution for Visual Studio to force a read of the NuGet configuration.
  1. Open your project's solution, and in the Solution Explorer, right-click on References and click on the menu item Manage NuGet Packages…. This will open the NuGet Package Manager for your solution.

    alternate text is missing from this package README image

  2. On the right-hand side of the manager in the Package source dropdown window, choose the entry ComPDFKitSource (or whatever you decided to name it). You should then see the entry for "ComPDFKit.NetFramework".

    alternate text is missing from this package README image

  3. On the right side, in the panel describing the package, click on the Install button to install the package.

    alternate text is missing from this package README image

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

    alternate text is missing from this package README image

Apply the License Key

You can contact ComPDFKit team to get a trial license. Before using any ComPDFKit PDF SDK classes, a required operation is to set the license key. Add the following method - LicenseVerify() to "MainWindow.xaml.cs".

bool LicenseVerify()
{
    if (!CPDFSDKVerifier.LoadNativeLibrary())
        return false;

    LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify("input your license here");
    return (verifyResult == LicenseErrorCode.E_LICENSE_SUCCESS);
}

Display a PDF Document

We have finished all prepare steps. Let's display a PDF file.

  1. Add the following code to "MainWindow.xaml" and "MainWindow.xaml.cs" to display a PDF document. Please make sure to replace "ComPDFKit_Demo" with the name of your project. Now, all you need to do is to create a CPDFViewer object, and then display the CPDFViewer object in the Grid (component) named "PDFGrid" using the OpenPDF_Click method.

  2. Now your "MainWindow.xaml" should look like the following code.

<Window x:Class="ComPDFKit_Demo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:ComPDFKit_Demo"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800" UseLayoutRounding="True">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="52"/>
        </Grid.RowDefinitions>
        <Grid Name="PDFGrid" Grid.Row="0" />
        <Button Content="Open PDF" Grid.Row="1" HorizontalAlignment="Left" Margin="10" Click="OpenPDF_Click"/>
    </Grid>
</Window>
  1. Now your “MainWindow.xaml.cs” should look like the following code. Please note: You need to enter your license key. All the places that need to be modified in the code have been marked with comments in the code below. You just need to replace the string content below the comments by yourself.
using ComPDFKit.NativeMethod;
using ComPDFKit.PDFDocument;
using ComPDFKitViewer.PdfViewer;
using Microsoft.Win32;
using System.Windows;

namespace ComPDFKit_Demo
{
	public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            LicenseVerify();
        }
        
        bool LicenseVerify()
        {
            if (!CPDFSDKVerifier.LoadNativeLibrary())
        		return false;

    		LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify("input your license here");
    		return (verifyResult == LicenseErrorCode.E_LICENSE_SUCCESS);
        }

        private void OpenPDF_Click(object sender, RoutedEventArgs e)
        {
            // Get the path of a PDF file.
            var dlg = new OpenFileDialog();
            dlg.Filter = "PDF Files (*.pdf)|*.pdf";
            if (dlg.ShowDialog() == true)
            {
                // Use the PDF file path to open the document in CPDFViewer.
                CPDFViewer pdfViewer = new CPDFViewer();
                pdfViewer.InitDocument(dlg.FileName);
                if (pdfViewer.Document != null &&
                    pdfViewer.Document.ErrorType == CPDFDocumentError.CPDFDocumentErrorSuccess)
                {
                    pdfViewer.Load();
                    PDFGrid.Children.Add(pdfViewer);
                }
            }
        }
    }
}
  1. Now run the project and you will see the PDF file that you want to display. The PDF Viewer has been created successfully.

alternate text is missing from this package README image

Troubleshooting

If you meet some other problems when integrating our ComPDFKit PDF SDK for Windows, feel free to contact our support team.

Samples

The Samples use preset parameters and documentation to call the API of ComPDFKit for each function without UI interaction or parameter settings. They not only demonstrate the best practices for each function but also provide detailed introductions. The impact of each function on PDF documents can be observed in the output directory. With the help of the Samples, you can quickly learn how to use the functions you need and apply them to your projects.

You can get our code examples for Windows on our website. To learn more about the ComPDFKit API, please visit our API Reference.

Support

ComPDFKit has a professional R&D team that produces comprehensive technical documentation and guides to help developers. Also, you can get an immediate response when reporting your problems to our support team.

  • For detailed information, please visit our Guides page.

  • Stay updated with the latest improvements through our Changelog.

  • For technical assistance, please reach out to our Technical Support.

  • To get more details and an accurate quote, please contact our Sales Team.

License

ComPDFKit PDF SDK supports flexible licensing options, please contact our sales team to know more. Each license is only valid for one application ID in development mode. However, any documents, sample code, or source code distribution from the released package of ComPDFKit PDF SDK to any third party is prohibited.

Note

We are glad to announce that you can register a ComPDFKit API account for a free trial to process 1000 documents per month for free.

Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.5

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.3 183 9/12/2024
2.1.0 162 8/13/2024
2.0.0 180 5/31/2024
1.13.0 600 2/20/2024
1.12.0 712 1/16/2024
1.11.0 1,079 12/6/2023
1.10.0 1,117 10/16/2023
1.9.1 1,376 8/15/2023
1.9.0 1,281 7/5/2023
1.8.1 1,453 7/5/2023
1.8.0 1,510 5/11/2023
1.7.0 1,827 4/28/2023

***Release Date: Aug, 6, 2024***
Version 2.1.0
- New Features
1. Added annotation reply functionality.
2. Optimized text aggregation logic for content editing.
3. Optimized UX for content editing.
4. Added font subsetting.

*** Release Date: May, 27, 2024 ***
Version 2.0.0
- New Features
1. Upgraded underlying libraries to improve rendering speed and stability.
2. Restructured SDK, providing more customizable interactions.
3. Added font management functionality, enabling the use of local fonts in annotations, forms, watermarks, and other features.

*** Release Date: Feb 18, 2024 ***
Version 1.13.0
- New Features
1. Added support for online license verification.
2. Added support for measurement.

- Issues Addressed
1. Fixed issues with can't paste images from the system clipboard in editing mode.
2. Optimized the copy and paste interaction experience in content editing mode.

*** Release Date: January 15, 2024 ***
Version 1.12.0
- New Features
1. Added support for finding and replacing text in content editor mode, allowing to set ignore case, whole words only, and replace all.
2. Added support for customizing image rotation angle from - 180° to 180° for image editing in ComPDFKit SDK Demo.
3. Added support for customizing the mouse scrolling step when reading page turns.
4. Added support for saving as flattened PDF in ComPDFKit SDK Demo.

- Issues Addressed
1. Optimized the search smoothness in large documents in ComPDFKit SDK Demo.

     
*** Release Date: December 1, 2023 ***
Version 1.11.0
- New Features
1. A new method of verifying licenses is now available: Deprecated "CPDFSDKVerifier.LicenseVerify(string licenseKey, string licenseSecret)" in favor of the new "CPDFSDKVerifier.LicenseVerify(string license, bool isFile)". To update the ComPDFKit SDK to version V1.11.0, but don't have a new license, reach out to the ComPDFKit team.
2. Added multi-language support for the ComPDFKit SDK Demo in English and Chinese.
3. Added the demo UI of ComPDFKit SDK: Security, watermark, and Home Page.
4. Added the Digital Signature feature to the ComPDFKit SDK demo.
5. Added the support to select multiple PDF contents under the content editor mode.

- Issues Addressed
1. Fixed the crash issue that was caused by deleting the digital signature after removing PDF pages with the digital signature appearance.
2. Fixed the crash issue that calls the SetInfo method of the CPDFDocument class with unset properties.
     
*** Release Date: October 12, 2023 ***
Version 1.10.0
- New Features
1. Added support for digital signatures.
2. Added support for resetting the filled content of all the forms in the document.

- Issues Addressed
1. Fixed the crash issue when adding a background to specific documents.
2. Fixed the issue that the processing of editing PDF text can't be restored with undo.
     
*** Release Date: August 14, 2023 ***
Version 1.9.1
- New Features
1. Added support for adjusting the default properties when creating text boxes.
2. Added support for adapting the width when resizing PDF size.
3. Added support for more shortcuts in editing text.

- Issues Addressed
1. Fixed issues that garbled characters are displayed when inputting text into stamp annotations.
2. Optimized inputting text and matching the font style with the original text in editing text.
3. Optimized the UI interaction for copying and pasting in content editor mode.

*** Release Date: July 5, 2023 ***
Version 1.9.0
- New Features
1. Added support for setting the fill color of line annotations.
- Issues Addressed
1. Fixed issues with selectting link annotations failed.
2. Fixed issues that can't delete the last option in list boxes and combo boxes.
3. Fixed issues with getting a blurry image when copying.
4. Fixed  interaction issues of check boxes.
5. Optimized getting the text properties of the text area in text editing, and optimized the layouts of files.

*** Release Date: June 15, 2023 ***
Version 1.8.1
- Issues Addressed
 1. Fixed issues with note annotations and free text annotations.
 2. Optimized two operations in viewing: image and text selection function, and convenient operation in the blank area outside the document.

*** Release Date: Mar 24, 2023 ***
Version 1.8.0
- New Features
 1. Added support for new features for text editing, like adding other fonts, setting the text is bold/italic, copying text style, and modifying text transparency.
 2. Added support for new levels of document encryption, including AES-128 and AES-256.
- Issues Addressed
 1. Fixed issues with text editing in Vietnamese.