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.
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.
I have the same problem with Rave Reports, it depends on what type of image you want to preview or print. If it's a WMF you can use what Ken White's example:
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;
but when using a BMP:
RvNDRWriter1.PrintBitmap( 1.0, 1.0, 2.0, 2.0, MyBitmap );
and when using JPEG IMAGE: you have to convert first the JPEG to BMP before using calling RvNDRWriter1.
Jpeg2bmp('temp.bmp',jpegfile);
pic1.picture.loadfromfile('temp.bmp');
pic1.Visible:=true;
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
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().