Skip to Content
NexPDF

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.

English

NexPDF for Swift is a Swift package with two products:

  • NexPdf is the API. Every function of the C ABI is a method of NexPdfDocument or a static function of NexPdf, generated from nexpdf.h. Options and results are the same JSON strings as in every NexPDF SDK. It also has NexPdfSync, a client for real-time collaboration.
  • NexPdfUI is 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

PlatformsiOS 15 or later (iPhone and iPad), macOS 13 or later
Swift5.9
NexPdfUIiOS only
EngineNexPdfCore.xcframework: iOS devices (arm64), the simulator (arm64, x86_64) and macOS (arm64)

How it works

  • NexPdfDocument wraps a native document handle and frees it when the object is released.
  • Every failing call throws NexPdfError. Its message is the engine's error, and isLicense is true when the message is about the license.
  • Methods whose name ends in Json return 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).
  • NexPdfDocument is not thread-safe. Use one document from one queue at a time, or work on a copy().

Getting started

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.

Help and reference

On this page