Troubleshooting
Fixes for the most common problems with NexPDF for Rust - the build not finding the engine, the shared library not loading, license and watermark issues, fonts, signatures and OCR.
The nexpdf-sys build script found no engine library. Its message says what to download and which
variable to set. Unpack the archive for your platform from the
release and point the build at its
lib folder:
export NEXPDF_LIB_DIR=/opt/nexpdf-ffi-1.1.0-linux-x64/lib
cargo buildWhen cross-compiling, set NEXPDF_LIB_DIR_<target> (for example
NEXPDF_LIB_DIR_aarch64_linux_android): the host's library is never used for another target. For
cargo doc without the engine, set NEXPDF_NO_LINK=1. See Installation.
With the shared library, the program must find libnexpdf_ffi again at run time. Errors such as
error while loading shared libraries: libnexpdf_ffi.so, dyld: Library not loaded or a missing
nexpdf_ffi.dll mean it did not. Either:
- add an rpath (
-C link-arg=-Wl,-rpath,<lib folder>in.cargo/config.toml), or setLD_LIBRARY_PATH/DYLD_LIBRARY_PATH; - on Windows, put
nexpdf_ffi.dllnext to the.exeor onPATH; - or link statically with
NEXPDF_STATIC=1and a clean rebuild, which needs nothing at run time.
The SDK's own tests get the rpath automatically; your own binaries do not.
Files downloaded with a browser get the quarantine attribute. Remove it from the library you extracted:
xattr -d com.apple.quarantine /opt/nexpdf-ffi-1.1.0-macos-universal/lib/libnexpdf_ffi.dylibStatic linking (NEXPDF_STATIC=1) avoids shipping the .dylib at all.
The Linux release libraries are built on Ubuntu 22.04 (glibc 2.35) and can fail to link or load on
older systems. Build and run on a newer distribution or base image (for example
debian:bookworm-slim). There is no musl build, so x86_64-unknown-linux-musl targets and Alpine
images need a glibc-based target instead.
The library and the crate must have the same version: the 1.1 functions are missing from an older
library, for example a 1.0 one installed in /usr/local/lib for another NexPDF SDK. Download the archive of the same release as the crate and run cargo clean -p nexpdf-sys
so the build script runs again.
Check what license::status_json() returns in the process that renders:
unlicensed:license::activatewas never called in this process, or it returned anErr. Activate it at start-up, and do not discard itsResult.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 license::is_licensed("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 nexpdf_sdk::has_bundled_fonts()? returns 0,
register them yourself:
for path in ["LiberationSans-Regular.ttf", "LiberationSerif-Regular.ttf", "LiberationMono-Regular.ttf"] {
nexpdf_sdk::register_standard_font(&std::fs::read(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 Vec<u8>. 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.
The built-in engine reads Latin-script text only. Load a detection model and a recognition model
for the script with nexpdf_sdk::ocr_load_model before calling ocr, and pass matching
languages. nexpdf_sdk::ocr_models_json() 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
xfa_to_acroform() or xfa_flatten(); 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 error lists
their clauses. Run validate_pdfa_json(level) to see each failure with its page and object. See
PDF/A and PDF/UA validation.
Drop every document as soon as you are done with it. Documents that stay open for a long time can
call trim_memory() after large operations. See
Compare and optimise.
Still stuck? Check Error handling for the meaning of each error, or the general FAQ.