What lies where on a page: the boxes of its shown character codes with their Unicode text in content order, the areas its images and paths paint, and its link regions, queried by point and by rectangle in page space, so a viewer maps a click or a drag to content (text selection, link activation). Built from a display list with CreateHitTestIndex(), or with a page's links by CreateHitTestIndex().
public sealed class HitTestIndex
Viewer capability 4 (the display list is what hit-testing reads). Page space is default user space (ISO 32000-2
§8.3.2.3), the space the display list and annotation rectangles are in, before the crop box, rotation and user unit: a viewer maps
a device point into it through the inverse of the transform it renders with (for the software rasterizer,
RenderOptions.GetDeviceTransform). Glyph boxes follow §9.4.4 and §9.8.1 (HitTestGlyph), image and path areas
§8.9.4, §8.5.3 and §8.5.4 (HitTestShape), link regions §12.5.6.5 (HitTestLink).
The items are bucketed on a uniform grid over the page when the index is built, a fixed number of arrays per page; a query by
point visits one cell, so it costs the few items there, and no query allocates. Matches come in order of kind (glyphs, images,
paths, links) and, within a kind, in content order: for glyphs the order they were shown, for images and paths the order they
were painted (the last one painted is on top), for links the order of the page's Annots array. Glyphs and links are not
cut by the clip.
Immutable once built: any number of threads may query it at once.
kind:method, kind:property, kind:ctor. Press Esc to clear.GlyphCountGets the number of glyphs: every character code shown, in content order.ImagesGets the image and stencil-mask paints, in paint order.LinksGets the page's visible link annotations, in Annots order; empty for an index built from a display list alone.PathsGets the path fills and strokes (colour or shading pattern), in paint order.TextGets the Unicode text of every glyph, in content order; each glyph owns the range TextStart, TextLength.Find(PathPoint, HitTestKinds)Finds the items of the given kinds that contain a point.Find(PdfRectangle, HitTestKinds)Finds the items of the given kinds that share a point with a rectangle.GetGlyph(Int32)Gets a glyph.GetGlyphText(in HitTestGlyph)Gets the Unicode text of a glyph.