Licensing and Subscription
Sometimes, in order to study the system better, you want to dive into the code as fast as possible. To make this easier, Aspose.Words provides different plans for purchase or offers a Free Trial and a 30-day Temporary License for evaluation.
Free Trial or Temporary License
Aspose.Words is incredible software that developers can try before purchasing. You can easily download/install Aspose.Words for Java and Aspose.Words for Android via Java from Maven for evaluation.
The evaluation version is the same as the purchased one – the Trial version simply becomes licensed when you add a few lines of code to apply the license.
The Trial version of Aspose.Words for Java and Aspose.Words for Android via Java without the specified license provides full product functionality, but inserts an evaluative watermark at the top of the document upon loading and saving and limits the maximum document size to several hundred paragraphs.
If you wish to test Aspose.Words for Java and Aspose.Words for Android via Java without the limitations of the Trial version, you can also request a 30-day Temporary License. For more details, see the “Get a Temporary License” page.
After purchase, you need to apply the license file or include the license file as an embedded resource. This section describes options of how this can be done, and also comments on some common questions.
A license is a plain text XML file that contains details such as product name, number of developers licensed, subscription expiry date, and so on.
The file is digitally signed, so do not modify the file. Even inadvertent addition of an extra line break into the file will invalidate it.
You need to set the license:
- only once per application domain
- before using any other Aspose.Words classes
License Applying Options
Licenses can be applied from various locations:
- Explicit path
- The folder containing the Aspose.Words JAR file
- An embedded resource in the JAR is called Aspose.Words JAR
- As a Metered License – a new licensing mechanism
Often the easiest way to set a license is to place the license file in the same folder as Aspose.Words JAR and specify just the filename without the path.
Use the SetLicense method to license a component.
Calling SetLicense multiple times is not harmful, it just wastes processor time.
Apply License Using a File or Stream Object
When developing a class library, you can call SetLicense from the static constructor of your class that uses Aspose.Words. The static constructor will be executed prior to instantiating your class to ensure that the Aspose.Words license is installed correctly.
Load a License from a File
Using the SetLicense method, you can try to find the license file in the embedded resources or folder that contain the JARs of your application for further use.
The following code example shows how to initialize a license from a folder:
com.aspose.words.License license = new com.aspose.words.License(); license.setLicense("Aspose.Words.Java.lic");
Load a License from a Stream Object
The following code example demonstrates how to initialize a license from a stream using another SetLicense method:
com.aspose.words.License license = new com.aspose.words.License(); license.setLicense(new java.io.FileInputStream("Aspose.Words.Java.lic"));
Include the License File as an Embedded Resource
A neat way to package a license with your application and make sure it will not be lost is to include it as an embedded resource. You can simply copy the LIC file to your project’s resource folder.
Rebuilding the project should embed the .lic file into application .jar file. After that, you can apply for a license using the following code:
License lic = new License(); lic.setLicense(Program.class.getResourceAsStream("Aspose.Words.Java.lic"));
Apply Metered License
Aspose.Words enables developers to apply a metered key. This is a new licensing mechanism.
The new licensing mechanism will be used along with the existing licensing method. Those customers who want to be billed based on the use of API features can use the Metered Licensing.
After completing all the necessary steps to obtain this type of license, you will receive the keys, not the license file. This metered key can be applied using the Metered class specially introduced for this purpose.
The following code example shows how to set metered public and private keys:
Please note that you must have a stable Internet connection for the correct use of the Metered license, since the Metered mechanism requires the constant interaction with our services for correct calculations.
For more details, refer to the “Metered Licensing FAQ” section.
Changing the License File Name
The license filename does not have to be “Aspose.Words.LIC”. You can rename it to your liking and use that name when setting a license in your application.
“Cannot find license filename” Exception
When you purchase and download a license, the Aspose website names the license file “Aspose.Words.LIC”. You download the license file using your browser. In this case, some browsers recognize the license file as XML and append the .xml extension to it, so the full file name on your computer becomes “Aspose.Words.lic.XML”.
When Microsoft Windows is configured to hide extensions for known file types (unfortunately, this is the default in most Windows installations), the license file will appear as “Aspose.Words. LIC” in Windows Explorer. You will probably think that this is the real file name and call SetLicense passing it “Aspose.Words.LIC”, but there is no such file, hence the exception.
To solve the problem, rename the file to remove the invisible .xml extension. We also recommend you disable the “hide extensions” option in Microsoft Windows.
Using Multiple Aspose Products
If you use numerous Aspose products in your application, such as Aspose.Words and Aspose.Cells, here are many useful tips:
- Set the License for each Aspose product separately. Even if you have a single license file for all components, for example, “Aspose.Total.lic”, you still need to call SetLicense separately for each Aspose product that you use in your application.
- Use the Fully Qualified License Class Name. Each Aspose product has a License class in its own namespace. For example, Aspose.Words has com.aspose.words.License and Aspose.Cells has com.aspose.cells.License class. Using the fully qualified class name allows you to avoid confusion as to which license applies to which product.