.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.

Prerequisites

  • .NET Core SDK
    • Note: Apryse SDK is multi-targeting. Target Frameworks : .NET Core 3.1+, .NET Standard 2.1, .NET 5, .NET 6, .NET 7, .NET 8.
  • Apryse SDK for Linux:

Download Linux 64-bit Apryse SDK

Download

Download Linux 64-bit ARM Apryse SDK

Download

Download Linux 32-bit Apryse SDK

Download

Note: For Alpine Linux specific details, please consult Alpine Linux guide.

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).

Initial setup

  1. Download the Apryse SDK.
  2. Extract via tar xvzf PDFNetC64.tar.gz or tar xvzf PDFNetCArm64.tar.gz or tar xvzf PDFNetCAlpine64.tar.gz or tar xvzf PDFNetC.tar.gz.
  3. Get your Apryse trial key.

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 the samples

Run a specific sample

  1. Navigate to the CS folder in the sample you want to run(e.g. /Samples/AddImageTest/CS and execute

sh

1dotnet run

Run all samples

  1. Navigate to /Samples and make a new file named runall_dotnetcore.sh. Open up the file and paste the shell script from Github into it.
  2. Next give yourself execute permissions by

sh

1chmod a+x runall_dotnetcore.sh

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

Integrate into your application

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. Create a new project called myApp from the terminal:

sh

1dotnet new console -o myApp

This guide will assume your project is named myApp.

Next, you can edit Program.cs.

  1. Open Program.cs in your favorite text editor and add the necessary headers:

C#

1using pdftron.Common;
2using pdftron.PDF;
3using pdftron.SDF;
  1. Initialize PDFNet in your main function:

C#

1static void Main(string[] args)
2{
3 Console.WriteLine("Hello World!");
4 pdftron.PDFNet.Initialize("YOUR_APRYSE_LICENSE_KEY");
5}
  1. 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(PDFDoc doc = new PDFDoc()){
2 Page page = doc.PageCreate(); // Start a new page
3 doc.PagePushBack(page); // Add page to document
4}

C#

1doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized); // Save document as a linearized PDF

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}
  1. Now run the application by executing dotnet run. If all goes well, your console should output:

sh

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

Check the output.pdf that the program output in the same directory. It should be a PDF with one blank page.

Next step

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales