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
| Feature | File License | Metered License |
|---|---|---|
| Setup | License.SetLicense() with .lic file | Metered.SetMeteredKey() with key pair |
| Billing | One-time or subscription | Pay per conversion |
| Suitable for | Production servers | Development, low-volume, or cloud workloads |
| Key storage | License file path | Public/private key strings |
Troubleshooting
| Problem | Likely Cause | Fix |
|---|---|---|
| Evaluation watermark in output | Keys not applied before Process() | Call SetMeteredKey() before first conversion |
ArgumentException on keys | Incorrect key format | Verify keys copied exactly from Aspose account |
| Usage not tracked | Network connectivity issue | Ensure outbound internet access for metered telemetry |