GroupDocsGists
10/19/2017 - 11:13 AM

GetMeteredLicenseConsumption.cs

// For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET
// Create new instance of GroupDocs.Viewer.Metered class
GroupDocs.Viewer.Metered metered = new GroupDocs.Viewer.Metered();

// Set public and private keys
string publicKey = "***";
string privateKey = "***";

// Set public and private keys to metered instance
metered.SetMeteredKey(publicKey, privateKey);

// Get metered value before usage of the comparison
decimal amountBefore = GroupDocs.Viewer.Metered.GetConsumptionQuantity();

Console.WriteLine("Amount (MB) consumed before:" + amountBefore);

// Get pages
GroupDocs.Viewer.Handler.ViewerHtmlHandler htmlHandler = new GroupDocs.Viewer.Handler.ViewerHtmlHandler();
List<GroupDocs.Viewer.Domain.Html.PageHtml> pages = htmlHandler.GetPages("input.pdf");

// Get metered value after usage of the comparison
decimal amountAfter = GroupDocs.Viewer.Metered.GetConsumptionQuantity();

Console.WriteLine("Amount (MB) consumed after: " + amountAfter);