Running without a license key
What NexPDF for React Native 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, build your app against it or run it on a device. Until
NexPdf.activateLicense succeeds, the SDK runs in view-only mode:
- the
viewermodule works: open, render, extract text, search and read document information; - pages rendered with
renderPage(renderPagePng) carry a "NexPDF • Unlicensed" watermark; - every call that needs another module rejects with
NexPdfError.
import { NexPdf, NexPdfError } from '@nexdevit/nexpdf-react-native';
const doc = await NexPdf.open(base64Pdf); // no activateLicense call
console.log((await NexPdf.licenseStatus()).state); // "unlicensed"
const png = await doc.renderPage(0, 144); // works, with the watermark
const text = await doc.extractPageText(0); // works
try {
await doc.rotatePage(0, 90); // needs the editor module
} catch (e) {
if (e instanceof NexPdfError) {
console.log(e.message); // no license activated: 'editor' requires a NexPDF license key
console.log(e.license); // true
}
} finally {
await doc.close();
}What works without a key
| Area | Methods |
|---|---|
| Opening and saving | NexPdf.open (PDF and pictures), NexPdf.api.openBytes, openBytesWithPassword, openImage, saveBytes, saveLinearized, insertImagePages, close |
| Rendering | renderPage, renderPagePng, renderThumbPng, pageSize, pageView, pageWidth, pageHeight, pageViewJson, setOverprint (renderPage output is watermarked) |
| Text | extractPageText, extractMarkdown, pageBlocksJson, search, searchJson, askDocument |
| Reading structure | metadata, metadataJson, outlinesJson, pageLabelsJson, layersJson, setLayerVisible, attachments, attachmentsJson, attachmentData |
| Reading annotations | annotations, annotationsJson, measurements, measurementsJson |
| Security | securityJson |
| Comparing and memory | compareJson, compareOverlayPng, compareTextJson, compareAnnotate, memoryUsageBytes, trimMemory |
| Library | NexPdf.version, NexPdf.licenseStatus, NexPdf.api.hasBundledFonts, NexPdf.api.registerStandardFont |
The reader opens without a key too, in viewer mode. Its editing modes need the module of each feature.
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
const status = await NexPdf.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(', '));
}The SDK has no isLicensed helper. To hide features your key does not unlock instead of waiting
for the error, check status.modules.includes('redaction') on a commercial key.
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 resolves to 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.