Skip to main content

Create a .NET 8 or newer console project and add the package:

Place a text-bearing PDF named document.pdf in the project directory. Replace Program.cs with:

Run dotnet run. The output contains extracted text and chunks with their source pages. PageNumbers uses one-based page numbers. FullText includes heading context when available.

PdfExtractor is not disposable in this package version. File and PDF errors propagate to the caller in this minimal example. For a service, handle errors at the request boundary and apply input limits appropriate to the workload.

This example reads the entire file into memory and performs both extraction operations. It is not a streaming example. Text extraction needs a text layer; scanned pages need OCR.