---
title: "iOS PDF text extraction library — Extract text from PDFs | Nutrient"
canonical_url: "https://www.nutrient.io/guides/ios/features/text-extraction/"
md_url: "https://www.nutrient.io/guides/ios/features/text-extraction.md"
last_updated: "2026-06-09T00:00:00.000Z"
description: "Learn to extract the full text content from a PDF page or an entire PDF document. for Nutrient iOS SDK."
---

# Extract text from PDFs on iOS

This guide shows how to extract the full text content from a PDF page or an entire PDF document. If a page is scanned or image-based, [recognize its text with OCR](https://www.nutrient.io/guides/ios/ocr/overview.md) first so it can be extracted.

If you need more granular control over text extraction, you can refer to our [parsing](https://www.nutrient.io/guides/ios/extraction/parse-content.md) guide, which outlines the available text APIs in greater detail.

## Page text

Nutrient’s [`TextParser`](https://www.nutrient.io/api/ios/documentation/pspdfkit/textparser) class offers a convenient API to get the [`text`](https://www.nutrient.io/api/ios/documentation/pspdfkit/textparser/text) of a given PDF page.

The code below will print out the text content of the first page of a PDF document:

```swift

let document =...

// Access text parser for the first page and obtain the complete page text.
guard let parser = document.textParserForPage(at: 0) else {
    print("Text parsing failed.")
    return
}

// Do something with the text.
print(parser.text)

```

## Document text

You can use the same [`text`](https://www.nutrient.io/api/ios/documentation/pspdfkit/textparser/text) API to obtain the textual contents of the entire document.

Note that text parsing can be expensive, especially for larger documents. For best results, invoke parsing on a background thread:

```swift

let document =...

// Spin off a background task to not block the main thread.
DispatchQueue.global(qos:.utility).async {
    // Iterate over all pages and obtain the page text.
    let content: [String] = (0...document.pageCount).compactMap {
        guard let parser = document.textParserForPage(at: $0) else {
            print("Text parsing failed for page \($0).")
            return nil
        }
        return parser.text
    }

    // Do something with the text.
    print(content.joined(separator: "\n"))
}

```

## Reader View

Nutrient also offers a built-in UI for viewing the textual content of a PDF in an easy-to-read, single-column view that’s optimized for mobile devices. To learn more about this component, check out the [Reader View](https://www.nutrient.io/guides/ios/features/reader-view.md) guide.
---

## Related pages

- [Extract images from PDFs on iOS](/guides/ios/extraction/image-extraction.md)
- [PDF extraction library for iOS](/guides/ios/extraction.md)
- [Extract metadata from PDFs on iOS](/guides/ios/extraction/metadata.md)
- [Extract pages from PDFs on iOS](/guides/ios/extraction/page-extraction.md)
- [Parse PDF content on iOS](/guides/ios/extraction/parse-content.md)
- [Extract selected text from PDFs on iOS](/guides/ios/extraction/selected-text.md)
- [Extract the text position from PDFs on iOS](/guides/ios/extraction/text-position.md)

