DiagramConverter Metered Licensing Guide

DiagramConverter Metered Licensing Guide

This guide explains how to use metered (pay-per-use) licensing with DiagramConverter in Aspose.Diagram for .NET. Metered licensing uses a public/private key pair instead of a license file.

Prerequisites

  • Aspose.Diagram for .NET (version 26.4.0 or later)
  • A metered public key and private key from your Aspose account

Step 1: Apply Metered Keys

Use the Metered class from the Aspose.Diagram namespace to set your keys before calling Process():

using Aspose.Diagram;
using Aspose.Diagram.LowCode;

var metered = new Metered();
metered.SetMeteredKey("your-public-key", "your-private-key");

// Now convert — metered usage is tracked automatically
DiagramConverter.Process("source.vsdx", "output.vdx");

Step 2: Apply Keys at Application Startup

For server applications, apply metered keys once at startup to avoid repeated initialization:

using Aspose.Diagram;

// In Program.cs or Startup.cs
var metered = new Metered();
metered.SetMeteredKey(
    Environment.GetEnvironmentVariable("ASPOSE_PUBLIC_KEY"),
    Environment.GetEnvironmentVariable("ASPOSE_PRIVATE_KEY")
);

Store keys in environment variables or a secrets manager — never hardcode them in source code.

Step 3: Check Metered Consumption

Retrieve current metered consumption to monitor usage:

using Aspose.Diagram;

decimal consumption = Metered.GetConsumptionQuantity();
Console.WriteLine($"Current consumption: {consumption} credits");

Step 4: Convert with Metered License Active

Once keys are applied, use DiagramConverter normally:

using Aspose.Diagram.LowCode;

// Licensing already applied at startup
DiagramConverter.Process("source.vsdx", "output.vdx");

Comparing License Types

FeatureFile LicenseMetered License
SetupLicense.SetLicense() with .lic fileMetered.SetMeteredKey() with key pair
BillingOne-time or subscriptionPay per conversion
Suitable forProduction serversDevelopment, low-volume, or cloud workloads
Key storageLicense file pathPublic/private key strings

Troubleshooting

ProblemLikely CauseFix
Evaluation watermark in outputKeys not applied before Process()Call SetMeteredKey() before first conversion
ArgumentException on keysIncorrect key formatVerify keys copied exactly from Aspose account
Usage not trackedNetwork connectivity issueEnsure outbound internet access for metered telemetry

See Also