Licensing | Aspose.Page for Java

Evaluation Version Limitations

We want our customers to test our components thoroughly before buying so the evaluation version allows you to use it as you would normally. However, the unlicensed product:

Classic license

The license can be loaded from a file or stream object. The easiest way to set a license is to put the license file in the same folder as the aspose-page-xx.x.jar file and specify the filename, without a path, as shown in the example below.

Apply License using File or Stream Object

The easiest way to apply a license is to put the license file in the same folder as the aspose-page-xx.x.jar file and specify just the file name without a path.

If you use are using any other Aspose for Java component along with Aspose.Page for Java, please specify a complete namespace for License like

Loading a License from File

The easiest way to apply a license is to put the license file in the same folder as the aspose-page-xx.x.jar file and specify just the filename without a path.

When you call the setLicense method, the license name that you pass should be that of your license file. For example, if you change the license file name to “Aspose.Page.Java.lic.xml” pass that filename to the…) method. The license file can be specified for Aspose.Page for Java or you can use Aspose.Total for Java license file.

1// For complete examples and data files, please go to
2// instantiate License object license = new;
4// license file path information

Loading a License from a Stream Object

The following example shows how to load a license from a stream.

1// For complete examples and data files, please go to
2// Initialize License Instance license = new;
4// Set license from Stream

Metered License

Aspose.Page allows developers to apply metered key. It is a new licensing mechanism. The new licensing mechanism will be used along with existing licensing method. Those customers who want to be billed based on the usage of the API features can use the metered licensing. For more details, please refer to Metered Licensing FAQ section.

A new class Metered has been introduced to apply metered key. Following is the sample code demonstrating how to set metered public and private keys.

 1// set metered public and private keys metered = new;
 3// Access the setMeteredKey property and pass public and private keys as parameters
 5    "<type public key here>",
 6    "<type private key here>");
 8// The path to the documents directory.
 9String dataDir = Utils.getDataDir();
10ImageFormat imageFormat = ImageFormat.PNG;
11// Initialize PostScript input stream
12FileInputStream psStream = new FileInputStream(dataDir + "");
14PsDocument document = new PsDocument(psStream);
16//check if document is licensed
17if (document.isLicensed())
18    System.out.println("Metered License is set successfully.");
20  System.out.println("Metered License is not set.");
22//Initialize options object with default parameters.
23ImageSaveOptions options = new ImageSaveOptions();
25//Initialize ImageDevice object with default parameters.
26com.aspose.eps.device.ImageDevice device = new com.aspose.eps.device.ImageDevice();
28//Save EPS file as image
29try {
30, options);
31} finally {
32    psStream.close();
35//Get images bytes. One bytes array for one page. In our case we have one page.
36byte[][] imagesBytes = device.getImagesBytes();
38//Save image bytes to file
39FileOutputStream fs = new FileOutputStream(dataDir + "eps_out." + imageFormat.toString().toLowerCase());
40try {
41    fs.write(imagesBytes[0], 0, imagesBytes[0].length);
42} catch (IOException ex) {
43    System.out.println(ex.getMessage());
44} finally {
45    fs.close();
48//Now we can check visually if Metered License is applied.
49//If resulting image doesn't contain red evaluation message It means Metered License is applied successfully.
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.