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, stream, or embedded resource 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 add a couple of lines of code to it (to apply the license).
  • The license is a plain-text XML file that contains details such as the product name, number of developers it is licensed to, subscription expiry date, and so on.
  • The license file is digitally signed, so you must not modify the file. Even an inadvertent addition of an extra line break to the contents of the file will invalidate it.
  • Aspose.Slides for Android via Java typically tries to find the license in these locations:
    • An explicit path
    • The folder containing Aspose.Slides.jar
  • To avoid the limitations associated with the evaluation version, you need to set a license before using Aspose.Slides. You only have to set a license once per application or process.

Applying a License

A license can be loaded from a file or stream.

File

The easiest method of setting a license requires you to place the license file in the folder containing Aspose.Slides.jar or your application’s jar.

This Java code shows you how to set a license file:

// Instantiates the License class
com.aspose.slides.License license = new com.aspose.slides.License();

// Sets the license file path
license.setLicense("Aspose.Slides.Android.via.Java.lic");

Stream

You can load a license from a stream. This Java code shows you how to apply a license from a stream:

// Instantiates the License class
com.aspose.slides.License license = new com.aspose.slides.License();

// Sets the license through a stream
license.setLicense(new java.io.FileInputStream("Aspose.Slides.Android.via.Java.lic"));

Stream from App Assets

In an Android app, put the license file in the assets folder of the app module, app/src/main/assets, so that it is packaged into the APK. Open the file with the getAssets method and pass the stream to the setLicense method. The code runs inside an Activity, for example in its onCreate method, before the app uses Aspose.Slides:

import android.util.Log;
import com.aspose.slides.License;
import java.io.IOException;
import java.io.InputStream;

License license = new License();
try (InputStream licenseStream = getAssets().open("Aspose.Slides.Android.via.Java.lic")) {
    license.setLicense(licenseStream);
} catch (IOException exception) {
    Log.e("Licensing", "Cannot read the license file from the app's assets.", exception);
}

The file name passed to the open method is relative to the assets folder. If the file is not there, the code logs the error, and Aspose.Slides stays in evaluation mode. To check whether the license was applied, see Validating a License.

Validating a License

To check whether a license has been set properly, you can validate it. This Java code shows you how to validate a license:

import com.aspose.slides.*;

License license = new License();
license.setLicense("Aspose.Slides.Android.via.Java.lic");

if (license.isLicensed()) 
{
    System.out.println("License is good!");
}

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.