Licensing

Aspose.HTML for .NET can be tested before purchase and then switched to licensed mode by applying a license in your C# application. The evaluation version is the same product package as the purchased version, but it has output and collection limitations until a valid license is applied.

If you want to test Aspose.HTML for .NET without evaluation version limitations, request a 30-day Temporary License. Apply the temporary license in code the same way as a purchased license file.

Evaluate Aspose.HTML for .NET

You can download Aspose.HTML for .NET for evaluation purposes and use the same APIs that are available in the licensed version. Without a license, the library provides full product functionality, but the generated output and some collections are limited.

The evaluation version has the following limitations:

Applying a License

After purchase, apply the license file before using Aspose.HTML APIs that create, save, render, or convert documents. You can load the license from disk, from a stream, from an embedded resource, or use a metered license.

Use the fully qualified license class name. If you use another Aspose for .NET component together with Aspose.HTML for .NET, specify the complete namespace for the license class, such as Aspose.Html.License or Aspose.Html.Metered. Each Aspose product has a License class in its own namespace. For example, Aspose.HTML uses Aspose.Html.License and Aspose.SVG uses Aspose.Svg.License. The fully qualified class name helps avoid applying a license to the wrong product namespace.

Apply a License from Disk

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

To apply a license file in C#:

  1. Add the .lic file to the application folder or another path available at runtime.
  2. Create an Aspose.Html.License instance.
  3. Call SetLicense() before using document processing or conversion APIs.
  4. Run the application and verify that output files no longer contain evaluation watermarks.
1// Initialize a license object
2Aspose.Html.License htmlLicense = new Aspose.Html.License();
3
4// Apply the license using the file name
5htmlLicense.SetLicense("Aspose.HTML.lic");

Apply a License from a Stream

Use a stream when the license file is stored outside the application folder, loaded from secured storage, or provided by deployment configuration.

1// Initialize a license object
2Aspose.Html.License htmlLicense = new Aspose.Html.License();
3
4// Open a license file stream
5using (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}

Apply a License with Lazy Initialization

A common application pattern is to apply the license once at startup or through lazy initialization before the first Aspose.HTML workflow runs. This keeps licensing code centralized and avoids repeating SetLicense() calls throughout the project.

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

Apply a License as an Embedded Resource

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

To include the license file as an embedded resource:

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

Resources are embedded into an assembly without modification. If you add a license file as an embedded resource, anyone who can inspect the resulting assembly may be able to see or extract the license contents. Use this approach only when it matches your deployment and security requirements.

Apply a Metered License

Metered licensing is a licensing mechanism used alongside the existing license file approach. Customers who want to be billed based on API feature usage can apply metered keys instead of a license file. For more details, see Using Your Metered License.

After completing the required steps to obtain this type of license, you receive public and private keys rather than a license file. Apply these keys with the Aspose.Html.Metered class.

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

Normally, it is enough to apply the metered license once on application start. However, if the metered licensing mechanism fails to communicate with Aspose servers for 24 hours, Aspose.HTML exits licensed mode and switches to evaluation mode. To avoid this case, regularly check the license status. If Aspose.HTML switches to evaluation mode, apply the metered license again.

To use a Metered license correctly, you must have a stable Internet connection because the Metered mechanism requires regular interaction with Aspose services for correct calculations. For more information, see the Metered Licensing FAQ.

Common Licensing Issues

IssueCauseFix
Output files still contain evaluation watermarksThe license was not applied before saving or converting documents, or the application cannot find the .lic file at runtime.Call SetLicense() before using Aspose.HTML APIs and verify that the license file is copied to the runtime folder or loaded from the correct path.
The wrong Aspose product remains in evaluation modeThe project uses several Aspose products and the license was applied through a License class from another namespace.Use the fully qualified class name, for example Aspose.Html.License, when applying the Aspose.HTML license.
License works locally but fails on a server or in DockerThe license file is not deployed with the application, the path differs, or the container image does not include the file.Include the license in deployment artifacts, mount it securely, or load it from a stream or secured configuration source.
Embedded license can be extracted from the assemblyEmbedded resources are stored in the assembly without encryption or modification.Use embedded resources only when this security tradeoff is acceptable. For stricter deployments, load the license from protected storage.
Metered license switches to evaluation modeThe application cannot communicate with Aspose services for 24 hours or longer.Keep a stable Internet connection for metered licensing and reapply the metered keys if the application enters evaluation mode.

FAQ

Is the evaluation package different from the purchased package?

No. The evaluation version and purchased version use the same Aspose.HTML for .NET package. The package becomes licensed after you apply a valid license in code.

When should I apply the license?

Apply the license at application startup or before the first Aspose.HTML operation that loads, saves, renders, or converts documents. This avoids evaluation watermarks and output limits.

Can I use a temporary license for testing?

Yes. A 30-day temporary license lets you test Aspose.HTML for .NET without evaluation limitations. Apply it with Aspose.Html.License.SetLicense() like a purchased license file.

Should I use a license file or a metered license?

Use a license file for standard commercial licensing. Use a metered license when your purchase model is based on API usage and the application can maintain regular Internet access to Aspose services.

Can I apply licenses for several Aspose products in the same application?

Yes. Apply each product license through its own namespace-specific license class, such as Aspose.Html.License for Aspose.HTML and Aspose.Svg.License for Aspose.SVG.

Next Steps