ImageEn, unit iexPdfiumCore

TPdfObjectList.AddRect

TPdfObjectList.AddRect


Declaration

function AddRect(X, Y, Width, Height: Single): TPdfObject;


Description

Adds a rectangle object to the current page at the specified position (in terms of PDF points).

Note: PDF pages are specified Bottom-Up, i.e. Y=0 refers to the bottom of the page/screen. Y=PageHeight refers to the top of the page/screen


Example

const
  Rect_Width   = 150;
  Rect_Height  = 100;
  Rect_Color   = clGreen;
  Rect_Border  = 3;
  Rect_Fill    = clYellow;
  Rect_Opacity = 255;
var
  obj: TPdfObject;
begin
  obj := ImageEnView1.PdfViewer.Objects.AddRect( 100, 800, Rect_Width, Rect_Height );

  obj.StrokeColor := TColor2TRGBA( Rect_Color, 255 );
  obj.PathStrokeWidth := Rect_Border;
  obj.FillColor := TColor2TRGBA( Rect_Fill, Rect_Opacity );
  obj.PathFillMode := pfAlternate;

  ImageEnView1.Invalidate();
end;