Troubleshooting
Fixes for the most common problems with NexPDF for React Native - the native module not linking, Android and iOS build errors, license and watermark issues, fonts, signatures, OCR in other scripts, XFA, PDF/A validation and memory.
The JavaScript package is installed but the native module is not in the app binary. The package has native code, so a Metro reload is not enough:
- rebuild the app (
npx react-native run-androidorrun-ios); - on iOS, run
pod installinios/after adding theNexPdfandNexPdfUIpods; - Expo Go cannot load the module, because it only runs the native code built into Expo Go. Use a development build of your app.
See Installation.
The module depends on the NexPDF Android SDK of the same version as the package
(com.nexdevit:nexpdf-android:1.1.0 for the 1.1.0 package). Gradle looks for it in mavenLocal()
and in the android/maven folder next to the package. Unzip the matching
nexpdf-android-<version>-maven.zip into ~/.m2/repository, or include the Android SDK source as
a :nexpdf-android project in settings.gradle.
The engine library for the device's ABI is missing from the APK. The AAR has arm64-v8a,
armeabi-v7a and x86_64 libraries; a 32-bit x86 emulator has none, so use an x86_64 or
arm64 emulator image. If you set abiFilters in your app, keep the device's ABI in the list.
The module's podspec depends on NexPdfUI, which is not on the CocoaPods trunk. Add both pods with
their local path to ios/Podfile, then run pod install again:
pod 'NexPdf', :path => '../nexpdf-swift'
pod 'NexPdfUI', :path => '../nexpdf-swift'If the link step then fails with undefined nexpdf_ symbols, NexPdfCore.xcframework is missing
from that folder: unzip NexPdfCore.xcframework.zip into it.
Check what await NexPdf.licenseStatus() returns:
unlicensed:activateLicensewas never called in this app launch, or it rejected. Call it at start-up, before the first render, and log the rejection.trial: trial keys always keep the "NexPDF • Trial" watermark.licensed: commercial keys render without a watermark. If you still see one, the image is an old render you cached or stored.
The reader shares the same license, so the same check applies to it.
The key does not list the platform or the app id you passed. The SDK passes ios or android
from Platform.OS; the app id must be the iOS bundle id or the Android package name, character for
character. Debug builds with an applicationIdSuffix (for example .debug) have a different
package name from the release build. You can change both in the dashboard and
download a re-signed key.
The device clock is earlier than the key's issue date. Set the date and time to automatic and activate again.
Your plan does not include that module. See Modules and tiers for which
plan unlocks it, and check licenseStatus().modules to hide the feature.
The PDF uses a standard font (Helvetica, Times, Courier) without embedding it. The default engine
bundles the Liberation fonts as substitutes. If await NexPdf.api.hasBundledFonts() returns 0,
register them yourself, as base64 TrueType files:
for (const ttfBase64 of [sansBase64, serifBase64, monoBase64]) {
await NexPdf.api.registerStandardFont(ttfBase64);
}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.
sign and signPkcs12 resolve to the complete signed file as base64. Write that string to disk
unchanged. Calling saveBytes() on the document afterwards rewrites the file and invalidates the
signature. See Signatures.
Phones have no Tesseract program, so engine: 'auto' uses the built-in engine unless a neural
model loaded with NexPdf.api.ocrLoadModel reads the requested languages. engine: 'tesseract'
fails on iOS and Android.
The built-in engine reads Latin-script text only. Load a detection model and a recognition model
for the script with NexPdf.api.ocrLoadModel before calling runOcr, and pass matching
languages. NexPdf.api.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 error lists
their clauses. Run validatePdfaJson(level) to see each failure with its page and object. See
PDF/A and PDF/UA validation.
Byte buffers cross the bridge as base64 inside a JSON string. Building and parsing that string runs
on the JavaScript thread, and a large file is copied several times on the way. Keep documents open
and call methods on them instead of re-opening, render at the size you display, and avoid
saveBytes() after every edit. See Platform notes.
Every call runs on one background thread, one at a time, in the order you made them. A long OCR or conversion delays later calls, renders included, even on other documents. See Platform notes.
Documents are freed only by close(): there is no finalizer, and reloading the JavaScript bundle
does not free the documents the previous bundle opened. Close every document in a finally block,
and call trimMemory() on a document you keep open and edit for a long time. Loaded OCR models
stay in memory until NexPdf.api.ocrUnloadModels. See
Platform notes.
Still stuck? Check Error handling for the meaning of each error, or the general FAQ.