Skip to Content
NexPDF

Platform notes

UI thread and background work, memory, app size and deployment notes for NexPDF for .NET MAUI on Android, iOS, Mac Catalyst and Windows.

English

UI thread and background work

  • Every engine call is synchronous and blocks the thread that makes it. Rendering a page, converting, OCR, signing or optimising can take long enough to freeze the UI, so run them with await Task.Run(...) and update the UI after the await.
  • PdfView already works in the background: LoadAsync opens the document and reads the page sizes on a worker thread, and pages are rendered on a worker thread and handed to the UI thread. LoadFailed and PageChanged arrive on the UI thread in normal use.
var doc = view.Document!;
var markdown = await Task.Run(() => doc.ToMarkdown());   // off the UI thread
NotesEditor.Text = markdown;                             // back on the UI thread

Threading

  • A NexPdfDocument is not thread-safe. Use each document from one thread at a time.
  • PdfView renders view.Document on a worker thread with a lock your calls do not take. A call you make on view.Document while the view is rendering can overlap it. For long work, use your own NexPdfDocument opened from the same bytes and hand the result to LoadAsync; see PdfView.
  • Different documents can be used on different threads at the same time. The state shared between documents (the license and the renderer's caches) is thread-safe.
  • The license is process-wide: activate it once, in MauiProgram.CreateMauiApp.
  • Errors are tracked per thread, so an error on one thread never leaks into another.

Memory

  • A document is read fully into memory when it is opened. Budget roughly the file size plus the decoded pages you touch, and check the size of files users pick before loading very large ones on phones.
  • PdfView keeps the PNGs of the pages near the current one and drops the others, so scrolling a long document does not keep every page in memory.
  • The renderer keeps process-wide caches of parsed fonts, glyphs and decoded images, shared by every document. Each cache is bounded by size and drops its least recently used entries first; together they can hold up to about 1.3 GB in a process that renders many large, image-heavy files. There is no call to make them smaller.
  • doc.MemoryUsageBytes() estimates what a document uses, and doc.TrimMemory() compacts its buffers and returns the bytes reclaimed; see Compare and optimise.
  • Dispose what you no longer need: PdfView.Dispose() frees the view's document, and every NexPdfDocument you open yourself belongs in a using.

App size

  • Android: a copy of libnexpdf_ffi.so is added for each ABI found under native/android/jni/, so each ABI adds a full engine to the APK. Keep only the ABIs you ship (for example arm64-v8a, plus x86_64 for emulators), or publish an Android App Bundle so each device downloads one ABI.
  • iOS and Mac Catalyst: the engine is linked statically from NexPdfCore.xcframework into the app binary; there is no separate library file to ship.
  • Windows: nexpdf_ffi.dll (x64) is copied next to the app, about 20 MB.
  • The default engine compiles in the Liberation fonts (about 4 MB) used for non-embedded standard fonts and PDF/A. NexPdfSdk.HasBundledFonts() tells you which build you have.

Files on the device

NexPdfDocument.Open(path) and Save(path) read and write real files. Files bundled in Resources/Raw are not files on Android, so read them as bytes with FileSystem.OpenAppPackageFileAsync and use OpenBytes or LoadAsync. Write output to FileSystem.AppDataDirectory or FileSystem.CacheDirectory; see Opening and saving.

Licensing per platform

NexPdfEngine.Platform is the platform id the key must list on the current device: ios on iOS and Mac Catalyst, android on Android, windows on Windows. The app id is your bundle id or package name. See License.

Network

The engine makes no network calls of its own: license keys are verified offline and documents never leave the device. Only signing options you set (tsa_url for a timestamp, ltv for OCSP and CRL lookups) and NexPdfSdk.AddLtv contact the servers named in the certificates.

On this page