Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

PdfPageInteractionMap

OfficeIMO.Pdf

Namespace
OfficeIMO.Pdf
Assembly
OfficeIMO.Pdf
Source revision
be6c300e4ab1 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

Remarks

Visual coordinates are numeric physical points (1/72 inch), with a top-left origin after crop, rotation and /UserUnit scaling. Use the page coordinate mapping methods when calling native read/edit APIs.

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, int pageNumber, PdfPageInteractionOptions? options = null, PdfLoadOptions? readOptions = null) #

Builds an interaction map from PDF bytes.

Parameters

pdf byte[] required
pageNumber int required
options OfficeIMO.Pdf.PdfPageInteractionOptions? = null optional
readOptions OfficeIMO.Pdf.PdfLoadOptions? = null optional
public string GetSelectedText(double x1, double y1, double x2, double y2) #

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 double required
y1 double required
x2 double required
y2 double required

Returns

string
public static PdfTextBreak GetTextBreak(PdfPageInteractionRegion previous, PdfPageInteractionRegion next) #

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 required
next OfficeIMO.Pdf.PdfPageInteractionRegion required
public IReadOnlyList<PdfPageInteractionRegion> HitTest(double x, double y, double tolerance = 0) #

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

Parameters

x double required
y double required
tolerance double = 0 optional

Returns

IReadOnlyList<PdfPageInteractionRegion>
public IReadOnlyList<PdfPageInteractionRegion> SelectText(double x1, double y1, double x2, double y2) #

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

Parameters

x1 double required
y1 double required
x2 double required
y2 double required

Returns

IReadOnlyList<PdfPageInteractionRegion>
public IReadOnlyList<PdfPageInteractionRegion> SelectWord(double x, double y, double tolerance = 0) #

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

Parameters

x double required
y double required
tolerance double = 0 optional

Returns

IReadOnlyList<PdfPageInteractionRegion>

Properties

public int 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.