NexPDF for React Native
View, annotate, fill, sign, redact, OCR and convert PDFs on the device in React Native apps for iOS and Android, with the NexPDF engine and its ready-made reader.
NexPDF for React Native (@nexdevit/nexpdf-react-native) runs the whole NexPDF engine on the device,
on iOS and Android. It has two parts:
- The SDK:
NexPdfandPdfDocumentgive you every function of the C SDK from JavaScript. - The reader:
NexPdfReaderpresents the ready-made NexPDF reader screen, the same one as in the iOS and Android SDKs. See Reader.
import { NexPdf } from '@nexdevit/nexpdf-react-native';
const doc = await NexPdf.open(base64Pdf);
console.log(await doc.pageCount(), await doc.pageSize(0));
console.log(await doc.extractPageText(0));
const png = await doc.renderPage(0, 150); // base64 PNG
await doc.close();Requirements
| React Native | 0.72 or later |
| iOS | 15.0 or later, with the NexPdf and NexPdfUI pods |
| Android | minSdk 24, with the NexPDF Android SDK (com.nexdevit:nexpdf-android) |
How it works
- One native method,
invoke(json), calls the engine on a background serial queue, so calls never block the JavaScript thread. Every method returns aPromise. - Every function of the C SDK is a method of
PdfDocument(for functions that take a document) or ofNexPdf.api, named in camelCase. Options and results are the same JSON strings as in every NexPDF SDK. Helpers such asannotations(),search()andrunOcr()parse them for you. - Byte buffers (PDF, PNG, DOCX, P12 files) travel as base64 strings.
- A failed call rejects with
NexPdfError, whoselicenseproperty istruewhen the message is about the license. - Close each document with
await doc.close()when you are done with it.
Getting started
Installation
Add the package, the Android AAR and the iOS pods.
Your first document
Open a PDF, render a page and extract text.
Add your license key
Activate your key for your bundle id and package name.
Running without a key
View-only mode, the watermark and trial keys.
Reader
Present the ready-made reader screen.
Guides
Opening and saving
Base64 input, passwords, pictures, HTML and Office input.
Rendering
Pages and thumbnails to PNG, coordinates.
Document structure
Metadata, bookmarks, page labels, layers, attachments.
Text extraction
Text, Markdown, positioned blocks, passages for LLMs.
Search
Find text and its rectangles.
OCR
Make scanned pages searchable on the device, in any script.
Structured extraction
Tables, key-values, schema extraction with your LLM, classification.
Barcodes
Read QR, Data Matrix, PDF417 and linear codes; draw barcodes.
Annotations
Markup, shapes, ink, stamps, measurements, XFDF.
Forms
Fill, create, calculate, flatten, import and export.
XFA forms
Run FormCalc and JavaScript, lay out dynamic forms, convert to AcroForm, flatten.
Comment threads
Replies and review states on annotations.
Real-time collaboration
Sync pages, annotations, comments, form values and bookmarks.
Editing
Merge, split, reorder, crop; edit text and images.
Compare and optimise
Diff versions, shrink files, watch memory.
Word-level comparison
Inserted, deleted, replaced and moved text; annotated PDF.
Security
Encryption, permissions, watermarks, Bates numbers.
Redaction
Remove content for good by area, text or pattern.
Signatures
PAdES signing, external signers, verification.
Long-term signatures
PAdES B-LTA, document and archive timestamps.
Conversion
PDF to Word, Excel, PowerPoint, HTML and more.
Templates
PDFs from Word, HTML and PDF templates and JSON data.
PDF/A, PDF/X and PDF/UA
Archiving, print and accessibility.
PDF/A and PDF/UA validation
PDF/A and PDF/UA-1 and -2 with clause ids; convert to PDF/A or PDF/UA.