NexPDF for iOS (Swift)
Render, extract, annotate, fill, edit, convert, sign and redact PDFs in iOS and macOS apps with the NexPDF Swift package and its ready-made SwiftUI reader.
NexPDF for Swift is a Swift package with two products:
NexPdfis the API. Every function of the C ABI is a method ofNexPdfDocumentor a static function ofNexPdf, generated fromnexpdf.h. Options and results are the same JSON strings as in every NexPDF SDK. It also hasNexPdfSync, a client for real-time collaboration.NexPdfUIis the ready-made SwiftUI reader (iOS only), configured with the shared UI configuration. See Reader.
The engine ships as NexPdfCore.xcframework, a static library linked into your app.
import NexPdf
let doc = try NexPdfDocument.open(url: fileURL)
print(doc.pages, doc.pageSize(0))
let text = try doc.extractPageText(pageIndex: 0)Requirements
| Platforms | iOS 15 or later (iPhone and iPad), macOS 13 or later |
| Swift | 5.9 |
NexPdfUI | iOS only |
| Engine | NexPdfCore.xcframework: iOS devices (arm64), the simulator (arm64, x86_64) and macOS (arm64) |
How it works
NexPdfDocumentwraps a native document handle and frees it when the object is released.- Every failing call throws
NexPdfError. Itsmessageis the engine's error, andisLicenseistruewhen the message is about the license. - Methods whose name ends in
Jsonreturn JSON text.NexPdf.json(_:)parses it into Foundation objects. - Page indices start at 0. Coordinates are PDF points with the origin at the bottom-left of the
page (
llx, lly, urx, ury). NexPdfDocumentis not thread-safe. Use one document from one queue at a time, or work on acopy().
Getting started
Installation
Swift Package Manager and CocoaPods.
Your first document
Open a PDF, render a page and extract its text.
Add your license key
Activate a key and handle license errors.
Running without a key
View-only mode, the watermark and trial keys.
Reader
The ready-made SwiftUI and UIKit reader.
Guides
Opening and saving
Files, Data, 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, 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
The NexPdfSync client: pages, annotations, comments, form values and bookmarks.
Editing
Merge, split, reorder, crop; edit text and images.
Compare and optimise
Diff versions, shrink files, control 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.