Skip to content

unidoc/unioffice-examples

Repository files navigation

Examples

This example repository demonstrates many use cases for UniDoc's UniOffice Go library. Example code should make it easy for users to get started with UniOffice and address specific use cases. Feel free to add to this by submitting a pull request.

Structure

The folder hierarchy is as follows:

  • document/ folder contains examples for creating and processing Word DOCX document files.
  • spreadsheet/ folder contains examples for creating and processing Excel XLSX spreadsheet files.
  • presentation/ folder contains examples for creating and processing Powerpoint PPTX presentation files.
  • license/ folder contains examples for using metered api key license and offline license files.

License codes

UniOffice requires license codes to operate, there are two options:

Most of the examples demonstrate loading the Metered License API keys through an environment variable UNIDOC_LICENSE_API_KEY.

Examples for Offline Perpetual License Key loading can be found in the license subdirectory.

UniOffice License Loading.

The examples here illustrate how to work with UniOffice license codes and keys. There are two types of licenses.

Offline License

Offline licenses are cryptography based and contain full signed information that is verified based on signatures without making any outbound connections, hence the name "offline". This kind of license is suitable for users deploying OEM products to their customers or where there are strict restrictions on outbound connections due to firewalls and/or compliance requirements.

Metered License (API keys)

The metered license is the most convenient way to get started with UniDoc products and the Free tier enables a powerful way to get started for free. Anyone can get a free metered API key by signing up on http://cloud.unidoc.io/

Examples

  • license/metered/main.go Demonstrates how to load the Metered API license key and how to print out relevant information.
  • license/metered-non-persistent-cache/main.go Demonstrates how to load the Metered API license key for instances that not having persistent storage for usages cache and print out relevant information. When working with short-lived containers like docker or kubernetes instances usually it's doesn't have persistent storage location and will be destroyed after being idle.
  • license/offline/main.go Demonstrates how to print out information about the license after loading an offline license key.

Build all examples

Simply run the build script which builds all the binaries to subfolder bin/

$ ./build_examples.sh