Build a .NET Framework PDF library app with Apryse Server SDK
This guide shows how to build a simple .NET Framework PDF application on Windows that uses the Apryse Server SDK and PDFNet library to generate a PDF programmatically. You’ll set up a minimal project, install the SDK, and add the required code to create a blank PDF document. This example provides a practical foundation for building more advanced document‑generation workflows.
Prerequisites
Install Visual Studio to build, test, and deploy applications. This guide uses Visual Studio 2022. The minimum supported version is Visual Studio 2019.
Install the .NET desktop development workload and the .NET Framework development tools for your version of .NET Framework. You can install these components through the Visual Studio Installer. For more, see Microsoft's documentation.
Get your Apryse trial key.
1. Set up your project
In Visual Studio, begin by setting up your project and preparing your workspace for the application.
Open Visual Studio and go to File > New > Project.
Select C# Console App (.NET Framework) or VB Console App (.NET Framework), then click Next.
Add a Project name.
Specify where to save your project using the Location field, then click Next.
In the Framework dropdown, select the .NET Framework version. For example, .NET Framework 4.8.1.
Click Create to launch the new app where you can run and debug your project.
2. Add the Apryse SDK
Next, add the Apryse SDK to your .NET Framework application and configure your project to work with PDF documents. You can install the SDK using the NuGet Package Manager (recommended) or manually download and reference the SDK files.
In Visual Studio, go to Tools > NuGet Package Manager > Manage NuGet Packages for Solution.
From the Browse tab, enter Apryse in the Search field. This shows you the various packages that Apryse has published.
From the search results, select PDFNet. For more package information, see NuGet.
In the Manage Packages for Solution dialog, select the project, then click Install.

In the Preview Changes modal, click Apply to install the package in your project.
Check the Output window (Package Manager) to confirm the installation completed successfully:
In Solution Explorer, open the source file for your project (
Program.csfor C# orModule1.vbfor VB). Replace the file contents with the following code, update your license key, and save the file:
With this code, you can:
Import the required Apryse SDK namespaces.
Load the appropriate
PDFNetnative libraries for the application's architecture.Initialize the Apryse SDK with a license key.
Create a new PDF document, add a blank page, and save it as a linearized PDF.
Handle SDK exceptions and automatically release resources.
Terminate the Apryse SDK when processing is complete.
About PDFNetLoader
The NuGet package uses PDFNetLoader to support both 32-bit and 64-bit processes from a single build. It deploys both the x86 and x64 versions of PDFNet.dll and automatically loads the appropriate version at runtime based on the application's architecture.
For most applications, no additional configuration is required. This approach works well with the Any CPU platform target commonly used by .NET Framework projects.
If your application targets a specific architecture, such as x64 or x86, you may be able to deploy only the corresponding version of PDFNet.dll and remove PDFNetLoader. However, this requires additional changes to the project's references and deployment configuration and is not covered in this guide.
In summary, PDFNetLoader is primarily intended for Any CPU applications that need to support both 32-bit and 64-bit processes from the same build.
For more, see our blog post about PDFNetLoader.
Download and unzip the PDFNetDotNet4.zip file.
Copy the extracted
/PDFNetDotNet4/Libfolder.Go to your project's folder. By default, the path is similar to:
Paste the
/PDFNetDotNet4/Libfolder you copied into the project folder that contains your.csprojor.vbprojfile. The resulting structure looks similar to:
In the Solution Explorer in Visual Studio, right-click References > Add Reference.
In the Reference Manager modal, click Browse.
Add the copied
Lib\PDFNetLoader.dllfolder from the following location to the references, and click OK:
Add the following x86 version of
PDFNet.dllas a reference, then click OK:
In the Solution Explorer, select References > PDFNet, and set its Copy Local property to False.
Click to open the
App.configfile from the Solution Explorer, add the followingloadFromRemoteSourcesproperty, and save:
Right-click your project and select Properties.
From the project properties, open the Build Events tab. Add the following command to the Post-build event field:
From the project properties, open the Compile tab, then scroll to the Build Events button. Add the following command to the Post-build event command line field, then click OK:
In Solution Explorer, open the source file for your project (
Program.csfor C# orModule1.vbfor VB). Replace the file contents with the following code, update your license key, and save:
With this code, you can:
Import the required Apryse SDK namespaces.
Load the correct
PDFNetnative libraries based on the application's architecture.Initialize the Apryse SDK with a license key.
Create a new PDF document, add a blank page, and save it as a linearized PDF.
Handle SDK exceptions and automatically release resources.
Terminate the Apryse SDK when processing is complete.
About PDFNetLoader
The steps in this section use PDFNetLoader to support both 32-bit and 64-bit processes from a single build. This approach deploys both the x86 and x64 versions of PDFNet.dll and automatically loads the appropriate version at runtime based on the application's architecture.
For most applications, this level of flexibility is not required. If your application targets a specific architecture, such as x64 or x86, reference the corresponding version of PDFNet.dll directly, set Copy Local to True, update the project's Platform target in Visual Studio, and remove both PDFNetLoader.dll and the PDFNetLoader initialization code.
If your application must support both 32-bit and 64-bit environments, you can continue using PDFNetLoader. Another option is to deploy only the appropriate version of PDFNet.dll based on the target system. For example, a 64-bit installation can deploy the x64 version of PDFNet.dll, while a 32-bit installation can deploy the x86 version. Since only one version is installed, PDFNetLoader is not required.
In summary, PDFNetLoader is primarily intended for Any CPU applications that need to support both 32-bit and 64-bit processes from the same build. Applications that target a specific architecture can usually reference the appropriate version of PDFNet.dll directly.
For more, see our blog post about PDFNetLoader.
3. Verify your output
Finally, build and run your application to confirm that the Apryse Server SDK is working correctly. After the application runs successfully, it will generate a blank PDF file locally.
In Visual Studio, run the app by selecting the Start button on the toolbar, or by pressing F5. A successful output looks similar to:
Navigate to this directory, where the build output is created by default:
Verify the blank
output.pdffile was generated programmatically using the Apryse Server SDK. The folder structure looks similar to:
Next steps
Last updated
Was this helpful?