Sometimes, in order to study the system better, you want to dive into the code as fast as possible. To make this easier, GroupDocs.Editor provides different plans for purchase or offers a Free Trial and a 30-day Temporary License for evaluation.
Note
Note that there are a number of general policies and practices that guide you on how to evaluate, properly license, and purchase our products. You can find them in the “Purchase Policies and FAQ” section.
Free Trial or Temporary License
You can try GroupDocs.Editor without buying a license.
Free Trial
The evaluation version is the same as the purchased one – the evaluation version simply becomes licensed when you set the license. You can set the license in a number of ways that are described in the next sections of this article.
The evaluation version comes with limitations:
Only the first 2 pages are processed.
Trial badges are placed in the document at the top of each page.
Temporary License
If you wish to test GroupDocs.Editor 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.
How to set a license
The license file contains details such as the product name, the number of developers it is licensed to, the subscription expiry date, and so on. It contains a digital signature, so don’t modify the file. Even inadvertent addition of an extra line break into the file will invalidate it. You need to set a license before utilizing the GroupDocs.Editor API if you want to avoid its evaluation limitations.
The license can be loaded from a file or a stream object. The easiest way to set a license is to put the license file in your working directory and specify the file name, as shown in the examples below.
You can also let GroupDocs.Editor apply a license automatically by pointing the GROUPDOCS_LIC_PATH environment variable at your license file.
Setting License from File
The code below explains how to set the product license from a file.
importosfromgroupdocs.editorimportLicensedefset_license_from_file():# Path to the license filelicense_path=os.path.abspath("./GroupDocs.Editor.lic")# Set the license only if the file existsifos.path.exists(license_path):License().set_license(license_path)print("License set successfully.")else:print("License file not found. Running in evaluation mode.")if__name__=="__main__":set_license_from_file()
Setting License from Stream
The following example shows how to load a license from a stream (a binary file object).
importosfromgroupdocs.editorimportLicensedefset_license_from_stream():# Path to the license filelicense_path=os.path.abspath("./GroupDocs.Editor.lic")# Set the license from a stream only if the file existsifos.path.exists(license_path):withopen(license_path,"rb")aslicense_stream:License().set_license(license_stream)print("License set successfully.")else:print("License file not found. Running in evaluation mode.")if__name__=="__main__":set_license_from_stream()
Note
Calling License.set_license multiple times is not harmful but simply wastes processor time. Call License().set_license(...) once in your application’s startup code, before using any GroupDocs.Editor classes.
Setting Metered License
Note
You can also set a Metered license as an alternative to a license file. It is a licensing mechanism that is used alongside the existing licensing method. It is useful for customers who want to be billed based on the usage of the API features. For more details, please refer to the Metered Licensing FAQ section.
Here are the simple steps to use the Metered class.
Pass the public and private keys to the set_metered_key method.
Do processing (perform the task).
Call the get_consumption_quantity method of the Metered class.
It will return the amount/quantity of API requests that you have consumed so far.
Call the get_consumption_credit method of the Metered class.
It will return the credit that you have consumed so far.
The following sample code demonstrates how to use the Metered class.
fromgroupdocs.editorimportMetereddefset_metered_license():public_key=""# Your public license keyprivate_key=""# Your private license key# Set the metered key only if both keys are providedifpublic_keyandprivate_key:metered=Metered()metered.set_metered_key(public_key,private_key)# Get the amount (MB) consumedamount_consumed=Metered.get_consumption_quantity()print("Amount (MB) consumed:",amount_consumed)# Get the count of credits consumedcredits_consumed=Metered.get_consumption_credit()print("Credits consumed:",credits_consumed)else:print("Metered keys not set. Running in evaluation mode.")if__name__=="__main__":set_metered_license()
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.