Getting Started on .NET

Integrating the PSPDFKit .NET Library is simple with the use of the public NuGet repository. Like with most other .NET libraries, you can add PSPDFKit directly from Visual Studio or with the dotnet command-line app.

The following instructions are generic for any .NET product.

Requirements

For details on version support for the PSPDFKit .NET Library, see the compatibility page.

For details on version support for the PSPDFKit .NET Library, see the compatibility page.

For details on version support for the PSPDFKit .NET Library, see the compatibility page.

  1. Create a folder for your application.

  2. Creating a .NET C# console application on all platforms can be done on each platform’s respective command line with:

cd <newly created folder>
dotnet new console

Alternatively, you can use an IDE such as Visual Studio for Windows, or Visual Studio Code on all platforms.

For existing projects, jump straight to the library integration steps below.

Adding the PSPDFKit .NET Library NuGet Package

Using Visual Studio on Windows

It’s possible to add the PSPDFKit .NET Library within the Visual Studio GUI if you’re working in Windows. Please see the Microsoft guide on packages for instructions on how to add a package, and search for PSPDFKit.NET when browsing for the package.

Using the .NET Command-Line Application

A cross-platform solution for adding the PSPDFKit .NET Library to your project would be to use the dotnet command-line application. Run the following command in your project folder to add the PSPDFKit .NET Library package:

dotnet add package PSPDFKit.NET --version 1.4.1

Other Package Installation Options

There are many ways to add a package to a project:

Please refer to the relevant link above for more specific information.

Using the PSPDFKit .NET Library

  1. Now that the PSPDFKit .NET Library is added, you can use the SDK in your application. You need to initialize the SDK prior to calling any other PSPDFKit method. Use the initializeTrial method if you haven’t yet bought a license key, or the initialize method if you have a key:

PSPDFKit.Sdk.InitializeTrial();
  1. Load a document with:

var fileProvider = new FileDataProvider("path/to/document.pdf");
var document = new Document(fileProvider);
  1. Once you have a document loaded, you can use the rest of the library. See the API docs and guides for more information, or try out the Catalog examples (see below).

Building and Running the Catalog App

The PSPDFKit .NET Library comes with an example application called the Catalog app, which contains many useful examples for exploring the different features of PSPDFKit and getting started quickly. You can find the app in the Example folder of the SDK ZIP file.

To build and run the Catalog app, follow these steps.

  1. Download the latest release.

  2. Extract PSPDFKit.NET-{version}.zip to your desired location and cd into Example/catalog.

  3. Run the Catalog example:

dotnet run --project Catalog

The PSPDFKit .NET Library comes with an example application called the Catalog app, which contains many useful examples for exploring the different features of PSPDFKit and getting started quickly. You can find the app in the Example folder of the SDK ZIP file.

To build and run the Catalog app, follow these steps.

  1. Download the latest release.

  2. Extract PSPDFKit.NET-{version}.zip to your desired location and cd into Example/catalog.

  3. Run the Catalog example:

dotnet run --project Catalog

The PSPDFKit .NET Library comes with an example application called the Catalog app, which contains many useful examples for exploring the different features of PSPDFKit and getting started quickly. You can find the app in the Example folder of the SDK ZIP file.

To build and run the Catalog app, follow these steps.

  1. Download the latest release.

  2. Extract PSPDFKit.NET-{version}.zip to your desired location.

  3. From the extracted files, open the Example/Catalog.sln solution in Visual Studio (or an equivalent IDE supporting the .NET Framework).

  4. Choose the solution platform x86 or x64.

  5. Build and run the project from the IDE, or use the following command:

dotnet run --project Catalog

It’s recommended that you integrate the PSPDFKit .NET Library with the package hosted on the public NuGet repository. However, if you don’t have access to the internet on your development machine, or if you have strict CI requirements, then it’s possible to download the PSPDFKit .NET Library from the PSPDFKit servers and integrate it into your .NET project manually.

Requirements

For details on version support for the PSPDFKit .NET Library, see the compatibility page.

For details on version support for the PSPDFKit .NET Library, see the compatibility page.

For details on version support for the PSPDFKit .NET Library, see the compatibility page.

  1. Create a folder for your application.

  2. Creating a .NET C# console application on all platforms can be done on each platform’s respective command line with:

cd <newly created folder>
dotnet new console

Alternatively, you can use an IDE such as Visual Studio for Windows, or Visual Studio Code on all platforms.

For existing projects, jump straight to the library integration steps below.

Creating the PSPDFKit NuGet Source

The following section shows how to set up a configuration to point to a local package you just downloaded in the PSPDFKit .NET Library binary.

The local configuration is described by a file named nuget.config, which is located in the same directory as the solution file (e.g. Test.sln).

  1. Create or modify the nuget.config file.

  2. Place packageSources in the relevant location, or if the file is new, paste all of the following code:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<packageSources>
		<add key="PSPDFKitSource" value="path/to/directoryContainingNupkg" />
	</packageSources>
</configuration>

Edit the value of the contents to correctly refer to the location of the directory containing the PSPDFKit.NET-*.*.*.nupkg package — for example, /Users/me/nugetPackages. These packages can be found in the unzipped binary downloaded earlier in the nuget directory.

Adding the PSPDFKit .NET Library NuGet Package

Using Visual Studio on Windows

It’s possible to add the PSPDFKit .NET Library within the Visual Studio GUI if you’re working in Windows. Please see the Microsoft guide on packages for instructions on how to add a package, and search for PSPDFKit.NET when browsing for the package.

Ensure you’re searching the newly created NuGet configuration, PSPDFKitSource, defined earlier in the nuget.config file, when locating the package.

Using the .NET Command-Line Application

Now that you have the NuGet source, you can add the package to the project:

  • cd into your project solution.

  • Add the package by running:

dotnet add <PROJECT_NAME> package PSPDFKit.NET --version 1.4.1

<PROJECT_NAME> is the project you want to add the package to.

  • Now restore all the newly added packages with dotnet restore. You’ll need an internet connection to retrieve the dependency projects.

Other Package Installation Options

There are many ways to add a package to a project:

Please refer to the relevant link above for more specific information.

Using the PSPDFKit .NET Library

  1. Now that the PSPDFKit .NET Library is added, you can use the SDK in your application. You need to initialize the SDK prior to calling any other PSPDFKit method. Use the initializeTrial method if you haven’t yet bought a license key, or the initialize method if you have a key:

PSPDFKit.Sdk.InitializeTrial();
  1. Load a document with:

var fileProvider = new FileDataProvider("path/to/document.pdf");
var document = new Document(fileProvider);
  1. Once you have a document loaded, you can use the rest of the library. See the API docs and guides for more information, or try out the Catalog examples (see below).

Building and Running the Catalog App

The PSPDFKit .NET Library comes with an example application called the Catalog app, which contains many useful examples for exploring the different features of PSPDFKit and getting started quickly. You can find the app in the Example folder of the SDK ZIP file.

To build and run the Catalog app, follow these steps.

  1. Download the latest release.

  2. Extract PSPDFKit.NET-{version}.zip to your desired location and cd into Example/catalog.

  3. Run the Catalog example:

dotnet run --project Catalog

The PSPDFKit .NET Library comes with an example application called the Catalog app, which contains many useful examples for exploring the different features of PSPDFKit and getting started quickly. You can find the app in the Example folder of the SDK ZIP file.

To build and run the Catalog app, follow these steps.

  1. Download the latest release.

  2. Extract PSPDFKit.NET-{version}.zip to your desired location and cd into Example/catalog.

  3. Run the Catalog example:

dotnet run --project Catalog

The PSPDFKit .NET Library comes with an example application called the Catalog app, which contains many useful examples for exploring the different features of PSPDFKit and getting started quickly. You can find the app in the Example folder of the SDK ZIP file.

To build and run the Catalog app, follow these steps.

  1. Download the latest release.

  2. Extract PSPDFKit.NET-{version}.zip to your desired location.

  3. From the extracted files, open the Example/Catalog.sln solution in Visual Studio (or an equivalent IDE supporting the .NET Framework).

  4. Choose the solution platform x86 or x64.

  5. Build and run the project from the IDE, or use the following command:

dotnet run --project Catalog