Click or drag to resize

Hello World Example

Before using GemBox.Pdf, you need to install the component using one of the following methods:

Step–by–step guide to using GemBox.Pdf

  1. Create a new .NET project (or use an existing one).

  2. If you installed Setup, then add a reference to the GemBox.Pdf component using the Add Reference dialog (it'll be under Assemblies -> Extensions); otherwise you can skip this step (NuGet automatically adds a reference).

  3. Add a directive for GemBox.Pdf namespace; for a C# project use "using GemBox.Pdf;", for a VB.NET project use "Import GemBox.Pdf".

  4. Set the license key to use GemBox.Pdf in Free mode; for a C# project use "ComponentInfo.SetLicense("FREE-LIMITED-KEY");", for a VB.NET project use "ComponentInfo.SetLicense("FREE-LIMITED-KEY")".

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 two 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.