PDFium Delphi Component Docs

CharacterIndexAtPos Método

Componente: TPdfView  ·  Unidad: PDFium
Devuelve el índice de carácter de la página actual más cercano al píxel de pantalla (X, Y), o -1 si ningún carácter está lo bastante cerca

Sintaxis

function CharacterIndexAtPos(X, Y: Integer; ToleranceX, ToleranceY: Double): Integer;

Descripción

Devuelve el índice de carácter de la página actual más cercano al píxel de pantalla (X, Y), o -1 si ningún carácter está lo bastante cerca

Use in OnMouseDown to initiate text selection

TPdfView mantiene internamente la transformación dispositivo-página en función de Zoom, Rotation, el padding de página y el offset de scroll; estos helpers son la interfaz pública segura de esa transformación

Observaciones

Ejemplo

procedure TForm1.PdfView1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  PageX, PageY: Double;
begin
  if PdfView1.CharacterIndexAtPos(X, Y, PageX, PageY) then
    Caption := Format('pt = (%.2f, %.2f)', [PageX, PageY]);
end;

Véase también

DeviceToPage, CurrentCharIndex, CharacterCount