public class Metered
Example: Example:
Metered matered = new Metered();
matered.setMeteredKey("PublicKey", "PrivateKey");
// Create a new Metered license, and then print its usage statistics.
Metered metered = new Metered();
metered.setMeteredKey("MyPublicKey", "MyPrivateKey");
System.out.println("Credit before operation: {Metered.GetConsumptionCredit()}");
System.out.println("Consumption quantity before operation: {Metered.GetConsumptionQuantity()}");
// Operate using Aspose.Words, and then print our metered stats again to see how much we spent.
Document doc = new Document(getMyDir() + "Document.docx");
doc.save(getArtifactsDir() + "Metered.Usage.pdf");
System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));
Constructor Summary |
---|
Metered()
Initializes a new instance of this class. |
Method Summary | ||
---|---|---|
static java.math.BigDecimal | getConsumptionCredit() | |
Gets consumption credit
|
||
static java.math.BigDecimal | getConsumptionQuantity() | |
Gets consumption file size
|
||
void | setMeteredKey(java.lang.String publicKey, java.lang.String privateKey) | |
Sets metered public and private key.
If you purchase metered license, when start application, this API should be called, normally, this is enough.
However, if always fail to upload consumption data and exceed 24 hours, the license will be set to evaluation status,
to avoid such case, you should regularly check the license status, if it is evaluation status, call this API again.
|
public Metered()
Example:
Shows how to activate a Metered license and track credit/consumption.// Create a new Metered license, and then print its usage statistics. Metered metered = new Metered(); metered.setMeteredKey("MyPublicKey", "MyPrivateKey"); System.out.println("Credit before operation: {Metered.GetConsumptionCredit()}"); System.out.println("Consumption quantity before operation: {Metered.GetConsumptionQuantity()}"); // Operate using Aspose.Words, and then print our metered stats again to see how much we spent. Document doc = new Document(getMyDir() + "Document.docx"); doc.save(getArtifactsDir() + "Metered.Usage.pdf"); System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit())); System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));
public static java.math.BigDecimal getConsumptionCredit() throws java.lang.Exception
Example:
Shows how to activate a Metered license and track credit/consumption.// Create a new Metered license, and then print its usage statistics. Metered metered = new Metered(); metered.setMeteredKey("MyPublicKey", "MyPrivateKey"); System.out.println("Credit before operation: {Metered.GetConsumptionCredit()}"); System.out.println("Consumption quantity before operation: {Metered.GetConsumptionQuantity()}"); // Operate using Aspose.Words, and then print our metered stats again to see how much we spent. Document doc = new Document(getMyDir() + "Document.docx"); doc.save(getArtifactsDir() + "Metered.Usage.pdf"); System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit())); System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));
public static java.math.BigDecimal getConsumptionQuantity()
Example:
Shows how to activate a Metered license and track credit/consumption.// Create a new Metered license, and then print its usage statistics. Metered metered = new Metered(); metered.setMeteredKey("MyPublicKey", "MyPrivateKey"); System.out.println("Credit before operation: {Metered.GetConsumptionCredit()}"); System.out.println("Consumption quantity before operation: {Metered.GetConsumptionQuantity()}"); // Operate using Aspose.Words, and then print our metered stats again to see how much we spent. Document doc = new Document(getMyDir() + "Document.docx"); doc.save(getArtifactsDir() + "Metered.Usage.pdf"); System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit())); System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));
public void setMeteredKey(java.lang.String publicKey, java.lang.String privateKey)
publicKey
- public keyprivateKey
- private keyExample:
Shows how to activate a Metered license and track credit/consumption.// Create a new Metered license, and then print its usage statistics. Metered metered = new Metered(); metered.setMeteredKey("MyPublicKey", "MyPrivateKey"); System.out.println("Credit before operation: {Metered.GetConsumptionCredit()}"); System.out.println("Consumption quantity before operation: {Metered.GetConsumptionQuantity()}"); // Operate using Aspose.Words, and then print our metered stats again to see how much we spent. Document doc = new Document(getMyDir() + "Document.docx"); doc.save(getArtifactsDir() + "Metered.Usage.pdf"); System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit())); System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));