Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/

API Reference

Class

PdfPageInteractionMap

Namespace OfficeIMO.Pdf
Assembly OfficeIMO.Pdf
Source revision 33d062b583cb with working tree changes
Modifiers sealed

Dependency-free text-selection and hit-test projection for one rendered PDF page. Coordinates use the visual page's top-left origin after CropBox and page rotation are applied.

Inheritance

  • Object
  • PdfPageInteractionMap

Usage

Explore 4 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Methods

public static PdfPageInteractionMap Create(Byte[] pdf, Int32 pageNumber, PdfPageInteractionOptions? options = null, PdfLoadOptions? readOptions = null) #
Returns: PdfPageInteractionMap

Builds an interaction map from PDF bytes.

Parameters

pdf System.Byte[] requiredposition: 0
pageNumber System.Int32 requiredposition: 1
options OfficeIMO.Pdf.PdfPageInteractionOptions? = null optionalposition: 2
readOptions OfficeIMO.Pdf.PdfLoadOptions? = null optionalposition: 3
public String GetSelectedText(Double x1, Double y1, Double x2, Double y2) #
Returns: String

Joins selected text elements in extraction order, with a space across a gap between words and a line break between lines where the text does not already contain one.

Parameters

x1 System.Double requiredposition: 0
y1 System.Double requiredposition: 1
x2 System.Double requiredposition: 2
y2 System.Double requiredposition: 3
public static PdfTextBreak GetTextBreak(PdfPageInteractionRegion previous, PdfPageInteractionRegion next) #
Returns: PdfTextBreak

Classifies how next follows previous: touching, after a gap on the same line, or on another line. Words written as separate runs without space characters, such as an OCR text layer, are separated by gaps rather than by text.

Parameters

previous OfficeIMO.Pdf.PdfPageInteractionRegion requiredposition: 0
next OfficeIMO.Pdf.PdfPageInteractionRegion requiredposition: 1
public IReadOnlyList<PdfPageInteractionRegion> HitTest(Double x, Double y, Double tolerance = 0) #
Returns: IReadOnlyList<PdfPageInteractionRegion>

Returns all regions containing a visual top-left page coordinate.

Parameters

x System.Double requiredposition: 0
y System.Double requiredposition: 1
tolerance System.Double = 0 optionalposition: 2
public IReadOnlyList<PdfPageInteractionRegion> SelectText(Double x1, Double y1, Double x2, Double y2) #
Returns: IReadOnlyList<PdfPageInteractionRegion>

Returns text elements whose quads intersect a visual top-left selection rectangle.

Parameters

x1 System.Double requiredposition: 0
y1 System.Double requiredposition: 1
x2 System.Double requiredposition: 2
y2 System.Double requiredposition: 3
public IReadOnlyList<PdfPageInteractionRegion> SelectWord(Double x, Double y, Double tolerance = 0) #
Returns: IReadOnlyList<PdfPageInteractionRegion>

Selects the contiguous non-whitespace text run at a visual page coordinate, without crossing a line or a gap between independent runs.

Parameters

x System.Double requiredposition: 0
y System.Double requiredposition: 1
tolerance System.Double = 0 optionalposition: 2

Properties

public Int32 PageNumber { get; } #

One-based page number.

public Double Width { get; } #

Visual page width in PDF points after page rotation.

public Double Height { get; } #

Visual page height in PDF points after page rotation.

public IReadOnlyList<PdfPageInteractionRegion> Regions { get; } #

All text, image, link, annotation, and form-widget regions.

public IReadOnlyList<PdfPageInteractionRegion> TextRegions { get; } #

Text-element regions in content extraction order.