PDFium Delphi Component Docs

CharacterIndexAtPos Méthode

Composant: TPdfView  ·  Unit: PDFium
Renvoie l’index du caractère le plus proche du pixel écran (X, Y) sur la page courante, ou -1 si aucun caractère n’est assez proche

Syntaxe

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

Description

Renvoie l’index du caractère le plus proche du pixel écran (X, Y) sur la page courante, ou -1 si aucun caractère n’est assez proche

Utilisez dans OnMouseDown pour initier la sélection de texte

TPdfView maintient en interne la transformation device-to-page à partir de Zoom, Rotation, de la marge de page et du défilement; ces assistants constituent l’interface publique sûre vers cette transformation

Remarques

Exemple

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;

Voir aussi

DeviceToPage, CurrentCharIndex, CharacterCount