PdfElixide.Document.SearchMatch (pdf_elixide v0.23.0)

Copy Markdown View Source

One occurrence of a pattern found by PdfElixide.Document.search/2, with its zero-based page index, the matched text, and where it sits on the page.

:spans are the runs of text the match touched, in reading order, each a whole PdfElixide.Document.Span rather than the extent of the matched characters: a match inside a longer run reports that whole run. :bbox is the union of their boxes. Draw from the spans' boxes, one per run.

On a rotated page, use each span's :rotation to identify its coordinate frame; a match's spans may use different frames. See Rotated pages and extracted geometry.

The Text search guide has the rest, including how far :bbox over-covers, why a match can cross what looks like a line break, and when the spans come back empty.

Summary

Types

t()

@type t() :: %PdfElixide.Document.SearchMatch{
  bbox: PdfElixide.Geometry.Rect.t(),
  page: non_neg_integer(),
  spans: [PdfElixide.Document.Span.t()],
  text: String.t()
}