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 demonstrate supported features and APIs for achieving various PDF-related tasks with the GemBox.Pdf component.

System Requirements

GemBox.Pdf works on .NET Framework 3.5 or higher and platforms that implement .NET Standard 2.0 or higher. It doesn't have any other dependency.

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.

Screenshot of simple PDF file created with GemBox.Pdf
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.

Check next example or download examples from GitHub.