set_license method

set_license

Sets the GroupDocs.Redaction license from a file path.

The method can also accept an open binary stream containing the license data.

def set_license(self, license_path):
    ...
Parameter Type Description
license_path str License file path.

Example

import os
from groupdocs.redaction import License

def set_license_from_file():
    # Resolve the license path from the environment, with a local fallback
    license_path = os.environ.get("GROUPDOCS_LIC_PATH", "./GroupDocs.Redaction.lic")

    # Apply the license before using any redaction features
    if os.path.exists(license_path):
        License().set_license(license_path)
        print("License set successfully.")
    else:
        print("License file not found. Running in evaluation mode.")

set_license

Sets the GroupDocs.Redaction license from a stream.

def set_license(self, license_stream):
    ...
Parameter Type Description
license_stream io.RawIOBase License stream.

Example

import os
from groupdocs.redaction import License

license_path = os.environ.get("GROUPDOCS_LIC_PATH", "./GroupDocs.Redaction.lic")
if os.path.exists(license_path):
    with open(license_path, "rb") as stream:
        License().set_license(stream)
    print("License set successfully.")
else:
    print("License file not found. Running in evaluation mode.")

Aliases

These names call set_license too, limited to the overloads listed.

Alias Accepts
set_license_file set_license_file(license_path)
set_license_string set_license_string(license_path)
set_license_stream set_license_stream(license_stream)
set_license_streams set_license_streams(license_stream)

See Also