Running without a license key
What the NexPDF web engine 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 the web package, write code against it or run it. Until
nex.activateLicense succeeds, the engine runs in view-only mode:
- the
viewermodule works: open, render, extract text, search and read document information; - pages rendered with
render,renderUrlordoc.raw.renderPagePngcarry a "NexPDF • Unlicensed" watermark; - every call that needs another module throws an
Error.
import { loadNexPdf } from '@nexdevit/nexpdf-web/engine';
const nex = await loadNexPdf(); // no activateLicense call
console.log(nex.licenseStatus().state); // "unlicensed"
const doc = await nex.PdfDocument.fromUrl('/contract.pdf');
img.src = doc.renderUrl(0, { dpi: 110 }); // works, with the watermark
const text = doc.text(0); // works
try {
doc.raw.rotatePage(0, 90); // needs the editor module
} catch (e) {
console.log((e as Error).message); // no license activated: 'editor' requires a NexPDF license key
}What works without a key
| Area | Methods |
|---|---|
| Opening and saving | PdfDocument.fromBytes, fromFile, fromUrl (PDFs and pictures), toBytes, toBlob, toLinearizedBytes, close, nex.detectKind; on doc.raw: saveBytes, saveLinearized, clone, insertImagePages |
| Rendering | render, renderUrl, pageSize, pageView, pageCount; on doc.raw: renderThumbPng, setOverprint (full-page renders are watermarked) |
| Text | text, markdown, search; on doc.raw: pageBlocksJson, askDocument |
| Reading structure | metadata, security, pageLabels; on doc.raw: outlinesJson, pageLabelsJson, layersJson, setLayerVisible, attachmentsJson, attachmentData |
| Reading annotations | annotations, measurements |
| Security | doc.raw.securityJson |
| Comparing and memory | memoryUsage, trimMemory; on doc.raw: compareJson, compareOverlayPng, compareTextJson, compareAnnotate, memoryUsageBytes |
| Engine | loadNexPdf, version, licenseStatus, hasBundledFonts, registerStandardFont, loadStandardFonts |
Everything else (annotating, reading and filling forms, editing, encrypting, redacting, signing,
converting, OCR and PDF/A) needs a key that includes the module. Opening a Word, Excel or PowerPoint
file, an e-book or a comic needs conversion. The API reference names the module of every
method.
Check the mode at run time
const status = nex.licenseStatus();
if (status.state === 'unlicensed') {
console.log('view-only mode, pages are watermarked');
} else if (status.state === 'trial') {
console.log(`trial, ${status.days_left} days left`);
} else {
console.log('licensed for', status.modules.join(', '));
}Use status.modules.includes('redaction') to hide features your key does not unlock instead of
waiting for the error.
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, with the host name of the page (localhost during development); 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.
The viewer
The viewer runs on the NexPDF WebViewer server, which has its own license. A server without a key runs view-only in the same way, and its pages carry the watermark. See License.