License class

License class

Provides methods to license the component.

The License type exposes the following members:

Constructors

Constructor Description
init Initializes a new License instance.

Methods

Method Description
set_license Licenses the component.
set_license Licenses the component.

Properties

Property Description
is_licensed The property indicates whether a valid license has been applied; returns True if a license is applied, otherwise False.

Example

from groupdocs.assembly import License
import os

# Apply license from a file path
License().set_license("GroupDocs.Assembly.lic")

# Apply license from a binary stream (e.g., when bundled as a resource)
license_path = os.environ.get("GROUPDOCS_LIC_PATH", "GroupDocs.Assembly.lic")
if os.path.exists(license_path):
    with open(license_path, "rb") as stream:
        License().set_license(stream)
    print("License applied successfully.")
else:
    print("License file not found. Running in evaluation mode.")

See Also