Licensing Aspose.SVG for .NET

You can install and try Aspose.SVG for .NET before applying a license. For applications that must produce unrestricted SVG, PDF, XPS, or image output, apply a license before processing documents.

Evaluation Version Limitations

The evaluation version is available from the Aspose.SVG for .NET downloads page. Without a license, the current product limitations are:

To test Aspose.SVG without evaluation limitations, request a 30-day temporary license.

Choose a Licensing Method

ScenarioMethod
Store a license alongside application deployment filesLoad a license file with License.SetLicense(string)
Read a license from application storage or configuration infrastructureLoad a stream with License.SetLicense(Stream)
Ship the license inside an application assemblySet the license file as an embedded resource and load it by name
Use consumption-based licensingApply public and private keys with Metered.SetMeteredKey()

Apply the license once during application startup, before creating, loading, converting, or saving SVG documents.

Apply a License from a File

The Aspose.Svg.License class accepts a full path or a short file name. When a short name is provided, SetLicense() searches for the license in the following locations:

  1. The explicit path, if one is provided.
  2. The folder that contains the Aspose.SVG assembly.
  3. The folder that contains the calling assembly.
  4. The folder that contains the entry or startup assembly.
  5. Embedded resources in the calling assembly.

The following example loads an Aspose.SVG.lic file available to the application:

1using Aspose.Svg;
2
3// Create an Aspose.SVG license object.
4License license = new License();
5
6// Apply a license stored as an application file.
7license.SetLicense("Aspose.SVG.lic");

If your solution uses more than one Aspose product, instantiate the license class for the product being licensed. For Aspose.SVG, use Aspose.Svg.License.

Apply a License from a Stream

Use the stream overload when your application obtains the license from a protected file location, embedded configuration, or another storage provider.

 1using System.IO;
 2using Aspose.Svg;
 3
 4// Initialize an Aspose.SVG license object.
 5License license = new License();
 6
 7// Open a stream that contains the license data.
 8using (FileStream stream = new FileStream("Aspose.SVG.lic", FileMode.Open))
 9{
10    // Apply the license from the stream.
11    license.SetLicense(stream);
12}

Apply a License from an Embedded Resource

Embedding a license can be convenient when the application is distributed as a single deployment unit.

  1. Add the .lic file to your project.
  2. In Visual Studio, select the license file and set Build Action to Embedded Resource.
  3. Pass the embedded resource name to SetLicense().
1using Aspose.Svg;
2
3// Create an Aspose.SVG license object.
4License license = new License();
5
6// Resolve and apply the license from the embedded resource name.
7license.SetLicense("Aspose.SVG.lic");

The License class looks for an embedded resource in the calling assembly when resolving the supplied license name.

Apply a Metered License

Metered licensing uses public and private keys instead of a .lic file. It is intended for usage-based licensing scenarios; see the Metered Licensing FAQ for purchasing and billing information.

Use the Aspose.Svg.Metered class to set your metered keys during application startup:

1using Aspose.Svg;
2
3// Create a metered license object.
4Metered metered = new Metered();
5
6// Apply the purchased public and private metered keys.
7metered.SetMeteredKey("public-key", "private-key");

The metered API also provides methods to check licensing state and consumption:

1// Check whether metered licensing is currently active.
2bool isLicensed = Metered.IsMeteredLicensed();
3
4// Read the current consumption quantity and credit.
5decimal consumedQuantity = Metered.GetConsumptionQuantity();
6decimal consumedCredit = Metered.GetConsumptionCredit();

A metered application must be able to report consumption data. The Metered API reference explains behavior when consumption data cannot be uploaded.

Next Steps