R – Printing image in Rave Reports

delphirave-reports

I have an application being developed in Delphi 2009 and Rave Reports. I would like to have an image printed in the reports. How am I going to implement this?

Any suggestion would be very much appreciated.

Best Answer

Use the Draw(X, Y: Double; Graphic: TGraphic); method of a TBaseReport descendant, unless you're drawing a bitmap. In that case, use TBaseReport.PrintBitmap(X, Y: Double; ScaleX, ScaleY: Double; Bitmap: TBitmap); or PrintBitmapRect(X1, Y1, X2, Y2: Double; Bitmap: TBitmap);

Draw() is documented in the D2009 help file in ms-help://embarcadero.rs2009/Rave/draw.htm

var   
  MyLogo: TGraphic;
begin
  MyLogo := TMetafile.Create;
  try
    MyLogo.LoadFromFile('MYLOGO.WMF');
    RvNDRWriter1.Draw(1.0,2.0,MyLogo);
  finally
    MyLogo.Free;
  end; { tryf }
end;

You can find an example of PrintBitmap in the Delphi 2009 help file, topic ms-help://embarcadero.rs2009/Rave/printbitmap.htm - there's a link on that page for PrintBitmapRect().

// Print MyBitmap in upper left corner four times its size
RvNDRWriter1.PrintBitmap( 1.0, 1.0, 2.0, 2.0, MyBitmap );
Related Topic