Class LicenseKey

java.lang.Object
com.itextpdf.licensing.base.LicenseKey

public final class LicenseKey extends Object
An entry point for license files management.
  • Method Details

    • initialize

      public static void initialize()
    • unloadLicenses

      public static void unloadLicenses()
      Unload all licenses for all products.
    • unloadLicenseForProduct

      public static void unloadLicenseForProduct (String productName)
      Unloads license for specific product.
      Parameters:
      productName - the name of the product for which license will be unloaded
    • loadLicenseFile

      public static void loadLicenseFile (File licenseFile) throws LicenseKeyException
      Loads a license file or array of licenses from a File. It is expected that file contains license as json object or json array of such licenses. The certificate is read from the jar.

      Note that method does not perform any additional checks and does not consider license files loading as a transaction. If any error occurs, on loading array of licenses method execution will be stopped but already loaded licenses will not be unloaded.

      Parameters:
      licenseFile - the file to load license
      Throws:
      LicenseKeyException - thrown if there's a problem with the license file
    • loadLicenseFile

      public static void loadLicenseFile (InputStream licenseIs) throws LicenseKeyException
      Loads a license file or array of licenses using an InputStream. It is expected that input stream contains license as json object or json array of such licenses. The certificate is read from the jar.

      Note that method does not perform any additional checks and does not consider license files loading as a transaction. If any error occurs, on loading array of licenses method execution will be stopped but already loaded licenses will not be unloaded.

      Parameters:
      licenseIs - the input stream for load license
      Throws:
      LicenseKeyException - thrown if there's a problem with the license file
    • getLoadedLicensesInfo

      public static List<LicenseInfo> getLoadedLicensesInfo()
      Gets info about loaded licenses.
      Returns:
      list with loaded license info, or empty list if there is no licenses
    • getLoadedLicenseInfo

      public static LicenseInfo getLoadedLicenseInfo (String productName, boolean checkingForUpdates)
      Gets info about loaded license for provided product name.
      Parameters:
      productName - the product name
      checkingForUpdates - flag that specifies if updates need to be checked
      Returns:
      the loaded license info which corresponds to the passed product name, or null if there is no license
    • getLoadedLicenseInfo

      public static LicenseInfo getLoadedLicenseInfo (String productName)
      Gets info about loaded license for provided product name, trying to update the license.
      Parameters:
      productName - the product name
      Returns:
      the loaded license info which corresponds to the passed product name, or null if there is no license