Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save aspose-com-gists/af5a8f9e9b2b46571919659cdec09c55 to your computer and use it in GitHub Desktop.

Select an option

Save aspose-com-gists/af5a8f9e9b2b46571919659cdec09c55 to your computer and use it in GitHub Desktop.
Installing and clearing the license for the Aspose.Page for Java library

Licensing Examples

These code snippets show how to set up and use licenses with Aspose.Page for Java. Proper licensing is required to unlock full functionality and remove evaluation restrictions.

Key Use Cases

  • Apply a paid or temporary license in your project.
  • Check license status programmatically.

How to Run Examples

  1. Reference Aspose.Page for Java in your project.
  2. Copy the relevant code snippet into your project.
  3. Download a temporary license and set it up as described here or use a paid license.
  4. Run the example.

Restrictions

Without a valid license, the library operates in evaluation mode with limited features and watermarks.

Related Documentation

See Licensing in the official documentation for more details.

Related Resources

Requirements

  • Java 8 or higher
  • Aspose.Page for Java library
Aspose.Page for Java – Licensing Examples
// Clear previously installed license
// Learn more: https://docs.aspose.com/page/java/licensing/
com.aspose.page.License license = new com.aspose.page.License();
license.setLicense("");
// Apply a License that is embedded in assembly as a resource
// Learn more: https://docs.aspose.com/page/java/licensing/
// Initialize license object
com.aspose.page.License license = new com.aspose.page.License();
// Set license
license.setLicense("Aspose.Page.Java.lic");
// Set the value to indicate that license will be embedded in the application
license.setEmbedded(true);
// Apply a License from File
// Learn more: https://docs.aspose.com/page/java/licensing/
String licenseFilePath = getLicenseFullPath();
com.aspose.page.License license = new com.aspose.page.License();
license.setLicense(licenseFilePath);
// Apply a License from Stream Object
// Learn more: https://docs.aspose.com/page/java/licensing/
String licenseFilePath = getLicenseFullPath();
try (FileInputStream licenseStream = new FileInputStream(licenseFilePath)) {
com.aspose.page.License license = new com.aspose.page.License();
license.setLicense(licenseStream);
// Apply a License from Stream Object
// Learn more: https://docs.aspose.com/page/java/licensing/
// set metered public and private keys
com.aspose.page.Metered metered = new com.aspose.page.Metered();
// Access the setMeteredKey property and pass public and private keys as parameters
metered.setMeteredKey(
"<type public key here>",
"<type private key here>");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment