Skip to Content
NexPDF

Running without a license key

What NexPDF for Node.js does before a key is activated, how the watermark works, and how to evaluate every module with a trial key.

English

You do not need a key to install the Node.js package, write code against it or run it. Until activateLicense succeeds, the SDK runs in view-only mode:

  • the viewer module works: open, render, extract text, search and read document information;
  • pages rendered with render or doc.raw.renderPagePng carry a "NexPDF • Unlicensed" watermark;
  • every call that needs another module throws an Error.
import { writeFile } from 'node:fs/promises';
import { licenseStatus, PdfDocument } from '@nexdevit/nexpdf-node';

const doc = await PdfDocument.open('contract.pdf');   // no activateLicense call
console.log(licenseStatus().state);                   // "unlicensed"

await writeFile('page1.png', doc.render(0, { dpi: 144 }));   // works, with the watermark
const text = doc.text(0);                             // works

try {
  doc.rotatePage(0, 90);                              // needs the editor module
} catch (e) {
  console.log(e.message);  // no license activated: 'editor' requires a NexPDF license key
}

What works without a key

AreaMethods
Opening and savingPdfDocument.open, PdfDocument.fromBytes (PDFs and pictures), toBytes, toLinearizedBytes, save, close, PdfDocument.fromImage, detectKind; WasmDocument.openImage; on doc.raw: saveLinearized, clone, insertImagePages
Renderingrender, pageSize, pageCount; on doc.raw: renderThumbPng, pageViewJson, setOverprint (render output is watermarked)
Texttext, markdown, search; on doc.raw: pageBlocksJson, askDocument
Reading structuremetadata, outlines, pageLabels; on doc.raw: pageLabelsJson, layersJson, setLayerVisible, attachmentsJson, attachmentData
Reading annotationsannotations, measurements
Securitysecurity
Comparing and memorymemoryUsage, trimMemory; on doc.raw: compareJson, compareOverlayPng, compareTextJson, compareAnnotate, memoryUsageBytes

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 needs conversion. The API reference names the module of every method.

Check the mode at run time

import { licenseStatus } from '@nexdevit/nexpdf-node';

const status = 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 licenseStatus().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; 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.

On this page