THPDFViewer Highlights and Marquee Selection
Marks page regions without changing the PDF and converts interactive selections to PDF page coordinates
Declarations
function THPDFViewerModel.AddHighlightRegion(PageIndex: Integer; const PageRect: THPDFRectangle; Color: TColor= clYellow): Integer;
function THPDFViewerModel.RemoveHighlightRegion(Index: Integer): boolean;
procedure THPDFViewerModel.ClearHighlightRegions;Programmatic highlights
Region.Left:= 72;
Region.Bottom:= 540;
Region.Right:= 240;
Region.Top:= 600;
HighlightIndex:= Viewer.HighlightRegion(0, Region, clLime);
Interactive selection
Viewer.InteractionMode:= vimHighlight;
Viewer.HighlightColor:= clYellow;
Viewer.OnMarqueeSelect:= ViewerMarqueeSelect;
Usage notes
- Page indexes are zero based and rectangles use PDF page coordinates
- Input rectangles are normalised and clipped to the page MediaBox
- Highlights are Viewer state only and do not modify or save into the PDF
- Each successful addition returns its current list index; invalid or empty regions return -1
vimHighlightcaptures a left-button drag, draws a temporary outline, stores the completed region, and raisesOnMarqueeSelect- Marquee coordinates account for page rotation, Viewer rotation, zoom, and fit modes
- Assigning another document clears all existing highlights