Skip to main content
Version: Version 1.7

Get started with .NET

This guide walks you through the steps to use a sample project, and then explains how to integrate the Toolbox add-on into your application with .NET.

Prerequisites

The Toolbox add-on for .NET requires .NET and .NET Core 2.0 or higher, or .NET Framework 4.6.1 or higher.

Getting started with a sample project

Learn how to use Toolbox add-on using a C# sample project and extract all images and image masks from a PDF document.

Compile and run the sample

info

This sample describes the process using Visual Studio 2022.

  1. Download a sample project, and then unzip the file.
  2. In the sample folder, double click ToolboxImageExtraction.csproj
  3. In the Program.cs file, replace the string "insert-license-key-here" with your license key:
Sdk.Initialize("insert-license-key-here", null);
  1. Click Build -> Build Solution to compile the project.

  2. Run the compiled sample application. Provide inputPath for the input PDF file and outputDir path for the output directory where the image files will be stored:

    ToolboxImageExtraction <inputPath> <outputDir>

    For example, to extract all images and image masks from the sample PDF file ImageCollection.pdf to the output directory /tmp/images, run:

    ToolboxImageExtraction ImageCollection.pdf /tmp/images
tip

You can apply a similar procedure as described in this tutorial for other code samples. For more information, see Code samples page.

Integrate the Toolbox add-on into your application

Integrate and initialize the Toolbox add-on into your application by following the instructions in the next sections.

Add the Toolbox add-on to your project

info

The integration section describes the process using Visual Studio 2022 on Windows.

  1. Open your solution in Visual Studio.
  2. Click Tools > Nuget Package Manager > Manage NuGet Packages for Solution....
  3. Click the Search tab and search for PdfTools.Toolbox.
  4. Select the NuGet package named PdfTools.Toolbox by PDF Tools AG, select your Project, and then click Install.
  5. Click OK to allow the changes, and then review and Accept the license agreement.

Initialize the SDK

After installing the Nuget package the final step before using the SDK is to initialize the SDK with your license key. Substitute the <PDFSDK,V1,include-your-key-here> in the following method with the value of your license key:

PdfTools.Toolbox.Sdk.Initialize("<PDFSDK,V1,include-your-key-here>", null);
tip

Without a valid license key the Toolbox add-on returns an error. Get in touch with the Pdftools sales team through the Contact page to get a full license.

Implement your use case

  • Find more use cases and sample projects at the Toolbox add-on Code samples page.
  • For more technical information about the Toolbox add-on for .NET, consult the .NET technical notes.