Skip to Content
NexPDF

Running without a license key

What NexPDF for Flutter 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 NexPDF to your app, write code against it or run it. Until sdk.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 engine function that needs another module fails, and the nexpdfCall helper throws NexPdfException.

Every method of the Dart API (open, openFile, pageCount, pageSize, pageView, renderPagePng, search, toMarkdown, ask and save) belongs to the viewer module, so all of them work without a key.

import 'dart:ffi';
import 'package:nexpdf_flutter/nexpdf_flutter.dart';
import 'nexpdf_ffi.dart';

final sdk = NexPdfFlutter();
final doc = sdk.open(bytes);                      // no activateLicense call
final png = doc.renderPagePng(0, dpi: 144);       // works, with the watermark
final hits = doc.search('total');                 // works

// int32_t nexpdf_rotate_page(NexPdfDocument *doc, size_t page_index, int32_t degrees);
final rotatePage = nexpdfLib.lookupFunction<Int32 Function(Pointer<Void>, Size, Int32),
    int Function(Pointer<Void>, int, int)>('nexpdf_rotate_page');

try {
  nexpdfCall(() => rotatePage(doc.handle, 0, 90));   // needs the editor module
} on NexPdfException catch (e) {
  print(e.message);   // no license activated: 'editor' requires a NexPDF license key
} finally {
  doc.dispose();
}

What works without a key

AreaDart APIC functions through dart:ffi
Opening and savingopen, openFile, savenexpdf_open_image, nexpdf_save_linearized, nexpdf_insert_image_pages
RenderingrenderPagePng (watermarked), pageSize, pageViewnexpdf_render_thumb_png, nexpdf_set_overprint
Textsearch, toMarkdown, asknexpdf_extract_page_text, nexpdf_page_blocks_json
Reading structurenexpdf_metadata_json, nexpdf_outlines_json, nexpdf_page_labels_json, nexpdf_layers_json, nexpdf_set_layer_visible, nexpdf_attachments_json, nexpdf_attachment_data
Reading annotationsnexpdf_annotations_json, nexpdf_measurements_json
Securityopen(bytes, password:)nexpdf_security_json
Comparing and memorynexpdf_compare_json, nexpdf_compare_overlay_png, nexpdf_trim_memory, nexpdf_memory_usage_bytes

The native reader and NexPdfViewerWidget open without a key too, in viewer mode. The reader's 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 and the modules per plan list them.

Check the mode at run time

The Dart API has no status method. Read nexpdf_license_status_json through dart:ffi, with the licenseStatus() function from License:

final status = licenseStatus();
switch (status['state']) {
  case 'unlicensed':
    print('view-only mode, pages are watermarked');
  case 'trial':
    print('trial, ${status['days_left']} days left');
  default:
    print('licensed for ${(status['modules'] as List).join(', ')}');
}

To hide features your key does not unlock instead of waiting for the error, check whether status['modules'] contains the module 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 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