Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save aspose-com-gists/366cba3dc08d43c99c22bb33ecb5d555 to your computer and use it in GitHub Desktop.

Select an option

Save aspose-com-gists/366cba3dc08d43c99c22bb33ecb5d555 to your computer and use it in GitHub Desktop.
Installing and clearing the license for the Aspose.TeX for .NET library

Aspose.TeX for .NET – Licensing Examples

These snippets demonstrate how to apply and manage licenses for Aspose.TeX for .NET. Learn different ways to set up licensing: from file, from stream, metered licensing, and how to clear a license.

Key Use Cases

  • Apply license from file
  • Apply license from stream
  • Set up metered licensing (pay-as-you-go)
  • Clear previously installed license

How to Run Examples

  1. Reference Aspose.TeX for .NET: Aspose.TeX on Windows; Aspose.TeX.Drawing on non‑Windows.
  2. Copy a snippet into your project.
  3. Obtain a license file or metered keys from Aspose Purchase or get a temporary license.
  4. Build and run.

Restrictions

Without a valid license, Aspose.TeX for .NET operates in evaluation mode with limitations:

  • Maximum 1 page for document typesetting
  • Watermarks on output
  • Limited functionality

Apply a license to unlock full features.

Related Documentation

More about licensing:

Related Resources

Requirements

  • .NET 6.0+, .NET Core, or .NET Framework
  • Aspose.TeX for .NET library
  • Valid license file or metered keys (for production use)

Examples Overview

1. Set License from File

Load and apply a license from a .lic file stored on disk. This is the most common way to license Aspose.TeX.

Use Case: Standard licensing for desktop applications or server deployments where the license file is stored locally.

2. Set License from Stream

Load and apply a license from a Stream object. Useful when the license file is embedded as a resource or retrieved from a database or cloud storage.

Use Case: Applications where the license is not stored as a physical file, such as embedded resources or cloud-based storage.

3. Set Metered License

Configure metered (pay-as-you-go) licensing by providing public and private keys. With metered licensing, you're charged based on actual API usage.

Key Features:

  • Pay-per-Use: Only pay for what you actually process
  • No Upfront Costs: No need to purchase a full license upfront
  • Usage Tracking: Monitor your API consumption
  • Flexible Scaling: Automatically scales with your needs

Use Case: Applications with variable or unpredictable usage patterns, SaaS platforms, or when you want to minimize upfront licensing costs.

How to Get Metered Keys:

  1. Visit Aspose Purchase
  2. Select the "Metered License" option
  3. Obtain your public and private keys
  4. Use Metered.SetMeteredKey() to activate

4. Clear License

Remove a previously installed license to return to evaluation mode. Useful for testing or when switching between different licenses.

Use Case: Development/testing scenarios where you need to verify evaluation mode behavior, or when temporarily disabling licensing.

Aspose.TeX for .NET – Licensing Examples
// Clear previously installed license
// Learn more: https://docs.aspose.com/tex/net/licensing/
Aspose.TeX.License license = new License();
license.SetLicense(String.Empty);
// Apply a License from File
// Learn more: https://docs.aspose.com/tex/net/licensing/
Aspose.TeX.License license = new License();
license.SetLicense(licenseFilePath);
// Apply a License from Stream Object
// Learn more: https://docs.aspose.com/tex/net/licensing/
FileStream licenseStream = new FileStream(licenseFilePath, FileMode.Open);
Aspose.TeX.License license = new License();
license.SetLicense(licenseStream);
licenseStream.Close();
// Apply a Metered License
// Learn more: https://docs.aspose.com/tex/net/licensing/
// Set metered public and private keys.
new Aspose.TeX.Metered().SetMeteredKey(
"<type public key here>",
"<type private key here>");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment