Get started with the Apryse Server SDK .NET PDF library integration

This guide shows how to build a simple .NET PDF application that uses the Apryse Server SDK and PDFNet library to generate a PDF programmatically. You’ll set up a minimal project, install the SDK, and add the required code to create a blank PDF document. This example provides a practical foundation for building more advanced document‑generation workflows.

To get started, choose your preferred platform from the following tabs.

Prerequisites

Before you start:

License Key

Apryse collects some data regarding your usage of the SDK for product improvement.

If you wish to continue without data collection, contact us and we will email you a no-tracking trial key for you to get started.

Run Apryse SDK in production.

A commercial license key is required for use in a production environment. Contact sales to purchase a commercial license key.

Keep your commercial license key confidential.

License keys are uniquely generated and strictly confidential. Don't publish or store them in any public location, including public GitHub repositories.

Info

For Alpine Linux-specific instructions, see the Alpine Linux guide.

1. Set up your project

Set up your project by creating a folder and preparing your workspace for the application.

  1. Go to your Home directory and create a new NewApryseProject folder.
  2. Right-click the NewApryseProject folder and select Open in Terminal.
  3. In your terminal, create a new .NET console application:

Bash

1dotnet new console

A successful output looks similar to:

Bash

1The template "Console App" was created successfully.
2
3Processing post-creation actions...
4Restoring <project-path>/<project-name>.csproj:
5 Restore succeeded.

2. Add the Apryse SDK

Next, integrate the Apryse Server SDK into your .NET application and add the code needed to generate a PDF.

  1. Navigate to the ~/NewApryseProject directory in your terminal, then run one of these commands to install the Apryse SDK:

Bash

1# Choose ONE of the following based on your system architecture:
2
3# Run to add the PDFTron .NET package for x64 (Intel/AMD) systems
4dotnet add package PDFTron.NET.x64
5
6# Run to add the PDFTron .NET package for ARM64 systems
7dotnet add package PDFTron.NET.ARM

The command downloads the .NET package from NuGet and makes the library available to your application. A successful output looks like:

Bash

1Build succeeded.
2
3info : Adding PackageReference for package 'PDFTron.NET.ARM' into project ...
4info : Installed PDFTron.NET.ARM <version>.
5info : PackageReference for package 'PDFTron.NET.ARM' version '<version>' added ...
6log : Restored <project-path>/<project-name>.csproj.

2. Open the Program.cs file in Visual Studio Code or your preferred code editor:

Text

1~/NewApryseProject/Program.cs

3. Replace Program.cs with the following code, update your license key, and save your changes:

C#

Program.cs

1// Import namespaces
2using System;
3using pdftron.Common;
4using pdftron.PDF;
5using pdftron.SDF;
6
7// Create console app entry point
8namespace myApp
9{
10 class Program
11 {
12 static void Main(string[] args)
13 {
14 Console.WriteLine("Hello World!");
15
16 // Initialize Apryse SDK
17 // Replace with your demo license key
18 pdftron.PDFNet.Initialize("YOUR_LICENSE_KEY");
19
20 using(PDFDoc doc = new PDFDoc()){
21
22 // Start a new page
23 Page page = doc.PageCreate();
24
25 // Add page to document
26 doc.PagePushBack(page);
27
28 // Save document as a linearized PDF
29 doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized); // Save document as a linearized PDF
30
31 }
32 }
33 }
34}

Info

If you're signed in with an Apryse account, your license key is automatically prepopulated in all code snippets.

With this code, you can:

  • Import the required Apryse PDFNet namespaces.
  • Define a console application entry point using Main.
  • Log a startup message to the console.
  • Initialize the Apryse SDK with a license key.
  • Create a new PDF document, add a blank page, and save it as a linearized PDF.
  • Automatically release document resources with the using statement.

3. Verify your output

Finally, build and run your application to confirm that the Apryse Server SDK is working correctly. After the application runs successfully, it will generate a blank PDF file locally.

  1. Navigate to the Home > NewApryseProject folder, and right-click to select Open in Terminal.
  2. In the terminal, build and launch the application:

Bash

1dotnet run

A successful output looks similar to:

Bash

1Hello World!
2
3PDFNet is running in demo mode.
4PackageV2: base

3. Navigate to the Home > NewApryseProject folder.

4. Verify the blank output.pdf file was generated programmatically using the Apryse Server SDK. The folder structure looks similar to:

Text

1NewApryseProject/
2├── bin/
3├── obj/
4├── NewApryseProject.csproj
5├── output.pdf
6└── Program.cs

Get started video

Get started with the Apryse Server SDK and .NET on Windows by watching this 4-minute video.

Get started video for Apryse Server SDK on the Windows platform

Next Steps

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales