Some test text!
Core / Guides / .NET Core
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.
Windows
Linux
macOS
.NET Core
Azure Functions
This guide will help you run Apryse samples and integrate a free trial of the Apryse SDK into .NET Core applications on Windows. Your free trial includes unlimited trial usage and support from solution engineers.
Make sure that the .NET Core cross-platform development
workload and MSBUILD
are part of your installation.
This guide will use Visual Studio 2017. If you would like to use the NuGet integration for Windows x64 please make sure you have Visual Studio 2017 or later.
Note: Apryse SDK is multi-targeting. Target Frameworks : .NET Core 2.1+
, .NET Standard 2.1
, .NET 5
, .NET 6
, .NET 7
, .NET 8
.
Apryse's .NET Core PDF library for Windows:
This article uses PDFNET_BASE
as the path into the folder that you extracted.
PDFNET_BASE = path/to/extraction/folder/PDFNetC(64)/
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.
Navigate to the location of extracted contents. Find and enter the Samples
folder (PDFNET_BASE/Samples
). Here you can find sample code for a large number of features supported by the Apryse SDK.
Run a specific sample
Find the sample you want to run and navigate into the CS
folder inside.
Open a Command Prompt here and run:
dotnet run
Alternatively, you can open the project in Visual Studio, Set as Startup Project
and run it (F5).
Run all samples
Download the runall_dotnet.bat
zip and extract the file into the PDFNET_BASE/Samples
folder.
Double click the file in this location to run all the .NET Core samples.
You can follow a manual or nuget integration as described below.
This section will help you build the "Apryse Hello World" application. It is easy to integrate the rest of Apryse SDK if you are able to open, save and close a PDFDoc.
Open a new instance of Visual Studio 2017 and create a new .NET Core console application project (File > New > Project...
). You can find this under the Visual C# menu.
Click on OK and allow the IDE to create the project.
Find the Solution Explorer on the right side of the screen. Select the project and press Alt + Enter
. This will open the properties tab.
Alternatively, you can right click on the project and find the properties option.
Select .NET Core 2.1 (or above) as the target framework for your application.
If you are using a Windows x64 machine for your .NET Core development, you can use NuGet package manager to get the Apryse SDK. Otherwise, please integrate the SDK manually.
Right click on project Dependencies and click on Add Reference. This will open the Reference Manager dialog. Click on the Browse...
option at the bottom of the dialog. Navigate to PDFNET_BASE/Lib
and select PDFNetDotNetCore.dll
and click Add.
Click OK on the Reference Manager and continue.
In the Solution Explorer, select the project and press Shift + Alt + A
. With this you can Add an Existing Item.
Alternatively, you can right click on the project and find the Add an existing item...
option under the Add
submenu.
Once again, navigate to PDFNET_BASE/Lib
. Choose the file type as All Files (*.*)
and select PDFNetC.dll
. Click on Add.
Select PDFNetC.dll in the solution explorer. A properties window should appear below. In it, change the Build Action setting to Content
and the Copy to Output Directory setting to Copy always
. To avoid errors, use the drop-down menus available for those fields.
This section will go through the nuget integration steps.
Perform the first 2 steps of integrating manually.
Right click on project Dependencies and click on Manage NuGet Packages...
. This will open the NuGet Package Manager.
Click on the Browse
tab near the top of the package manager. In the search bar enter:
PDFTron.NET.x64
Select the PDFTron.NET.x64
package by Apryse Systems Inc. and click on the Install
button in the panel with the package information. If you're prompted or an external dialog is opened for confirmation, click on Ok
.
Get your Apryse trial 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.
Replace the contents of Program.cs
with:
using System;
// Most commonly used namespaces for Apryse SDK.
using pdftron;
using pdftron.Common;
using pdftron.PDF;
using pdftron.SDF;
namespace myApp
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
// Initialize PDFNet before using any Apryse related
// classes and methods (some exceptions can be found in API)
PDFNet.Initialize("YOUR_APRYSE_LICENSE_KEY");
// Using PDFNet related classes and methods, must
// catch or throw PDFNetException
try
{
using (PDFDoc doc = new PDFDoc())
{
doc.InitSecurityHandler();
// An example of creating a new page and adding it to
// doc's sequence of pages
Page newPg = doc.PageCreate();
doc.PagePushBack(newPg);
// Save as a linearized file which is most popular
// and effective format for quick PDF Viewing.
doc.Save("linearized_output.pdf", SDFDoc.SaveOptions.e_linearized);
System.Console.WriteLine("Done. Results saved in linearized_output.pdf");
}
}
catch (PDFNetException e)
{
System.Console.WriteLine(e.Message);
}
// Makes the program wait to terminate after user input
Console.ReadKey();
}
}
}
Run the program using the Local Windows Debugger. The program will give the following output in the console:
You should see an output file produced at the location of your project. If you used .NET Core 2.1, then by default it will be in the following folder:
C:\Users\User_Name\source\repos\myApp\myApp\bin\Debug\netcoreapp2.1
Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales