Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Developing and Deploying Applications with .NET Core and the Adobe PDF Library

12 Nov 2020 1  
In this article, you will learn how APDFL works with .NET Core, along with instructions for how to deploy your applications using APDFL on .NET Core.

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

Datalogics Inc. now offers .NET Core support for the Adobe PDF Library (APDFL), our powerful PDF SDK built upon trusted Adobe technology. Now, users can unlock the power of APDFL on the .NET Core development platform.

About .NET Core

.NET Core is the next generation of the .NET development platform and is the open-source successor to the .NET framework. .NET Core works on Linux and Mac, which allows for cross-platform development using a .NET language (C#, for example). It includes support for a variety of things such Windows Forms Applications, Console applications, Class Libraries, ASP.NET, and WPF.

You may remember that during the release of .NET Core v1.0 from Microsoft, there was not much interest from the development community, due to gaps in the APIs and slow performance. Since the release of v2.0 and v3.0, a majority of those gaps are now filled, and performance has improved, which has helped gain interest from the development community and commercial users alike. For the first time, using .NET is now an option for Linux and Mac for Enterprise users, which is supported by Microsoft.

Using the Adobe PDF Library on .NET Core

Datalogics now offers a .NET Core Class Library that targets v3.1 of .NET Core, which will allow users to develop their .NET applications on Linux and know it’s going to work on Windows or Mac. It also allows users to write their application on Mac and know it’s going to work on Linux or Windows. They can also write their application on Windows and know it’s going to work on Mac or Linux. Users can now leverage the mature, time-tested functionality of the Adobe PDF Library, using the simplicity of the .NET interface in one application that works on Windows, Linux, or Mac.

Developing with .NET Core

All of the dependencies for the Operating System you are developing on are found in the DotNETCore/Binaries directory of your installation package. For the other two Operating Systems where you could deploy your application, the dependencies are included in archive files. For example, if you installed APDFL on a Windows system, two archive files will appear in the DotNETCore/Binaries directory for Linux and macOS, Linux_Dependencies.tar.gz and macOS_Dependencies.zip.

Deploying your .NET Core Application

The process to deploy your application may differ based on how you created that application, so you’ll need to publish your application and then deploy that application with the required dependencies. The steps to do so are as follows.

Deployment Steps

We offer the steps to deploy one of the sample programs (MergePDF) from a Windows system, where the Adobe PDF Library was installed, to a Linux system.

Change to the DotNETCore/Sample_Source/ContentModification/MergePDF directory and issue the publish command:

dotnet publish

This creates a publish folder in the DotNETCore/Binaries folder with some .NET Core dependencies for that sample program. The dependencies can vary depending on the sample.

Then, include the dependencies. Run the deployment script (in the DotNETCore/Binaries folder) that corresponds to the Operating System you want to deploy to. These scripts are .bat files for Windows and .sh files for Linux and macOS. To deploy to Linux, you will use the script bat. This will add the remaining dependencies to the publish folder. The scripts include:

PublishToLinux.bat or .sh
PublishtoMac.bat or .sh
PublishToWindows.bat or .sh

You can edit these scripts as needed, and the comments provided in each script will help you determine the dependencies you need for your application.

More Information about Deploying your Application

Following the previous instructions to deploy the contents of the publish folder to your targeted system, if you were to deploy to a folder called MyApp on Linux, the Linux Dependencies.tar.gz file would be stored in the MyApp folder. This holds the necessary libraries for APDFL to run the sample application. Extract this tar file to the MyApp folder. The dependencies will depend on your deployment Operating System:

Linux_Dependencies.tar.gz
Windows_Dependencies.zip
macOS_Dependencies.zip
To decompress the archive on Linux:

tar xzvf ./Linux_Dependencies.tar.gz

To decompress the archive on Windows, right click on the Windows Dependencies.zip file and select Extract All. Remove "Windows Dependencies" from the end of the path name and click OK. This will allow the file to unzip to the same folder where it was published.

For macOS, double-click the macOS_Dependencies.zip file, thus creating a folder called macOS_Dependencies. Drag the contents of that folder to the folder containing the published app.

Then, run the sample application from the MyApp folder:

dotnet MergePDF.dll

If you are working with a Licensed Managed version of the Adobe PDF Library, activate the software with the key provided to you. You can’t simply move the apdfl18.lic license file from the Operating System where you created your application. In this example, we deployed the MergePDF sample, so the first time you run this program it will ask for the activation key. A new apdfl18.lic file will be created to use on the deployment machine. Copy this license file to the same directory where your application executable is found.

The .NET Core Library ships with new .NET Core sample applications and new documentation. If you’d like to get started with the Adobe PDF Library using .NET Core, visit our website.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here