Troubleshooting
Fixes for the most common problems with NexPDF for Electron - the engine not being found or not starting, packaging, license and watermark issues, encrypted files, OCR, signatures, the document API, XFA and PDF/A validation.
openPdfWindow and startEngine look for nexpdf-webviewer (nexpdf-webviewer.exe on Windows)
in the binary option, NEXPDF_BINARY, process.resourcesPath/nexpdf/, then the package's
bin/<platform>-<arch>/ and bin/ folders. The error lists every path it tried. In a packaged app,
check that your builder copies the engine to a nexpdf folder in the resources; see
Installation.
The engine stopped, or did not report its address within 15 seconds. The message includes what it printed. Common causes:
- the binary is for another platform or architecture than the one the app runs on;
- on macOS and Linux, the file lost its executable bit (
chmod +x nexpdf-webviewer); - on macOS, the downloaded binary still has the quarantine attribute:
xattr -d com.apple.quarantine bin/mac/nexpdf-webviewerThe Linux release binaries are built on Ubuntu 22.04 (glibc 2.35) and do not start on older distributions. There is no musl build. Build the engine yourself on the oldest distribution you support, or require a newer one.
Read /api/license from the engine (see Running without a key):
unlicensed: no key reached the engine, or it was rejected. The reason is printed on the engine's standard error at start-up. Each window has its own engine, so passlicenseto everyopenPdfWindowcall.trial: trial keys always keep the "NexPDF • Trial" watermark.licensed: commercial keys render without a watermark.
The engine checks keys for platform server and the app id nexpdf-webviewer, or the one in
NEXPDF_APP_ID. A web, android or desktop key for another id is rejected. Ask for a server key
for that app id, or set NEXPDF_APP_ID to the id the key lists; see
License. You can change both in the dashboard and download a
re-signed key.
The computer's clock is earlier than the key's issue date. Fix the clock and restart the window.
Pass the password: openPdfWindow({ file, password }), pdf.open(file, { password }) or
openDocument(engine, bytes, name, { password }) (1.0.1 and later). A missing or wrong password
rejects with passwordRequired set; see Error handling.
The File, Open… menu item sends no password, so encrypted files opened with it fail; the
window's own Open button asks for the password.
In 1.0.0, a configuration object or JSON text passed as config or uiConfig did not reach the
engine; only a file path worked. Update to 1.0.1, which writes objects and JSON text to a temporary
file for the engine. Unknown keys and ids are ignored, so also check the spelling against
Viewer.
Custom items in toolbarConfig.customItems are shown, but the reader reports a tap only to a page
that embeds it, and the Electron window is not one, so the main process is not told. Use your own
application menu for app actions.
The engine runs natively and uses Tesseract when the tesseract program is found (on PATH, or in
/opt/homebrew/bin, /usr/local/bin or /usr/bin) and has data for every requested language.
Check with tesseract --list-langs, or pick the built-in engine in the OCR dialog. See
OCR.
The engine keeps a signed file byte for byte, so pdf.save() and pdf.bytes() right after signing
return the signed file unchanged. Any edit made after signing (an annotation, a form value, a page
change) rewrites the file and invalidates the signature. Sign last.
The trusted timestamp (TSA URL) and revocation data for long-term validation are fetched over the network by the engine. Check that the machine can reach the TSA and the OCSP and CRL servers named in the certificates, through any proxy or firewall.
In the main process, sign makes no network calls and signs at B-B only; use doc.signOnline or
the other online calls of documents() for B-T, B-LT and B-LTA. Their errors name the server that
answered (answered HTTP …), or say "TSA callback failed" when your tsa function threw. See
Long-term signatures.
Without ANTHROPIC_API_KEY the assistant shows the most relevant passages instead of written
answers. Pass the key in the engine's environment: startEngine({ env: { ANTHROPIC_API_KEY } }), or
set process.env.ANTHROPIC_API_KEY before openPdfWindow. See
Text and the assistant.
Each window runs its own engine process, with its own document and caches. Close windows you no
longer need, and call engine.close() on engines you started with startEngine. See
Platform notes.
documents() and openDocumentFile() load the Node.js SDK, which is installed separately with its
WebAssembly engine. Install @nexdevit/nexpdf-node of the same version next to this package; see
Installation. A 1.0 copy of the Node.js SDK has no CommonJS entry and
fails the same way.
The window's engine and the document API check keys separately. The engine takes a server key
through the license option; the document API takes a key for platform web with your app id,
through documents().activateLicense(key, appId). See
License.
The built-in engine reads Latin-script text only. In the window, install Tesseract with the language
data for that script on the machine and pass its codes (chi_sim, ara, rus). The window cannot
load neural OCR models; the document API in the main process can, with ocrLoadModel from
documents(). See
OCR.
The file is a dynamic XFA form, which most viewers no longer lay out. Convert it in the main process
with doc.raw.xfaToAcroform() or doc.raw.xfaFlatten() and open the result in the window; 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 doc.raw.validatePdfaJson(level) to see each failure with its page and object.
See PDF/A and PDF/UA validation.
Still stuck? Check Error handling for the meaning of each error, or the general FAQ.