PDFium Component Docs

Rectangle property

Component: TPdf  ·  Unit: PDFium
یک مستطیل مرزی متن را از چیدمان متن صفحهٔ جاری برمی‌گرداند

Syntax

property Rectangle[Index: Integer]: TPdfRectangle; // read only

Description

Rectangle[Index] returns one bounding rectangle generated by RectangleCount for text on the current page.

Call RectangleCount(StartIndex, Count) first to determine how many rectangles PDFium exposes for the requested text range, then read Rectangle[0] through Rectangle[Count - 1].

The returned TPdfRectangle uses PDF page coordinates. Use PageToDevice when you need viewer or bitmap coordinates.

Remarks

Example

var
  I, Count: Integer;
  R: TPdfRectangle;
begin
  Count := Pdf1.RectangleCount(0, Pdf1.CharacterCount);
  for I := 0 to Count - 1 do
  begin
    R := Pdf1.Rectangle[I];
    Memo1.Lines.Add(Format('%.2f, %.2f, %.2f, %.2f', [R.Left, R.Top, R.Right, R.Bottom]));
  end;
end;

See Also

RectangleCount, Text, TextInRectangle, PageToDevice