Licensing – Aspose.SVG for .NET
Evaluation Version Limitations
A free evaluation version of Aspose.SVG for .NET can be downloaded from the downloads section of Aspose’s website at: Download Aspose.SVG API.
Limitation
The evaluation version provides all the features except the following:
- Watermark is added to the output files.
- Only the first four pages of the SVG document can be converted.
- Only 50% of SVG Document’s nodes will be saved during serialization.
If you want to try Aspose.SVG without evaluation limitations, request a 30 day temporary license. Please refer to How to get a Temporary License? For more information.
Apply License using File or Stream Object
The license can be loaded from a file or stream object. Aspose.SVG for .NET will try to find the license in the following locations:
- Explicit path.
- The folder that contains Aspose.SVG.dll.
- The folder that contains the assembly that called Aspose.SVG.dll.
- The folder that contains the entry assembly (your .exe).
- An embedded resource in the assembly that called Aspose.SVG.dll.
If you are using any other Aspose for .NET API along with Aspose.SVG for .NET, please specify the namespace for the license like Aspose.ThreeD.License.
Loading a License from File
The easiest way to apply a license is to put the license file in the same folder as the Aspose.SVG.dll file and specify just the file name without a path.
When you call the SetLicense method, the license name that you pass should be that of the license file. For example, if you change the license file name to “Aspose.SVG.lic.xml” pass that filename to threeD.SetLicense(…) method.
Example:
1// The path to the documents directory.
2string dataDir = RunExamples.GetDataDir_Data();
3
4string fileName = dataDir + "Aspose.SVG.lic.Lic";
5
6License svgLicense = new License();
7
8svgLicense.SetLicense(fileName);
Loading a License from a Stream Object
The following example shows how to load a license from a stream.
1string dataDir = RunExamples.GetDataDir_Data();
2// Initialize license object
3License svgLicense = new License();
4// Load license in FileStream
5FileStream myStream = new FileStream("Aspose.SVG.lic", FileMode.Open);
6// Set license
7svgLicense.SetLicense(myStream);
Apply License using Embedded Resource
One way of applying a license is to set it using a file or stream object. Another neat way of packaging the license with your application and making sure it will not be lost is to include it as an embedded resource into one of the assemblies that calls the component’s DLL (included in Aspose.SVG).
To include the license file as an embedded resource:
- In Visual Studio .NET, include the license (.lic) file into the project by selecting File, then Add Existing Item and finally Add.
- Select the file in the Solution Explorer.
- Set the Build Action to Embedded Resource in the Properties window.
- To access the license embedded in the assembly (as an embedded resource), just add the license file as an embedded resource to the project and pass the name of the license file to the SetLicense method. The License class automatically finds the license file in the embedded resources. There’s no need to call the GetExecutingAssembly and GetManifestResourceStream methods of the System.Reflection.Assembly class in the Microsoft .NET Framework.
The following code snippet is used to set the license.
1
2License svgLicense = new License();
3
4// Pass the name of the embedded license file
5svgLicense.SetLicense("Aspose.SVG.lic");
Apply Metered License
Aspose.SVG for .NET API allows developers to apply the metered license. It is a new licensing mechanism. The new licensing mechanism will be used along with the existing licensing method. Those customers who want to be billed based on the usage of the API features can use the metered licensing. For more details, please refer to Metered Licensing FAQ section.
After completing all the necessary steps to obtain this type of license, you will receive the keys, not the license file. A new class Metered has been added to apply the metered key. This code example demonstrates how to set metered public and private keys:
1 // Create an instance of CAD Metered class
2 Metered metered = new Metered();
3
4 // Access the setMeteredKey property and pass public and private keys as parameters
5 metered.SetMeteredKey("*****", "*****");
6
7 // Get metered data amount before calling API
8 decimal amountbefore = Metered.GetConsumptionQuantity();
9
10 // Display information
11 Console.WriteLine("Amount Consumed Before: " + amountbefore.ToString());
12 // Get metered data amount After calling API
13 decimal amountafter = Metered.GetConsumptionQuantity();
14
15 // Display information
16 Console.WriteLine("Amount Consumed After: " + amountafter.ToString());