Free / Trial / Time Limited / Professional

GemBox.Presentation is a .NET library for processing PowerPoint files that has four working modes:

Every working mode uses the same GemBox.Presentation.dll file and delivers the same performance and set of features, but all modes except Professional have some restrictions.

Before using any member of the GemBox.Presentation library from your C# or VB.NET application, you must call a ComponentInfo.SetLicense method to set the working mode.

Free PowerPoint library

The default behavior of the Free mode is that a FreeLimitReachedException is thrown when loading or saving a PowerPoint file with more than 5 slides.

You can change this behavior to achieve the trimming of presentation content to the first 5 slides by handling a ComponentInfo.FreeLimitReached event and setting FreeLimitEventArgs.FreeLimitReachedAction to Stop.

You can use the Free mode for any purpose, including use in commercial applications.

// Set license key to use GemBox.Presentation in a Free mode.
ComponentInfo.SetLicense("FREE-LIMITED-KEY");

// Stop reading/writing a presentation when the free limit is reached.
ComponentInfo.FreeLimitReached += (sender, e) => e.FreeLimitReachedAction = FreeLimitReachedAction.Stop;
' Set license key to use GemBox.Presentation in a Free mode.
ComponentInfo.SetLicense("FREE-LIMITED-KEY")

' Stop reading/writing a presentation when the free limit is reached.
AddHandler ComponentInfo.FreeLimitReached, Sub(sender, e) e.FreeLimitReachedAction = FreeLimitReachedAction.Stop

Trial PowerPoint library

You can use the Trial mode to evaluate beyond the first 5 slides. Both Free and Trial modes use the same FREE-LIMITED-KEY key and can be used for an unlimited time period.

To set the mode to Trial, you need to handle a ComponentInfo.FreeLimitReached event and set FreeLimitEventArgs.FreeLimitReachedAction to ContinueAsTrial.

The limitations of Trial mode are that, when loading a PowerPoint file, random parts of presentation text after the 5th slide will be scrambled but still readable and when saving a PowerPoint file, a promotional header text box will be added to every slide after the 5th slide.

// Set license key to use GemBox.Presentation in a Free mode.
ComponentInfo.SetLicense("FREE-LIMITED-KEY");

// Continue to use the component in a Trial mode when free limit is reached.
ComponentInfo.FreeLimitReached += (sender, e) => e.FreeLimitReachedAction = FreeLimitReachedAction.ContinueAsTrial;
' Set license key to use GemBox.Presentation in a Free mode.
ComponentInfo.SetLicense("FREE-LIMITED-KEY")

' Continue to use the component in a Trial mode when free limit is reached.
AddHandler ComponentInfo.FreeLimitReached, Sub(sender, e) e.FreeLimitReachedAction = FreeLimitReachedAction.ContinueAsTrial

Time Limited PowerPoint library

You can also use the Time Limited mode to evaluate beyond the first 5 slides.

To set the mode to Time Limited, you need to use a temporary or time-limited key, which you can get by contacting us.

The limitation of Time Limited mode is that it can be used only for 30 days.

// Set license key to use GemBox.Presentation in a Time Limited mode.
ComponentInfo.SetLicense("XX−<START DATE>−<END DATE>-XXXXXXXXXX");
' Set license key to use GemBox.Presentation in a Time Limited mode.
ComponentInfo.SetLicense("XX−<START DATE>−<END DATE>-XXXXXXXXXX")

Professional PowerPoint library

To set the mode to Professional, you need to use a professional key which you can get by purchasing a license.

The Professional mode has no limitations, and the professional keys are perpetual (they can be used forever).

// Set license key to use GemBox.Presentation in a Professional mode.
ComponentInfo.SetLicense("XXXXXXXXXX");
' Set license key to use GemBox.Presentation in a Professional mode.
ComponentInfo.SetLicense("XXXXXXXXXX")

Important, every developer working on an application that uses the GemBox component in Professional mode, must be covered with a license. The professional keys are uniquely generated for each license and must be kept confidential.

For more information, please read the FAQ page and the product's EULA.

If you're working on an open-source project, please make sure that your license is not publicly accessible. One way to keep the professional key out of your source code is to bind your project's configuration to an external source that's not included in the project, like a secret file or environment variable.

Keeping your license key secret in .NET framework

First, install the Microsoft.Configuration.ConfigurationBuilders.UserSecrets NuGet package. The package will modify the app.config file by adding a configuration builder with a specified userSecretsId value.

Second, create appSettings in the app.config file that uses the previously added configuration builder and has an empty license key.

<configuration>

    <configSections>
        <section name="configBuilders"
                 type="System.Configuration.ConfigurationBuildersSection,
                       System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                 restartOnExternalChanges="false"
                 requirePermission="false" />
    </configSections>

    <configBuilders>
        <builders>
            <add name="Secrets"
                 userSecretsId="31c68e26-876c-43f5-8bb4-d87c9ec5f1ce"
                 type="Microsoft.Configuration.ConfigurationBuilders.UserSecretsConfigBuilder,
                       Microsoft.Configuration.ConfigurationBuilders.UserSecrets, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        </builders>
    </configBuilders>

    <appSettings configBuilders="Secrets">
        <add key="GemBoxLicenseKey" value="" />
    </appSettings>

</configuration>

Third, add a secret file that has your professional key in the following location: %APPDATA%\Microsoft\UserSecrets\<userSecretsId>\secrets.xml

<root>
  <secrets ver="1.0">
    <secret name="GemBoxLicenseKey" value="XXXXXXXXXX" />
  </secrets>
</root>

Last, set the license key in your application.

using System.Configuration;
using GemBox.Presentation;

class Program
{
    static Program()
    {
        var license = ConfigurationManager.AppSettings["GemBoxLicenseKey"];
        ComponentInfo.SetLicense(license);
    }

    static void Main()
    {
        var presentation = new PresentationDocument();
        presentation.Slides.AddNew(SlideLayoutType.Custom).Content
            .AddTextBox(ShapeGeometryType.Rectangle, 2, 2, 5, 4, LengthUnit.Centimeter)
            .AddParagraph()
            .AddRun("Sample");
        presentation.Save("Sample.pptx");
    }
}
Imports System.Configuration
Imports GemBox.Presentation

Module Program

    Sub New()
        Dim license = ConfigurationManager.AppSettings("GemBoxLicenseKey")
        ComponentInfo.SetLicense(license)
    End Sub

    Sub Main()
        Dim presentation As New PresentationDocument()
        presentation.Slides.AddNew(SlideLayoutType.Custom).Content
            .AddTextBox(ShapeGeometryType.Rectangle, 2, 2, 5, 4, LengthUnit.Centimeter)
            .AddParagraph()
            .AddRun("Sample")
        presentation.Save("Sample.pptx")
    End Sub

End Module

Keeping your license key secret in .NET Core

First, run the following commands in the terminal.

dotnet user-secrets init
dotnet user-secrets set GemBoxLicenseKey XXXXXXXXXX

As a result, the secret file that has your professional key will be generated on one of the following locations.

  • For Windows: %APPDATA%\Microsoft\UserSecrets\<UserSecretsId>\secrets.json
  • For Linux / macOS: ~/.microsoft/usersecrets/<UserSecretsId>/secrets.json
{
  "GemBoxLicenseKey": "XXXXXXXXXX"
}

Second, install the Microsoft.Extensions.Configuration.UserSecrets NuGet package.

Last, set the license key in your application.

using System.Linq;
using Microsoft.Extensions.Configuration;
using GemBox.Presentation;

class Program
{
    static Program()
    {
        var config = new ConfigurationBuilder().AddUserSecrets<Program>().Build();
        var provider = config.Providers.First();

        provider.TryGet("GemBoxLicenseKey", out string license);
        ComponentInfo.SetLicense(license);
    }

    static void Main()
    {
        var presentation = new PresentationDocument();
        presentation.Slides.AddNew(SlideLayoutType.Custom).Content
            .AddTextBox(ShapeGeometryType.Rectangle, 2, 2, 5, 4, LengthUnit.Centimeter)
            .AddParagraph()
            .AddRun("Sample");
        presentation.Save("Sample.pptx");
    }
}
Imports System.Linq
Imports Microsoft.Extensions.Configuration
Imports GemBox.Presentation

Module Program

    Sub New()
        Dim config = New ConfigurationBuilder().AddUserSecrets(Of Program)().Build()
        Dim provider = config.Providers.First()

        Dim license As String = Nothing
        provider.TryGet("GemBoxLicenseKey", license)
        ComponentInfo.SetLicense(license)
    End Sub

    Sub Main()
        Dim presentation As New PresentationDocument()
        presentation.Slides.AddNew(SlideLayoutType.Custom).Content
            .AddTextBox(ShapeGeometryType.Rectangle, 2, 2, 5, 4, LengthUnit.Centimeter)
            .AddParagraph()
            .AddRun("Sample")
        presentation.Save("Sample.pptx")
    End Sub

End Module

Another way to store your professional key is to use an external secrets management service, such as Azure Key Vault, AWS Key Management Service, or Google Cloud Key Management Service.

See also


Next steps

GemBox.Presentation is a .NET component that enables you to read, write, edit, convert, and print presentation files from your .NET applications using one simple API.

Download Buy