We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Usage monitoring of Aspose.Words

Hi there,

Hope you’re well.

I am currently using Aspose.Words with the metered license.

We were looking into monitoring the usage of Aspose.Words with the metered license in line with the example given here.

However what has been noticed is that the statistics is not updated and is always returning 0.

i.e.

GetConsumptionCredit() returns 0

And GetConsumptionQuantity() also returns 0.

Hence, could I please get help on what is the best approach to get the usage stats out for metered license?

Thank you!

@celinewong21 The problem occurs because Aspose Metered Licensing mechanism does not send the usage data to purchase server every time. So you need to add a delay to make it work.
You can try using the following code:

var consumptionCreditBefore = Aspose.Words.Metered.GetConsumptionCredit();
var doc = new Aspose.Words.Document(@"C:\Temp\Test.docx");
doc.Save(@"C:\Temp\Metered.Usage.pdf");
System.Threading.Thread.Sleep(10000);
var consumptionCreditAfter = Aspose.Words.Metered.GetConsumptionCredit();
var consumptionCredit = consumptionCreditAfter - consumptionCreditBefore;

Hi @alexey.noskov
Issue.png (38.7 KB)

We still have the same result of 0, even with the delay. So the suggested code didn’t work.
See the snapshot of code below.

@celinewong21 The problem might occur because delay is too small. It will be resources consuming if Metered licensing mechanism will send the data too frequently.

@alexey.noskov What do you advise for a suitable delay?

@celinewong21 The minimum data upload time is 5 seconds. But the mechanism does not upload usage data if used credits is less than threshold.

@alexey.noskov That could be why! What’s the minimum credit which will be returned, and is this threshold configurable?

@celinewong21 As I can see in the code threshold is 30. It is not configurable.