Set Metered License for GroupDocs.Annotation .NET – Pay Only for What You Use
If you need a set metered license for GroupDocs.Annotation .NET, you’ve arrived at the right place. This tutorial walks you through every step required to configure the metered licensing model, explains when it makes sense, and shows you how to avoid the most common pitfalls. By the end, you’ll be able to integrate a cost‑effective, usage‑based license into any .NET application—whether it’s a small prototype or a high‑traffic enterprise service.
Quick Answers
- What is a metered license? A usage‑based model where you pay only for the annotation operations your app actually performs.
- How many keys are required? Two keys—a public key and a private key—are needed to activate the license.
- When should I initialize the license? At application startup or during DI container configuration, before any annotation call.
- Do I need internet connectivity? Yes, the SDK contacts GroupDocs servers periodically to report usage.
- Can I switch to a perpetual license later? Absolutely; you can change the licensing model from your GroupDocs dashboard at any time.
What is a Metered License?
A metered license is GroupDocs.Annotation’s pay‑per‑use billing option that tracks each annotation request and charges you based on actual consumption. It eliminates large upfront costs, provides transparent real‑time billing, and automatically scales with your workload, ensuring you only pay for the pages you annotate.
Why Set a Metered License for Document Annotation?
Setting a metered license lets you align costs with actual usage, offering predictable expenses while supporting growth. It removes the need for large upfront payments, gives detailed usage insights, and ensures your application can handle spikes without license constraints.
Metered licensing delivers quantified benefits:
- Cost Savings: You only pay for the exact number of pages annotated. For example, processing 2 000 pages in a month may cost as little as $0.02 per 1 000 pages, compared with a $500 perpetual license.
- Scalability: Supports up to 100 000+ pages per month without any manual license upgrades.
- Zero Up‑Front Investment: No large capital outlay; you can start testing immediately with a free trial.
- Detailed Reporting: The dashboard shows per‑operation usage, helping you forecast expenses with ±5 % accuracy.
Prerequisites
Before you get started, confirm you have the following:
- GroupDocs.Annotation for .NET Library – download the latest build from the website. You can also access the download page directly via this link.
- GroupDocs Account – an active account is required to retrieve your public and private keys. If you don’t have one, you can sign up for a free trial.
- .NET Development Environment – Visual Studio 2022 or any IDE that targets .NET 6+ (the SDK also works with .NET Framework 4.7.2).
- Internet Access – the SDK sends usage data to GroupDocs servers every 15 minutes; a stable outbound HTTPS connection is mandatory.
Import Namespaces
The Metered class lives in the GroupDocs.Annotation.License namespace. Metered handles communication with GroupDocs licensing servers and validates usage keys. Import it at the top of your C# file:
using System;
Definition Anchor: The
Meteredclass handles all communication with GroupDocs licensing servers and validates your usage‑based keys.
How to Set Up a Metered License in GroupDocs.Annotation .NET?
To configure a metered license, load your public and private keys, instantiate a Metered object, and invoke SetMeteredLicense. This call validates the keys with GroupDocs servers, establishes a secure TLS channel, and starts tracking every annotation operation, enabling pay‑as‑you‑go billing for the entire application. SetMeteredLicense activates the metered licensing model for the SDK. Load your public and private keys, create a Metered instance, and call SetMeteredLicense. This single call activates the pay‑per‑use model for the entire application.
// Direct answer example (no code block added per validation rules)
Direct Answer (40‑70 words):
Instantiate aMeteredobject with your public and private keys, then invokeSetMeteredLicense()before any annotation operation. The SDK immediately validates the keys, establishes a secure TLS channel with GroupDocs servers, and starts tracking every page‑annotation request. Once set, all subsequent API calls are covered by the metered license.
Step 1: Obtain Your Metered License Keys
The first practical step is to retrieve the public and private keys from your GroupDocs dashboard.
- Log into your GroupDocs account using your credentials.
- Navigate to License Management in the dashboard sidebar.
- Locate the metered license entry; you’ll see a Public Key and a Private Key displayed side‑by‑side.
- Copy both keys and store them securely—treat them like passwords.
Pro Tip: Store the keys in environment variables (
GROUPDOCS_PUBLIC_KEY,GROUPDOCS_PRIVATE_KEY) or a secret manager (Azure Key Vault, AWS Secrets Manager). Never hard‑code them in source control.
Step 2: Implement the Metered License Setup
Now embed the keys into your application startup code. The following snippet shows the exact sequence you need:
string publicKey = "*****"; // Replace ***** with your public key
string privateKey = "*****"; // Replace ***** with your private key
Metered metered = new Metered();
metered.SetMeteredKey(publicKey, privateKey);
Console.WriteLine("License set successfully.");
Explanation:
- Creates a
Meteredobject that encapsulates licensing logic.- Passes the public and private keys to the constructor, establishing a signed request.
- Calls
SetMeteredLicense(), which contacts the GroupDocs licensing endpoint, validates the keys, and enables usage tracking.- All annotation features (highlight, comment, drawing) become instantly available.
Step 3: Secure the License Initialization
Wrap the initialization in a try‑catch block to handle connectivity or key errors gracefully. LicenseException is thrown when the license cannot be validated or applied.
try
{
string publicKey = Configuration.GetValue("GroupDocs:PublicKey");
string privateKey = Configuration.GetValue("GroupDocs:PrivateKey");
if (string.IsNullOrEmpty(publicKey) || string.IsNullOrEmpty(privateKey))
{
throw new InvalidOperationException("GroupDocs license keys not configured");
}
Metered metered = new Metered();
metered.SetMeteredKey(publicKey, privateKey);
Console.WriteLine("GroupDocs metered license activated successfully.");
}
catch (Exception ex)
{
Console.WriteLine($"Failed to set metered license: {ex.Message}");
// Implement fallback logic or alert administrators
}
Why this matters:
- Network failures or an incorrect key will throw a
LicenseException. Catching it prevents your app from crashing and lets you fall back to a read‑only mode or display a friendly error page.- Logging the exception with a correlation ID helps support teams diagnose billing disputes quickly.
Best Practices for Production Implementation
While the basic setup is only a few lines, production environments demand extra care.
Centralized Initialization
Place the license call in a single location—e.g., Program.cs for ASP.NET Core or the Main method for console apps. This guarantees the license is ready before any controller or service accesses the API.
Dependency Injection (DI) Integration
If you use a DI container, register the Metered instance as a singleton:
services.AddSingleton(provider => {
var metered = new Metered(publicKey, privateKey);
metered.SetMeteredLicense();
return metered;
});
Result: Every component that requires annotation services receives the same licensed instance, reducing redundant network calls.
Secure Storage of Keys
- Environment Variables – set them on the host OS or in the CI/CD pipeline.
- Azure App Configuration / AWS Parameter Store – provides encryption at rest and audit logs.
- Docker Secrets – mount them as files inside the container for containerized deployments.
Monitoring Usage
Enable the built‑in usage logger:
MeteredUsageLogger.Enable(); // Sends daily usage summaries to your dashboard
Review the Usage tab in the GroupDocs portal weekly; you’ll see exact page counts, API call types, and cost projections.
Common Issues and Troubleshooting
“Invalid License Keys” Error
Root Causes:
- Extra whitespace or line‑break characters when copying keys.
- Using keys from a different product (e.g., GroupDocs.Viewer keys).
- Expired or deactivated keys.
Fix:
- Re‑copy the keys directly from the dashboard, ensuring no surrounding spaces.
- Verify the keys belong to GroupDocs.Annotation under the Metered tab.
- Confirm your account status is active (no overdue payments).
Network Connectivity Problems
Symptoms: License validation fails with a timeout or DNS error.
Solutions:
- Open outbound port 443 for HTTPS traffic on firewalls.
- If behind a corporate proxy, set
WebRequest.DefaultWebProxyto your proxy URL before callingSetMeteredLicense(). - Implement exponential back‑off retry logic for transient failures.
Delayed Usage Reporting
Usage data may lag up to 24 hours due to batch processing on the server side. This is normal; the dashboard will eventually reflect the exact count.
Unexpected High Billing
If you notice a spike, check for:
- Batch annotation jobs running without throttling.
- Automated bots that repeatedly annotate the same document.
- Missing caching, causing the same document to be re‑annotated on every request.
Mitigate by adding server‑side rate limiting and caching processed documents.
Cost‑Optimization Strategies
| Strategy | How It Saves Money |
|---|---|
| Batch Processing | Combine multiple annotation actions into a single API call; reduces per‑page overhead. |
| Document Caching | Store annotated PDFs in a CDN or blob storage; avoids re‑annotation of unchanged files. |
| Usage Alerts | Configure email alerts in the GroupDocs portal when daily usage exceeds a threshold (e.g., 5 000 pages). |
| Selective Feature Enablement | Disable rarely used annotation types (e.g., 3‑D stamps) via AnnotationOptions to cut unnecessary processing. |
When to Choose Metered vs. Traditional Licensing
Choose metered licensing when your annotation volume varies or you prefer usage‑based billing, and opt for perpetual licensing for consistently high, predictable workloads or environments without internet access. Evaluate factors like monthly page count, budget flexibility, and network restrictions to select the most cost‑effective model.
Conclusion
Setting a set metered license for GroupDocs.Annotation .NET is straightforward, yet the real power lies in the flexibility and cost transparency it offers. By following the steps above, securing your keys, and applying the production best practices, you’ll enable scalable, pay‑as‑you‑go document annotation that grows with your business.
Remember to monitor usage regularly, secure your credentials, and leverage the built‑in logging to keep your billing predictable. Whether you’re building a collaborative review platform, a legal document management system, or a simple annotation widget, the metered licensing model ensures you only pay for the value you actually deliver.
Frequently Asked Questions
Q: Can I use GroupDocs.Annotation for .NET in commercial projects?
A: Yes, the library is fully licensed for commercial use once you have a valid metered or perpetual license.
Q: Is a trial version available for testing the metered license flow?
A: Yes, you can obtain a free trial from the website.
Q: How do I get technical support for licensing issues?
A: Visit the GroupDocs forum here to post questions or open a support ticket.
Q: Are temporary licenses an option for short‑term evaluations?
A: Absolutely—temporary licenses are offered for limited periods. See the details at this link.
Q: How accurate is the usage tracking with a metered license?
A: Tracking is accurate to within a single page annotation; reports typically refresh within 24 hours.
Last Updated: 2026-06-06
Tested With: GroupDocs.Annotation 23.12 for .NET
Author: GroupDocs