许可| aspose.pub for .net

评估aspose.pub

您可以免费下载.net的aspose.pub进行评估。评估版本几乎提供了具有一定限制的产品的所有功能。当您购买许可证并在 应用许可证中添加几行代码时,相同的评估版本将获得许可。

如果您想在没有评估版本限制的情况下测试Aspose.pub,也可以请求30天的临时许可。请参阅 如何获得临时许可?

评估版本限制

Aspose.pub的评估版(未指定许可证)提供完整的产品功能,但评估版本警告显示在转换文档的顶部,如下图所示。

评估版本警告

申请许可证

您可以从 下载页轻松地下载Aspose.pub的评估版本。评估版本提供了与Aspose.pub的许可版本相同的功能。此外,当您购买许可证并添加几行代码以应用许可证时,评估版本才会获得许可。

关于许可证

许可证是一个普通文本XML文件,其中包含详细信息,例如产品名称,已许可的开发人员数量,订阅到期日期等。该文件是数字签名的,因此请勿修改文件。即使无意间添加了额外的线路断裂,该文件也会使其无效。

如果要避免其评估限制,则需要在使用Aspose.pub之前设置许可证。每个应用程序(或流程)只需要设置一次许可证。

在aspose.pub中为.net设置许可证

在Aspose.pub中,可以从文件,流或嵌入式资源中加载许可证。

使用文件申请许可证

设置许可证的最简单方法是将许可证文件放在与组件的DLL(aspose.pub中包含)的同一文件夹中,并仅指定没有路径的文件名。

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);

从流对象应用许可证

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);

当您调用setlicense方法时,许可名称应与您的许可证文件名的名称相同。例如,您可以将许可证文件名更改为“ aspose.pub.lic.xml”。然后,在代码中,您应该为setlicense方法使用修改后的许可名称(即aspose.pub.lic.xml)。

将许可证文件作为嵌入式资源

将许可证与您的应用程序包装并确保不会丢失的另一种整洁的方式是将其作为嵌入式资源包括在调用组件DLL的一个组件中(包括在Aspose.pub中)。要将许可证文件作为嵌入式资源,请执行以下步骤:

请查看下面给出的示例,以了解您的应用程序中设置许可证(嵌入式)的方法。

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

应用计量许可证

Aspose.pub允许开发人员应用计量密钥。这是一种新的许可机制。新的许可机制将与现有的许可方法一起使用。那些希望根据API功能使用的客户可以使用计量许可的客户。有关更多详细信息,请参阅 计量许可常见问题解答部分。

已经引入了一个新的计量级计量来应用计量密钥。以下是示例代码,演示了如何设置计量的公共和私钥。

 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");
 1// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-.NET
 2Aspose.Email.Metered metered = new Aspose.Email.Metered();
 3// Access the SetMeteredKey property and pass public and private keys as parameters
 4metered.SetMeteredKey("*****", "*****");
 5
 6// The path to the documents directory. 
 7string dataDir = RunExamples.GetDataDir_Email();
 8
 9// Load the document from disk.
10MailMessage eml = MailMessage.Load(dataDir + "Message.eml");
11//Get the page count of document
12Console.WriteLine(eml.Subject);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.