Licensing Aspose.HTML for Java

Aspose.HTML for Java can be evaluated without a license and switched to licensed mode by applying a valid license in your Java application. The evaluation and licensed modes use the same library package, but evaluation output is limited and contains watermarks.

To test Aspose.HTML for Java without evaluation limitations, request a 30-day Temporary License. Apply it with the same License.setLicense() method used for a purchased license file.

Evaluate Aspose.HTML for Java

You can install and use Aspose.HTML for Java without supplying a license. This is useful for initial API testing, but the resulting documents are subject to evaluation restrictions.

The evaluation version has the following limitations:

Apply a valid purchased or temporary license before generating output that you need to evaluate without these restrictions. For purchasing and licensing terms, see Purchase Policies and FAQ.

Apply a License

Apply the license once during application startup and before the first Aspose.HTML operation that saves, renders, or converts a document. The License class accepts a license file name, file path, or input stream through its setLicense() overloads.

If an application uses multiple Aspose products, use the fully qualified class name com.aspose.html.License. Each product exposes its own License class, and the package name makes it clear that the license is being applied to Aspose.HTML.

Apply a License from a File

To apply a license from disk:

  1. Place the .lic file in a location available to the application at runtime.
  2. Create a com.aspose.html.License object.
  3. Pass the license file name or path to setLicense().
  4. Apply the license before processing documents.

If the license file is stored in the same runtime folder as the component JAR, you can pass only its file name. Otherwise, provide a path that the application can resolve. An Aspose.HTML for Java license file or an applicable Aspose.Total for Java license can be loaded through this class.

1// Set Aspose.HTML for Java license using file path string
2
3// instantiate License object
4com.aspose.html.License license = new com.aspose.html.License();
5// license file path information
6license.setLicense("Aspose.HTML.lic");

Apply a License from a Stream

Use the stream overload when the license is obtained from application resources, protected storage, or another stream-based source. The following example creates a FileInputStream and passes it to setLicense(). In application code, close the stream after the method returns.

1// Set Aspose.HTML for Java license from stream
2
3// Initialize License Instance
4com.aspose.html.License license = new com.aspose.html.License();
5// Set license from Stream
6license.setLicense(new java.io.FileInputStream("Aspose.HTML.lic"));

Apply a Metered License

A metered license uses a public and private key pair instead of a license file and reports API usage for usage-based billing. For licensing terms and activation guidance, see Using Your Metered License.

To apply metered licensing:

  1. Obtain the public and private metered keys from Aspose.
  2. Create a Metered object.
  3. Pass the keys to setMeteredKey() once during application startup.
  4. Keep the private key out of source control and client-visible configuration.
1// Set Aspose.HTML for Java metered license using public and private keys with Metered class
2
3// Initialize a metered object
4com.aspose.html.Metered metered = new com.aspose.html.Metered();
5
6// Apply the metered license using the public and private keys
7metered.setMeteredKey("PublicKey", "PrivateKey");

Normally, call setMeteredKey() once at application startup. Metered licensing records usage locally and reports it to Aspose services at regular intervals, so the application requires periodic network access to the licensing servers. Firewall rules must allow this communication.

Connectivity retry behavior and grace periods are defined by the current Metered Licensing FAQ. Review that policy when planning production deployment instead of relying on a fixed interval in application documentation.

Common Licensing Issues

IssueLikely causeWhat to check
Output still contains evaluation watermarksThe license was applied after document processing began, or the file was not found.Call setLicense() at startup and verify the runtime path to the .lic file.
Aspose.HTML remains in evaluation mode in a multi-product applicationA License class from another Aspose package was used.Instantiate com.aspose.html.License explicitly.
Licensing works locally but fails on a server or in a containerThe license file is missing from the deployment or the runtime path differs.Deploy or securely mount the license file, or load it from a stream.
Metered licensing cannot report usageNetwork or firewall rules block access to Aspose licensing services.Allow the required periodic communication and review the Metered Licensing FAQ.

Next Steps