Skip to Content
NexPDF

Running without a license key

What NexPDF for iOS (Swift) 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 add the package, write code against it or run it. Until NexPdf.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 renderPagePng carry a "NexPDF • Unlicensed" watermark;
  • every call that needs another module throws NexPdfError.
import NexPdf

let doc = try NexPdfDocument.open(url: contractURL)      // no activateLicense call
print(NexPdf.licenseStatus["state"] ?? "")               // "unlicensed"
let png = try doc.renderPagePng(pageIndex: 0, dpi: 144)  // works, with the watermark
let text = try doc.extractPageText(pageIndex: 0)         // works

do {
    try doc.rotatePage(pageIndex: 0, degrees: 90)        // needs the editor module
} catch let error as NexPdfError {
    print(error.message)  // no license activated: 'editor' requires a NexPDF license key
}

What works without a key

AreaMethods
Opening and savingNexPdfDocument.open(url:password:), open(data:password:), openBytesWithPassword(data:password:), openImage(data:), saveBytes(), saveLinearized(), write(to:), copy(), insertImagePages(index:data:)
RenderingrenderPagePng(pageIndex:dpi:), renderThumbPng(pageIndex:maxDim:), pageSize(_:), pageViewJson(pageIndex:), setOverprint(mode:) (renderPagePng output is watermarked)
TextextractPageText(pageIndex:), extractMarkdown(), pageBlocksJson(pageIndex:), searchJson(query:), askDocument(question:k:maxChars:)
Reading structuremetadataJson(), outlinesJson(), pageLabelsJson(), layersJson(), setLayerVisible(num:generation:visible:), attachmentsJson(), attachmentData(name:)
Reading annotationsannotationsJson(pageIndex:), measurementsJson()
SecuritysecurityJson()
Comparing and memorycompareJson(b:dpi:), compareOverlayPng(b:pageIndex:dpi:), compareTextJson(b:optionsJson:), compareAnnotate(b:optionsJson:), trimMemory(), memoryUsageBytes()

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.

The reader works the same way: viewing, search, bookmarks and thumbnails work without a key. An editing action that needs a module shows "This feature needs a NexPDF license" instead of changing the page.

Check the mode at run time

let status = NexPdf.licenseStatus
switch status["state"] as? String {
case "unlicensed":
    print("view-only mode, pages are watermarked")
case "trial":
    print("trial, \(status["days_left"] ?? 0) days left")
default:
    print("licensed for", (status["modules"] as? [String] ?? []).joined(separator: ", "))
}

Use NexPdf.isLicensed("redaction") to hide features your key does not unlock instead of waiting for the error. To limit the reader to what the key unlocks, pass only those modes in modeConfig.availableModes.

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 with your bundle id, 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. App Store builds need a commercial key for the modules they use. See Licensing and the modules per plan.

On this page