.NET Core PDF library integration

Welcome to Apryse. .NET Core for the Apryse SDK is cross-platform and supported on Windows, Linux and macOS. To get started, choose your preferred platform from the tabs below.

Linux .NET Core PDF library integration

This guide will help you run Apryse samples and integrate a free trial of the Apryse SDK into .NET Core applications on Linux. Your free trial includes unlimited trial usage and support from solution engineers.

Run Apryse SDK in production

A commercial license key is required for use in a production environment. Please contact sales to purchase a commercial key or if you need any other license key assistance.

Keep your commercial license key confidential.

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

Prerequisites

  • .NET SDK
    • You may use either .NET 9, .NET 8, .NET Standard or .NET Core

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.

Setup a Project

1) Create a folder that will contain your project and navigate to it.

2) Inside this folder, create a new .NET Core project via

new proj

1dotnet new console


3) This will create some project files for a new .NET Core application. Now you can add the Apryse SDK package.

add

1dotnet add package PDFTron.NET.x64


If you wish to manually download and setup our libraries, you can skip step 3 and download directly from here. You may also choose to download these libraries to run our samples.

Download Linux 64-bit Apryse SDK

Download Linux 64-bit ARM Apryse SDK

Download Linux 32-bit Apryse SDK


Using the Apryse SDK

This section will show you how to use our SDK to create a simple Apryse "Hello World!" application. It will create a document with one blank page and save it as a linearized PDF in its running directory.

1) Import the required headers into your source code.

C#

1using pdftron.Common;
2using pdftron.PDF;
3using pdftron.SDF;

2) Place your Apryse SDK key into the constructor of the PDFNet Initialize call.

add key

1pdftron.PDFNet.Initialize("YOUR_APRYSE_LICENSE_KEY");


3) Instantiate a new document with one blank page. Then save the document as a linearized PDF named output.pdf. Your final program should look like this:

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}

4) Now run the application via dotnet run

sh

1PDFNet is running in demo mode.
2Permission: write
3Hello World!

Running the samples

Run a specific sample

1) Download Linux 64-bit Apryse SDK or another architecture of SDK as mentioned in the setup steps.

2) Extract the SDK and navigate to the Samples directory. Navigate to the sample you wish to run and enter the CS folder.
3) Execute the following command:

sh

1sh RunTest.sh

Run all samples

1) Navigate to /Samples and find the file named runall_dotnetcore.sh.

2) Next give yourself execute permissions on it

sh

1chmod a+x runall_dotnetcore.sh

3) Then run the script using:

sh

1./runall_dotnetcore.sh

The tests will run one by one.

Output files will be in /Samples/TestFiles/Output



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