Click or drag to resize
Pdf Library for .NET

TextPosition Class

The position of a piece of text found in a PDF document by Search(String).
Inheritance Hierarchy
SystemObject
  SelectPdf.UniversalTextPosition

Namespace: SelectPdf.Universal
Assembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.4
Syntax
public class TextPosition

The TextPosition type exposes the following members.

Constructors
 NameDescription
Public methodTextPosition 
Top
Properties
 NameDescription
Public propertyHeight Gets or sets the height of the text's bounding rectangle, in points.
Public propertyPageNumber Gets or sets the 1-based number of the page the text was found on (note PdfPageCollection is zero-based, so this maps to doc.Pages[PageNumber - 1]).
Public propertyWidth Gets or sets the width of the text's bounding rectangle, in points.
Public propertyX Gets or sets the X coordinate of the text's bounding rectangle, in points.
Public propertyY Gets or sets the Y coordinate of the text's bounding rectangle, in points.
Top
Example
PdfToText tool = new PdfToText();
tool.Load("document.pdf");
TextPosition[] hits = tool.Search("invoice");
foreach (TextPosition p in hits)
    System.Console.WriteLine("Found on page " + p.PageNumber +
        " at (" + p.X + ", " + p.Y + ")");
tool.Close();
See Also