PDF Library for C# and VB.NET applications

The fastest way to get started with the GemBox.Pdf library is by exploring our collection of C# and VB.NET examples. These are live examples that show supported features and APIs for achieving various PDF-related tasks with the GemBox.Pdf component.

System Requirements

GemBox.Pdf requires only .NET, it doesn't have any other dependency.
You can use it on:

  • .NET Framework 3.5 - 4.8
  • .NET Core 3.0
  • Platforms that implement .NET Standard 2.0 or higher.

Hello World

The first step in using the GemBox.Pdf library is to add a reference to GemBox.Pdf.dll within your C# or VB.NET project. There are three ways to do that.

a) Add from NuGet.

You can add GemBox.Pdf as a package by using the following command from the NuGet Package Manager Console:

Install-Package GemBox.Pdf

Or you can search and add GemBox.Pdf from the NuGet Package Manager.

Adding GemBox.Pdf library from NuGet

b) Add from Setup.

You can download the GemBox.Pdf Setup from this page. After installing the setup, you can add a reference to GemBox.Pdf.dll from the Global Assembly Cache (GAC).

Adding GemBox.Pdf library from GAC

c) Add from a DLL file.

You can download a GemBox.Pdf.dll file from this page and add a reference by browsing to it.

Adding GemBox.Pdf library from DLL

The second step is to add a directive for the GemBox.Pdf namespace.

For a C# project, use: using GemBox.Pdf;
For a VB.NET project, use: Import GemBox.Pdf

The third step is to set the license key to use GemBox.Pdf in one of its working modes.

To use a Free mode in a C# project, use: ComponentInfo.SetLicense("FREE-LIMITED-KEY");
To use a Free mode in a VB.NET project, use: ComponentInfo.SetLicense("FREE-LIMITED-KEY")

You can read more about GemBox.Pdf's working modes on the Evaluation and Licensing help page.

The last step is to write your application-specific PDF code, like the following example code, which shows how to create a simple PDF document with two blank pages.

Simple PDF file created with GemBox.Pdf
Screenshot of simple PDF file created with GemBox.Pdf
using GemBox.Pdf;

class Program
    static void Main()
        // If using Professional version, put your serial key below.

        using (var document = new PdfDocument())
            // Add a first empty page.

            // Add a second empty page.

            document.Save("Hello World.pdf");
Imports GemBox.Pdf

Module Program

    Sub Main()

        ' If using Professional version, put your serial key below.

        Using document As New PdfDocument()

            ' Add a first empty page.

            ' Add a second empty page.

            document.Save("Hello World.pdf")

        End Using

    End Sub

End Module

GemBox.Pdf library simplifies PDF page content operations by compiling them into elements of text, paths, and external objects (images and forms). These elements are currently read-only since the main goal was to extract the Unicode representation of text (see Reading example and Content Streams and Resources help page).

Adding new content to a PDF document is currently supported via low-level Objects, such as in this Content Stream example.

If you want to create complex PDF documents, use GemBox.Document, GemBox.Spreadsheet, and GemBox.Presentation, which all have PDF exporting capability.

Want more?

Next example GitHub

Check the next example or select an example from the menu. You can also download our examples from the GitHub.

Like it?

Download Buy

If you want to try the GemBox.Pdf yourself, you can download the free version. It delivers the same performance and set of features as the professional version, but with some operations limited. To remove the limitation, you need to purchase a license.