Licensing

Overview

Aspose.Slides can be used in evaluation mode or with a valid license. The evaluation version provides the same functionality as the licensed version, but it adds an evaluation watermark to every slide of each presentation it saves and truncates text that your code reads from presentations.

This article explains how licensing works in Aspose.Slides and how to apply a license before using the library. A license can be loaded from a file or a stream by using the License class. The article also shows how to validate whether a license has been applied correctly.

Evaluate Aspose.Slides

Evaluation Version Limitations

  • The evaluation version (without a license specified) provides full product functionality, but it adds an evaluation watermark text box to every slide of each presentation it saves.
  • Text that your code reads from a presentation is truncated to its first few characters, followed by a notice about the evaluation limitation. Text that your code writes is saved in full.

Licensing in Aspose.Slides

  • An evaluation version becomes licensed after you purchase a license and apply it by adding a couple of lines of code.
  • The license is a plain-text XML file that contains details such as the product name, the number of developers it is licensed to, the subscription expiry date, and more.
  • The license file is digitally signed, so it must not be modified. Even an accidental change—such as adding a line break—will invalidate the file.
  • When you pass a file name without a folder, Aspose.Slides for C++ looks for the license file in the current working directory only. It does not search the folder of your executable or of the Aspose.Slides library, so pass the full path when the license file is stored elsewhere.
  • To avoid the limitations of the evaluation version, you must set the license before using Aspose.Slides. A license only needs to be set once per application or process.

Apply a License

A license can be loaded from a file or a stream.

File

The easiest way to set a license is to place the license file in the working directory of your program and specify only the file name, without the path. Otherwise, specify the full path to the file.

The following C++ code applies the license file Aspose.Slides.lic from the working directory of the program:

#include <Util/License.h>
#include <system/smart_ptr.h>
#include <system/string.h>

using namespace Aspose::Slides;
using namespace System;

int main()
{
    auto license = MakeObject<License>();
    license->SetLicense(u"Aspose.Slides.lic");

    return 0;
}

If the license is valid, License::SetLicense returns and the program ends without output; from then on, Aspose.Slides works without the evaluation limitations. If the file is not in the working directory, the method throws a FileNotFoundException with the message License “Aspose.Slides.lic” doesn’t exist or access is restricted. The example does not handle the exception, so the program stops.

Stream

Load a license from a stream when your program does not keep the license as a file that it can name, for example, when it reads the license from a database. License::SetLicense accepts any Stream that contains the license. To keep the example short, the following C++ code opens Aspose.Slides.lic in the working directory with File::OpenRead and applies the license from that stream:

#include <Util/License.h>
#include <system/io/file.h>
#include <system/smart_ptr.h>

using namespace Aspose::Slides;
using namespace System;
using namespace System::IO;

int main()
{
    auto license = MakeObject<License>();
    auto stream = File::OpenRead(u"Aspose.Slides.lic");
    license->SetLicense(stream);

    return 0;
}

A valid license gives the same result as in the file example. If the file does not exist, File::OpenRead throws a FileNotFoundException before the license is applied, and the program stops.

Validate a License

To check whether a license has been set properly, call License::IsLicensed. It returns true only after a valid license has been applied, and false before that. The following C++ code applies the license file from the working directory and then checks it:

#include <Util/License.h>
#include <system/console.h>
#include <system/smart_ptr.h>

using namespace Aspose::Slides;
using namespace System;

int main()
{
    auto license = MakeObject<License>();
    license->SetLicense(u"Aspose.Slides.lic");

    if (license->IsLicensed())
    {
        Console::WriteLine(u"License is good!");
    }

    return 0;
}

With a valid license, the program prints License is good!. If the file is missing or is not a license file, License::SetLicense throws an exception before the check, and the program stops without printing anything. If the file is a license whose signature does not match, for example because it was edited, SetLicense returns without an error but IsLicensed returns false, so nothing is printed and Aspose.Slides stays in evaluation mode.

Thread Safety

FAQ

Can I apply the license in a completely offline environment (no internet access)?

Yes. License validation is performed locally using the license file; no internet connection is required.

What happens after the one-year subscription expires? Will the library stop working?

No. The license is perpetual: you can continue using versions released before your subscription end date; you just won’t be eligible to use newer releases without renewing.