Get Started with the Apryse Server SDK .NET PDF Library Integration

The Apryse Server SDK is cross-platform and supported on Windows, Linux, and macOS. The base package is robust, allowing you to programmatically do the following with PDFs:

Additional functionality

If you’re looking for additional capabilities, we offer add-on packages, such as Smart Data Extraction, and add-on modules, such as Office Conversion. For a complete list of add-ons, refer to the following:

Solutions and benefits

Using the Server SDK allows you to build server-side document processing solutions at scale without relying on client devices or cloud APIs. Since the Server runs entirely on-premises (or in your private cloud), you can ensure security and compliance with full control over access, storage, and encryption. You can also easily integrate with web apps, backend systems, document management systems, and content workflows.

Steps & samples

This guide walks you through steps to work through samples we give you, create a project, and integrate the Apryse Server SDK free trial into your project. We’ll use a .NET Core project as our example project throughout this guide. By the end, you’ll have run through at least one sample, created a project, and built an "Apryse Hello World" within your application.

Get started video

Get started with the Apryse Server SDK on the Windows platform via the following video. If you wish, you may skip this section and follow the steps below to get started.

Get started video for Apryse Server SDK on the Windows platform

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

Linux .NET PDF library integration

You'll get started with our samples to see the output you can create when you integrate the Apryse Server SDK into your application. You'll also create a project and integrate the Server SDK into your application, using the Linux platform.

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. Please contact sales by filling out our licensing form if you want to purchase a commercial license key.

Keep your commercial license key confidential.

License keys are uniquely generated. Please make sure your key is not publicly available (e.g. in your public GitHub).

1. Run a sample

First, you’ll download and run the OfficeToPDFTest sample which allows you to explore and validate the conversion features offered by the SDK. By running the sample, you can quickly:

  • Verify the capabilities.
  • Understand how to interact with the MS Office to Conversion PDF API.
  • Use it as a reference for integrating similar functionality into your own application.
  1. Download the tarball file for Linux suitable for your processor. For this guide, we'll use the Linux Intel file.
  2. Use your Linux file explorer to navigate to the Downloads folder, right-click on the tar.gz tarball file, then select Extract to...
Apryse Docs Image

Navigate to and extract the tarball file.

3. Select Home, New Folder, then enter ApryseSamples, and click Create to create a new folder to extract the tarball file into for running the samples. You can create a folder at a different location if you prefer, but for this guide’s instructions, we used the location and name above.

The ApryseSamples folder is created and the tarball is extracted to the folder.

Apryse Docs Image

Create a new folder for running the samples.

4. Navigate to /Home/ApryseSamples/PDFNetC64/Samples/LicenseKey/CS/LicenseKey.cs and double-click to open so you can add your license key to the LicenseKey.cs file before running the sample.

Apryse Docs Image

Add your license key.

5. Scroll down to the line containing private static string key = “YOUR_PDFTRON_LICENSE_KEY”; and replace the words in quotes with the copy of your trial license key.

6. Save your changes and close the file.

Apryse Docs Image

Add your trial license key to the LicenseKey.cs file.

7. To run the sample, navigate to the folder you created in step 3 above, /Home/ApryseSamples/PDFNetC64/Samples/OfficeToPDFTest/CS, right-click on the CS folder, then select Open in Terminal.

Apryse Docs Image

Run the sample.

8. The Linux terminal opens the OfficeToPDFTest sample. From the project directory, on the command line, enter the following, then press Enter.

sh

1sh RunTest.sh

When you run the sh RunTest.sh command, the sample code loads an Office document, converts the Office document to PDF, saves the resulting PDF, and outputs status messages to the console. For more details, you can look at additional OfficeToPDFsample code and the Convert MS Office (Word, Excel, PowerPoint) to PDF overview.

Apryse Docs Image

The sample code loads, converts, and saves the resulting PDFs.

Once the sample finishes running, you'll see the status Done in the terminal.

9. At the command prompt, type exit, then press Enter.

10. Go to your Linux file explorer and navigate to: /Home/ApryseSamples/PDFNetC64/Samples/TestFiles/Output. You will see three output PDF files (Fisherman.pdf, the_rime_of_the_ancient_mariner.pdf, and the factsheet_Arabic.pdf):

Apryse Docs Image

Three PDF files have been created by running the sample.

11. Open the PDF files to see the converted output. You have successfully run the OfficeToPDFTest conversion sample!

2. Create your own new project

  1. In your Linux file explorer, navigate to the Home folder, and select New Folder.
Apryse Docs Image

Create a folder for your new project.

2. Enter the folder name, NewApryseProject, then click Create.

Apryse Docs Image

Enter the folder name for your new project.

3. Right-click on the NewApryseProject folder and select Open in Terminal.

Apryse Docs Image

Select the new project and open in the terminal.

4. From the project directory, on the command line, enter the following and press Enter:

sh

1dotnet new console

A template "Console App" is created for your new project.

Apryse Docs Image

Create a new console app in the terminal.

5. On the command line, from your project directory, enter the following and press Enter:

sh

1// Use 'dot net add package PDFTron.NET.ARM' if your system has an ARM processor.
2
3dotnet add package PDFTron.NET.x64

You have successfully added the Apryse Server SDK to your .NET project.

Apryse Docs Image

Add the Server package to your project.

6. At the command prompt, type exit and press Enter.

3. Initialize PDFNet & Integrate the Apryse Server SDK into your application

  1. Open Visual Studio Code (or your preferred application) and from the File menu, select Open Folder.
Apryse Docs Image

Open Visual Studio Code.

2. Navigate to the Home folder, select the NewApryseProject folder and click Open.

Apryse Docs Image

Open your new project in Visual Studio Code.

3. The NewApryseProject opens in Visual Studio Code. Navigate to and open the Program.cs file.

Apryse Docs Image

Navigate to and open the Program.cs file.

4. Copy the following C# code and paste in into Line 1 of the Program.cs file (replace the existing content in Line 1 of the file).

C#

1using System;
2using pdftron.Common;
3using pdftron.PDF;
4using pdftron.SDF;
5
6namespace myApp
7{
8 class Program
9 {
10 static void Main(string[] args)
11 {
12 Console.WriteLine("Hello World!");
13 pdftron.PDFNet.Initialize("YOUR_APRYSE_LICENSE_KEY"); // PDFNet must be initialized before accessing any Apryse API
14
15 using(PDFDoc doc = new PDFDoc()){
16
17 Page page = doc.PageCreate(); // Start a new page
18 doc.PagePushBack(page); // Add page to document
19 doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized); // Save document as a linearized PDF
20
21 }
22 }
23 }
24}

5. In the Linux file explorer, navigate to the Home folder. Select the NewApryseProject folder, right-click and select Open in Terminal.

6. From the project directory, on the command line, enter the following, then press Enter.

sh

1dotnet run

The code executes and you will see the message, “Hello World!”

Apryse Docs Image

The code runs and you will see the "Hello World!" message.

7. Exit out of the command line and navigate to the Home > NewApryseProject folder.

Apryse Docs Image

You will see the output.pdf file that was created.

8. Open the output.pdf which you created by integrating the Apryse Server SDK!

9. Now that you have successfully run an OfficeToPDFTest sample and integrated the Apryse Server SDK .NET PDF Library into your application, you can try out 50+ samples depending on your needs:

Apryse Docs Image

You can try over fifty samples for the Apryse Server SDK.

10. To try additional samples, go to section 1. Run a sample > step 4 above and choose another sample to run.

Next steps

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