Licensing - Aspose.HTML for .NET

Evaluate Aspose.HTML for .NET

You can easily download Aspose.HTML for .NET for evaluation purposes. Please note, that the evaluation version is the same as the purchased version. It becomes licensed when you add a few lines of code to apply the license.

The evaluation version (without a license specified) provides full product functionality, but it has some limitations:

If you want to test Aspose.HTML for .NET without the evaluation version limitations, you can also request a 30-day Temporary License. Please refer to How to get a Temporary License?

Applying a License

After purchase, you need to apply the license file or include the license file as an embedded resource. Aspose.HTML for .NET provides several ways to apply a license. This section describes options for how this can be done.

Note: Use the Fully Qualified License Class Name. If you use any other Aspose for .NET component along with Aspose.HTML for .NET, you need to specify the complete namespace for a License like Aspose.Html.License or Aspose.Html.Metered. Each Aspose product has a License class in its own namespace. For example, Aspose.HTML has Aspose.Html.License and Aspose.SVG has Aspose.Svg.License class. Using the fully qualified class name allows you to avoid confusion as to which license applies to which product.

Applying a License from Disk or Stream

The easiest way to apply a license is to put the license file in the same folder as the Aspose.HTML.dll file and specify just the file name without a path.

1   // Initialize a license object
2   Aspose.Html.License htmlLicense = new Aspose.Html.License();
4   // Apply the license using the file name
5   htmlLicense.SetLicense("Aspose.HTML.lic");

It is also possible to apply a license from the license file stream.

1   // Initialize a license object
2   Aspose.Html.License htmlLicense = new Aspose.Html.License();
4   // Open a license file stream
5   using (var stream = new System.IO.FileStream("Aspose.HTML.lic", System.IO.FileMode.Open))
6   {
7      // Apply the license using the stream
8      htmlLicense.SetLicense(stream);
9   }

Using Singleton

The best approach is to implement the license through lazy initialization using Singleton at key points in the code. The following shows how to do this by adding a few lines of code to the project.

 1   internal class LicenseSingleton
 2   {
 3      private static LicenseSingleton _instance = new LicenseSingleton();
 4      private LicenseSingleton()
 5      {
 6            // init the license
 7            (new Aspose.Html.License()).SetLicense(@"F:\\testdata\license\Aspose.HTML.NET.lic");
 8      }
10      public static void SetLicense()
11      {
12            LicenseSingleton local = _instance;
13      }
14   }
16   static void Main(string[] args)
17   {
18      //lazy initialization before using the library
19      LicenseSingleton.SetLicense();
20   }

Applying a License as an Embedded Resource

Another neat way of packaging the license with your application is to include it as an embedded resource into one of the assemblies that calls Aspose.HTML for .NET.

To include the license file as an embedded resource, perform the following steps:

  1. In Visual Studio, include the .lic file into your project by right clicking it and choosing Add -> Existing Item… from the opened menu.
  2. Select the file in the Solution Explorer and set Build Action to Embedded resource in the Properties window.
  3. In your code, invoke SetLicense passing only the short name of the resource file.
1   // Initialize a license object
2   Aspose.Html.License htmlLicense = new Aspose.Html.License();
4   // Apply the license using the embedded resource name
5   htmlLicense.SetLicense("Aspose.HTML.lic");

Please note, that resources are embedded in to assembly without modification. If you add a text file as an embedded resource in application and open the resultant EXE in notepad, you will see the exact contents of the added text file. So, when using a license file as an embedded resource, anyone can open EXE file in some simple text editor and see/extract the contents of the embedded license.

Applying a Metered License

Metered license - is a new licensing mechanism, which is used along with existing licensing method. Those customers who want to be billed based on the usage of the API features can use the metered licensing. Aspose.HTML allows developers to apply a metered key. For more details, please refer to the Using Your Metered License article.

After completing all the necessary steps to obtain this type of license, you will receive the keys, not the license file. This metered key can be applied using the Metered class specially introduced for this purpose. The following code snippet demonstrates how to apply the metered license using the private and public keys:

1   // Initialize a metered object
2   Aspose.Html.Metered metered = new Aspose.Html.Metered();
4   // Apply the metered license using the public and private keys
5   metered.SetMeteredKey("*****", "*****");

Normally it is enough to apply the metered license once on application start. However, if the metered licensing mechanism fails to communicate with the Aspose servers for 24 hours, Aspose.HTML will exit licensed mode and switch to evaluation mode. To avoid such a case, you should regularly check the license status. If Aspose.HTML turns into evaluation mode, please apply the metered license again.

Please note that in order to use the Metered license correctly, you must have a stable Internet connection, as the Metered mechanism requires constant interaction with our services for correct calculations. For more information, see the Metered Licensing FAQ section.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.