Troubleshooting
Fixes for the most common problems with NexPDF for .NET - the native library not loading, license and watermark issues, fonts, signatures and OCR.
.NET found no native engine. It looks for nexpdf_ffi (nexpdf_ffi.dll, libnexpdf_ffi.so or
libnexpdf_ffi.dylib) next to the application, in the runtimes/<rid>/native/ folder of the
package, and on the system library path (LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, PATH). Check that
the file is in the output folder (bin/<configuration>/net8.0/) or set the path variable:
export LD_LIBRARY_PATH=/opt/nexpdf/libThe library must also match the process architecture (RuntimeInformation.ProcessArchitecture): an
arm64 library does not load in an x64 process. See Installation.
Register a resolver for the SDK's assembly before the first NexPDF call. .NET then asks it for
nexpdf_ffi:
using System.Runtime.InteropServices;
using Nexdevit.NexPdf;
NativeLibrary.SetDllImportResolver(typeof(NexPdfDocument).Assembly, (name, _, _) =>
name == "nexpdf_ffi" ? NativeLibrary.Load("/opt/nexpdf/lib/libnexpdf_ffi.so") : IntPtr.Zero);A resolver can be set once per assembly.
The native library is older than the package. Use the library from the same release as the
Nexdevit.NexPdf version in your project, and check that no older copy is found first on the system
path. NexPdfSdk.Version prints the version of the library that was loaded.
Files downloaded with a browser get the quarantine attribute. Remove it from the library you extracted:
xattr -d com.apple.quarantine /opt/nexpdf/lib/libnexpdf_ffi.dylibThe Linux release libraries are built on Ubuntu 22.04 (glibc 2.35) and can fail to load on older
systems. Use a newer base image or distribution (mcr.microsoft.com/dotnet/aspnet:8.0 is based on
Debian 12). There is no musl build, so the Alpine variants of the .NET images do not work; use a
glibc-based image instead.
Check what NexPdfSdk.LicenseStatusJson() returns in the process that renders:
unlicensed:ActivateLicensewas never called in this process, or it threw. Activate it at start-up, before the first document is opened (for example inProgram.cs).trial: trial keys always keep the "NexPDF • Trial" watermark.licensed: commercial keys render without a watermark. If you still see one, it is an old render served from a cache.
The key does not list the platform (-6) or application id (-7) you passed. On servers use
platform server and the app id registered for the license, character for character. You can change
both in the dashboard and download a re-signed key.
The machine's clock is earlier than the key's issue date. Fix the clock (NTP) and activate again.
Your plan does not include that module. See Modules and tiers for which
plan unlocks it, and use NexPdfSdk.IsLicensed("xyz") to hide the feature.
The PDF uses a standard font (Helvetica, Times, Courier) without embedding it. The default build
bundles the Liberation fonts as substitutes. If NexPdfSdk.HasBundledFonts() returns 0, register
them yourself:
foreach (var path in new[] { "LiberationSans-Regular.ttf", "LiberationSerif-Regular.ttf", "LiberationMono-Regular.ttf" })
NexPdfSdk.RegisterStandardFont(File.ReadAllBytes(path));The page is a scanned image with no text layer. Run OCR first; it adds an invisible text layer that extraction and search then read.
Signing returns the complete signed file as a byte[]. Write those bytes to disk unchanged.
Calling doc.Save() afterwards rewrites the file and invalidates the signature. See
Signatures.
With "engine": "auto", Tesseract is used only when the tesseract program is on PATH and has
data for every requested language. Check with tesseract --list-langs, or pass
"engine": "tesseract" to get an error instead of the fallback. See
OCR.
The built-in engine reads Latin-script text only. Load a detection model and a recognition model
for the script with NexPdfSdk.OcrLoadModel before calling Ocr, and pass matching languages.
NexPdfSdk.OcrModelsJson() lists what is loaded; the report's engine says neural (<name>) when
a model was used. See OCR.
The file is a dynamic XFA form, which most viewers no longer lay out. Convert it with
XfaToAcroform() or XfaFlatten(); see XFA forms. Scripts in the
form (FormCalc, JavaScript) are not run.
The document was converted as far as possible, but some PDF/A rules still fail; the
NexPdfException message lists their clauses. Run ValidatePdfaJson(level) to see each failure
with its page and object. See PDF/A and PDF/UA validation.
Documents live in native memory, which the garbage collector does not see. Dispose every document
(using): the finalizer frees forgotten ones only after a collection, which may come late. Documents
that stay open for a long time can call TrimMemory() after large operations. See
Compare and optimise.
Still stuck? Check Error handling for the meaning of each error, or the general FAQ.