Skip to Content
NexPDF

Running without a license key

What NexPDF for PHP 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 package, write code against it or run it. Until NexPdf::activateLicense succeeds in the PHP process, 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 Nexdevit\NexPdf\NexPdfException.
<?php
require __DIR__ . '/vendor/autoload.php';

use Nexdevit\NexPdf\Document;
use Nexdevit\NexPdf\NexPdf;
use Nexdevit\NexPdf\NexPdfException;

$doc = Document::open('contract.pdf');                    // no activateLicense call
echo NexPdf::licenseStatus()['state'], "\n";              // "unlicensed"
file_put_contents('page1.png', $doc->renderPagePng(0, 144));   // works, with the watermark
echo $doc->extractPageText(0);                            // works

try {
    $doc->rotatePage(0, 90);                              // needs the editor module
} catch (NexPdfException $e) {
    echo $e->getMessage();  // no license activated: 'editor' requires a NexPDF license key
}

What works without a key

AreaMethods
Opening and savingDocument::open, Document::openBytes, NexPdf::openBytesWithPassword, NexPdf::openImage, save, saveBytes, saveLinearized, copy, insertImagePages
RenderingpageCount, renderPagePng, renderThumbPng, pageWidth, pageHeight, pageViewJson, setOverprint (renderPagePng output is watermarked)
TextextractPageText, extractMarkdown, pageBlocksJson, searchJson, askDocument
Reading structuremetadataJson, outlinesJson, pageLabelsJson, layersJson, setLayerVisible, attachmentsJson, attachmentData
Reading annotationsannotationsJson, measurementsJson
SecuritysecurityJson
Comparing and memorycompareJson, compareOverlayPng, compareTextJson, compareAnnotate, trimMemory, memoryUsageBytes
LibraryNexPdf::version, NexPdf::licenseStatus, NexPdf::isLicensed, NexPdf::hasBundledFonts, NexPdf::registerStandardFont

Everything else (annotating, filling forms, editing, encrypting, redacting, signing, converting, OCR and PDF/A) needs a key that includes the module. Document::open and Document::openBytes also need the conversion module when the input is a Word, Excel, PowerPoint or e-book file. The API reference names the module of every method.

Check the mode at run time

$status = NexPdf::licenseStatus();
match ($status['state']) {
    'unlicensed' => print("view-only mode, pages are watermarked\n"),
    'trial' => printf("trial, %d days left\n", $status['days_left']),
    default => printf("licensed for %s\n", implode(', ', $status['modules'])),
};

Use NexPdf::isLicensed('redaction') to hide features your key does not unlock instead of waiting for the exception.

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