MeteredSetMeteredKey Method

Sets metered public and private key

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public void SetMeteredKey(
	string publicKey,
	string privateKey
)

Parameters

publicKey
Type: SystemString
public key
privateKey
Type: SystemString
private key
Examples
Shows how to activate a Metered license and track credit/consumption.
// Set a public and private key for a new Metered instance
Metered metered = new Metered();
metered.SetMeteredKey("MyPublicKey", "MyPrivateKey");

// Print credit/usage 
Console.WriteLine($"Credit before operation: {Metered.GetConsumptionCredit()}");
Console.WriteLine($"Consumption quantity before operation: {Metered.GetConsumptionQuantity()}");

// Do something
Document doc = new Document(MyDir + "Document.docx");

// Print credit/usage to see how much was spent
Console.WriteLine($"Credit after operation: {Metered.GetConsumptionCredit()}");
Console.WriteLine($"Consumption quantity after operation: {Metered.GetConsumptionQuantity()}");
See Also