Table of Contents

Class PdfTextExtractor

Namespace
MiPdf.Text
Assembly
MiPdf.dll

Extracts text, words and their positions from pages.

public static class PdfTextExtractor
Inheritance
PdfTextExtractor
Inherited Members

Methods

ExtractLines(PdfPage, TextExtractionOptions?)

Returns the lines of a page with words and positions.

public static IReadOnlyList<TextLineInfo> ExtractLines(PdfPage page, TextExtractionOptions? options = null)

Parameters

page PdfPage
options TextExtractionOptions

Returns

IReadOnlyList<TextLineInfo>

ExtractText(PdfDocument, TextExtractionOptions?)

Returns the text of all pages separated by form feeds ('\f').

public static string ExtractText(PdfDocument document, TextExtractionOptions? options = null)

Parameters

document PdfDocument
options TextExtractionOptions

Returns

string

ExtractText(PdfPage, TextExtractionOptions?)

Returns the text of a page; lines are separated by '\n'.

public static string ExtractText(PdfPage page, TextExtractionOptions? options = null)

Parameters

page PdfPage
options TextExtractionOptions

Returns

string

ExtractWords(PdfPage, TextExtractionOptions?)

Returns all words of a page with their bounding boxes.

public static IReadOnlyList<TextWord> ExtractWords(PdfPage page, TextExtractionOptions? options = null)

Parameters

page PdfPage
options TextExtractionOptions

Returns

IReadOnlyList<TextWord>

FindText(PdfPage, string, StringComparison)

Finds all occurrences of search on a page (within a line) and returns their bounding boxes, e.g. to place a signature or stamp at a placeholder text.

public static IReadOnlyList<PdfRectangle> FindText(PdfPage page, string search, StringComparison comparison = StringComparison.Ordinal)

Parameters

page PdfPage
search string
comparison StringComparison

Returns

IReadOnlyList<PdfRectangle>

FindText(PdfPage, Regex)

Returns the bounds of all matches of pattern (matched per text line), e.g. IBANs or e-mail addresses.

public static IReadOnlyList<PdfRectangle> FindText(PdfPage page, Regex pattern)

Parameters

page PdfPage
pattern Regex

Returns

IReadOnlyList<PdfRectangle>