Licensing | Aspose.PUB for .NET

Evaluate Aspose.PUB

You can download Aspose.PUB for .NET free of cost for evaluation. The evaluation version provides almost all functionality of the product with certain limitations. The same evaluation version becomes licensed when you purchase a license and add a couple of lines of code to  apply the license.

If you want to test Aspose.PUB without evaluation version limitations, you can also request a 30 Day Temporary License. Please refer to  How to get a Temporary License?

Evaluation Version Limitations

The evaluation version of Aspose.PUB (without a license specified) provides full product functionality except that an evaluation version warning is displayed at the top of the converted document as shown in the following image.

Evaluation version warning

Applying for a License

You can easily download an evaluation version of Aspose.PUB from its  download page. The evaluation version provides absolutely the same capabilities as the licensed version of Aspose.PUB. Furthermore, the evaluation version simply becomes licensed when you purchase a license and add a couple of lines of code to apply the license.

About the License

The license is a plain-text XML file that contains details such as the product name, number of developers it is licensed to, subscription expiry date and so on. The file is digitally signed, so don’t modify the file. Even inadvertent addition of an extra line break into the file will invalidate it.

You need to set a license before utilizing Aspose.PUB if you want to avoid its evaluation limitations. It is only required to set a license once per application (or process).

Setting a License in Aspose.PUB for .NET

In Aspose.PUB, a license can be loaded from a file, stream or an embedded resource.Aspose.PUB tries to find the license in the following locations:

Apply License using File

The easiest way to set a license, is to put the license file in the same folder as that of the DLL of the component (included in Aspose.PUB) and specify just the file name without its path.

1// For complete examples and data files, please go to https://github.com/aspose-pub/Aspose.PUB-for-.NET
2// The path to the documents directory.
3string dataDir = RunExamples.GetDataDir_Data();
4
5string fileName = dataDir + "Aspose.PUB.Lic";
6
7License pubLicense = new License();
8
9pubLicense.SetLicense(fileName);

Apply LIcense from Stream Object

1// For complete examples and data files, please go to https://github.com/aspose-pub/Aspose.PUB-for-.NET
2// Initialize license object
3License pubLicense = new License();
4// Load license in FileStream
5FileStream myStream = new FileStream("Aspose.PUB.lic", FileMode.Open);
6// Set license
7pubLicense.SetLicense(myStream);

When you call SetLicense method, the license name should be the same as that of your license file name. For example, you may change the license file name to “Aspose.PUB.lic.xml”. Then in your code, you should use the modified license name (that is Aspose.Pub.lic.xml) for the SetLicense method.

Including the License File as an Embedded Resource

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 dll of the component (included in Aspose.PUB). To include the license file as an embedded resource, perform the following steps:

Please review the example given below to understand this method of setting license (embedded) in your applications.

1 // Instantiate the License class
2
3Aspose.PUB.License license = new Aspose.PUB.License();
4
5// Pass only the name of the license file embedded in the assembly
6
7license.SetLicense("Aspose.PUB.lic");

Apply Metered License

Aspose.PUB allows developers to apply metered key. 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.

A new class Metered has been introduced to apply metered key. Following is the sample code demonstrating how to set metered public and private keys.

 1	// set metered public and private keys
 2	Aspose.Pub.Metered metered = new Aspose.Pub.Metered();
 3	// Access the setMeteredKey property and pass public and private keys as parameters
 4	metered.SetMeteredKey(
 5        "<type public key here>",
 6        "<type private key here>");
 7	
 8	//convert Publisher document to pdf format
 9	var parser = Aspose.Pub.PubFactory.CreateParser("input.pub");
10	var doc = parser.Parse();
11	Aspose.Pub.PubFactory.CreatePdfConverter().ConvertToPdf(doc, "out.pdf");
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.