Class Metered

Metered class

提供设置计量密钥的方法。

public class Metered

构造函数

姓名描述
Metered()默认构造函数。

方法

姓名描述
ResetMeteredKey()删除之前设置的许可证。
SetMeteredKey(string, string)设置计量公钥和私钥。
static GetConsumptionCredit()获得消费信用。
static GetConsumptionQuantity()获取消费文件大小。

例子

在此示例中,将尝试设置计量公钥和私钥

[C#]

Metered metered = new Metered();
metered.SetMeteredKey("PublicKey", "PrivateKey");


[Visual Basic]

Dim metered As Metered = New Metered
metered.SetMeteredKey("PublicKey", "PrivateKey")

显示如何设置计量许可证。

Metered metered = new Metered();
metered.SetMeteredKey("MyPublicKey", "MyPrivateKey");

Console.WriteLine($"Credit before operation: {Metered.GetConsumptionCredit():F2}");
Console.WriteLine($"Consumption quantity before operation: {Metered.GetConsumptionQuantity():F2}");

// 文档目录的路径。
string dataDir = RunExamples.GetDataDir_Pages();

// 加载 OneNote 文档并获取第一个子节点           
Document document = new Document(Path.Combine(dataDir, "Aspose.one"));

document.Save(Path.Combine(dataDir, "MeteredLicense.pdf"));

Console.WriteLine($"Credit before operation: {Metered.GetConsumptionCredit():F2}");
Console.WriteLine($"Consumption quantity before operation: {Metered.GetConsumptionQuantity():F2}");

也可以看看