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.
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.
A commercial license key is required for use in a production environment. Contact sales to purchase a commercial license key.
License keys are uniquely generated and strictly confidential. Don't publish or store them in any public location, including public GitHub repositories.
In Visual Studio, begin by setting up your project and preparing your workspace for the application.
Remember the file location for your project. You'll need it later when verifying this workflow.
5. In the Framework dropdown, select the .NET Framework version. For example, .NET Framework 4.8.1.
6. Click Create to launch the new app where you can run and debug your project.
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.

Manage NuGet Packages dialog in Visual Studio with PDFTron.NetFramework.x64 installation options.
5. In the Preview Changes modal, click Apply to install the package in your project.
6. Check the Output window (Package Manager) to confirm the installation completed successfully:
7. In Solution Explorer, open the source file for your project (Program.cs for C# or Module1.vb for VB). Replace the file contents with the following code, update your license key, and save the file:
Program.cs
Module1.vb
If you're signed in with an Apryse account, your license key is automatically prepopulated in all code snippets.
New C# or VB .NET Framework projects often use Any CPU with Prefer 32-bit enabled by default in Visual Studio. On a 64-bit version of Windows, this causes the application to run as a 32-bit process and load the 32-bit Apryse libraries. To run as a 64-bit process, go to Project Properties > Build in Visual Studio and deselect Prefer 32-bit or change the Platform target to x64. This ensures the application can run as a 64-bit process on 64-bit Windows and load the appropriate PDFNet native libraries.
With this code, you can:
PDFNet native libraries for the application's architecture. 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.
/PDFNetDotNet4/Lib folder.4. Paste the /PDFNetDotNet4/Lib folder you copied into the project folder that contains your .csproj or .vbproj file. The resulting structure looks similar to:
5. In the Solution Explorer in Visual Studio, right-click References > Add Reference.
6. In the Reference Manager modal, click Browse.
7. Add the copied Lib\PDFNetLoader.dll folder from the following location to the references, and click OK:
8. Add the following x86 version of PDFNet.dll as a reference, then click OK:
When used with PDFNetLoader.dll, this configuration allows an Any CPU application to run on both 32-bit and 64-bit Windows systems by loading the appropriate Apryse libraries at runtime.
9. In the Solution Explorer, select References > PDFNet, and set its Copy Local property to False.
10. Click to open the App.config file from the Solution Explorer, add the following loadFromRemoteSources property, and save:
App.config
11. 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:
This post-build event copies the Apryse native libraries from the project's Lib\PDFNet folder to the application's output directory (bin\Debug or bin\Release) so that PDFNetLoader can load the appropriate 32-bit or 64-bit binaries at runtime.
12. In Solution Explorer, open the source file for your project (Program.cs for C# or Module1.vb for VB). Replace the file contents with the following code, update your license key, and save:
Program.cs
Module1.vb
If you're signed in with an Apryse account, your license key is automatically prepopulated in all code snippets.
New C# or VB .NET Framework projects often use Any CPU with Prefer 32-bit enabled by default in Visual Studio. On a 64-bit version of Windows, this causes the application to run as a 32-bit process and load the 32-bit Apryse libraries. To run as a 64-bit process, go to Project Properties > Build in Visual Studio and deselect Prefer 32-bit or change the Platform target to x64. This ensures the application can run as a 64-bit process on 64-bit Windows and load the appropriate PDFNet native libraries.
With this code, you can:
PDFNet native libraries based on the application's architecture. 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.
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.
2. Navigate to this directory, where the build output is created by default:
3. Verify the blank output.pdf file was generated programmatically using the Apryse Server SDK. The folder structure looks similar to:
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales