How to load the UniPDF license key?

Loading the UniPDF license code can be done in one of two ways.

1. Loading via code.

2. Loading via an environment variable.

In both cases, the customer name and license code need to be provided.

Loading the UniPDF license code in code

Make sure you are loading the correct version of the license package. License package can be loaded via  github.com/unidoc/unipdf/v3/common/license where V is for UniPDF version 1.x.xx, V2 is for UniPDF version 2.x.xx , and V3 is for UniPDF version 3.x.xx). The following play illustrates the license code loading.

Make sure the key is separated the same way as mentioned in the below example

Loading the UniPDF license via environment variables

Alternatively, the UniPDF license can be loaded via environment variables. This involves setting the following environment variables

  • UNIPDF_CUSTOMER_NAME  Needs to be set to the customer name.
  • UNIPDF_LICENSE_PATH Needs to point to a file location containing the license key.

If those environment variables are set, UniPDF will automatically load the license key.

For example on Linux:

export UNIPDF_CUSTOMER_NAME=UniDoc
export UNIPDF_LICENSE_PATH=/path/to/licenses/UniDoc.txt

On Windows:

set UNIPDF_CUSTOMER_NAME=UniDoc
set UNIPDF_LICENSE_PATH="C:\path\to\license.txt"

How to load the UniOffice license key?