Click or drag to resize

Hello World Example

After installing a component (to download component, click here), it is installed in Global Assembly Cache (GAC).

To use GemBox.Pdf, follow these steps:

  • Create a new .NET project (or use the existing one).

  • Use Add Reference dialog to add a new reference to the DLL with GemBox.Pdf name. It should be under .NET tab.

  • Import GemBox.Pdf namespace: using GemBox.Pdf; for C# or Import GemBox.Pdf for VB.NET.

  • Set license key to use GemBox.Pdf in a Free mode: ComponentInfo.SetLicense("FREE-LIMITED-KEY"); for C# or ComponentInfo.SetLicense("FREE-LIMITED-KEY") for VB.NET.

Now you can write your application-specific PDF automation code like the one below.

Example

Using the GemBox.Pdf component is easy and straightforward. The following code shows how to create a PDF document with three empty pages:

// Create a new empty PDF document.
using (var doc = new PdfDocument())
{
    // Add a first empty page.
    doc.Pages.Add();

    // Add a second empty page.
    doc.Pages.Add();

    // Save the PDF document as a PDF file.
    doc.Save("Document.pdf");
}
// The PDF file is closed after 'using' block.