Running without a license key
What NexPDF for .NET does before a key is activated, how the watermark works, and how to evaluate every module with a trial key.
You do not need a key to install NexPDF, write code against it or run it. Until
NexPdfSdk.ActivateLicense succeeds, the SDK runs in view-only mode:
- the
viewermodule works: open, render, extract text, search and read document information; - pages rendered with
RenderPagePngcarry a "NexPDF • Unlicensed" watermark; - every call that needs another module throws
NexPdfException.
using Nexdevit.NexPdf;
using var doc = NexPdfDocument.Open("contract.pdf"); // no ActivateLicense call
Console.WriteLine(NexPdfSdk.LicenseStatusJson()); // {"state":"unlicensed",...}
var png = doc.RenderPagePng(0, 144); // works, with the watermark
var text = doc.ExtractPageText(0); // works
try
{
doc.RotatePage(0, 90); // needs the editor module
}
catch (NexPdfException e)
{
Console.WriteLine(e.Message); // no license activated: 'editor' requires a NexPDF license key
}What works without a key
| Area | Members |
|---|---|
| Opening and saving | NexPdfDocument.Open, OpenBytes, OpenBytesWithPassword, OpenImage, Save, SaveBytes, SaveLinearized, Copy, InsertImagePages |
| Rendering | RenderPagePng, RenderThumbPng, PageCount, PageWidth, PageHeight, PageViewJson, PageView, SetOverprint (RenderPagePng output is watermarked) |
| Text | ExtractPageText, ExtractMarkdown, ToMarkdown, PageBlocksJson, SearchJson, AskDocument, AskDocumentJson |
| Reading structure | MetadataJson, OutlinesJson, PageLabelsJson, LayersJson, SetLayerVisible, AttachmentsJson, AttachmentData |
| Reading annotations | AnnotationsJson, MeasurementsJson |
| Security | SecurityJson |
| Comparing and memory | CompareJson, CompareOverlayPng, CompareTextJson, CompareAnnotate, TrimMemory, MemoryUsageBytes |
| Library | NexPdfSdk.Version, LicenseStatusJson, IsLicensed, HasBundledFonts, RegisterStandardFont |
Everything else (annotating, filling forms, editing, encrypting, redacting, signing, converting, OCR and PDF/A) needs a key that includes the module. The API reference names the module of every method.
Check the mode at run time
using System.Text.Json.Nodes;
var status = JsonNode.Parse(NexPdfSdk.LicenseStatusJson())!;
switch (status["state"]!.GetValue<string>())
{
case "unlicensed":
Console.WriteLine("view-only mode, pages are watermarked");
break;
case "trial":
Console.WriteLine($"trial, {status["days_left"]} days left");
break;
default:
Console.WriteLine($"licensed for {status["modules"]!.ToJsonString()}");
break;
}Use NexPdfSdk.IsLicensed("redaction") to hide features your key does not unlock instead of waiting
for the exception.
Evaluate with a trial key
A trial key unlocks every module so you can try annotations, signing, redaction and the rest. It
keeps a "NexPDF • Trial" watermark on rendered pages, and ActivateLicense returns 1 instead of
2. Trial keys last 30 days; ask for one from the pricing page and activate it exactly
like a commercial key; see License.
Do not ship view-only or trial builds
The watermark is drawn on the pixels of rendered pages only; documents you save are not changed. Even so, view-only and trial modes are for development and evaluation. Production apps need a commercial key for the modules they use. See Licensing and the modules per plan.