Discussion:
Code based reports or designer
(too old to reply)
Hubert Rétif
2007-07-03 14:56:05 UTC
Permalink
Hi,

Using D7 with rave 5.0.8

I am evaluating which is the best method for my needs (one page with some
JPEG fotos and a few data elements).

I can generate something simple, produced with the designer.

Now I am trying with code based:

procedure TfmMain.RvSystem1Print(Sender: TObject);
var
jpeg : TJPEGImage;
strm : TMemoryStream;
begin
with (Sender as TBaseReport) do
begin
SetFont('Arial', 15);
FontColor := clRed;
PrintXY(0.5,0.5, 'Just look at the images!');
strm := TMemoryStream.Create;
jpeg := TJPEGImage.Create;
try
jpeg.LoadFromFile('images\233\IMG_2986.JPG');
jpeg.SaveToStream(strm);
strm.Position := 0;
PrintImageRect(3,1,1,1, strm,'JPG');
PrintImageRect(1,2,3,3, strm,'JPG');
finally
jpeg.Free;
strm.Free;
end;
end;
end;

When executing it, I get the error message "unexpected code [47] found in
report file"

What did I wrong?

Thanks,
Hubert Retif
Eldon Lewis
2007-07-03 17:24:25 UTC
Permalink
You will need to define an OnDecodeImage event that will take the image and
convert it to a bitmap.

There is a tip and trick that shows how to do this out on our web site.

http://tinyurl.com/zmlbe

Eldon Lewis
Nevrona Designs
Post by Hubert Rétif
Hi,
Using D7 with rave 5.0.8
I am evaluating which is the best method for my needs (one page with some
JPEG fotos and a few data elements).
I can generate something simple, produced with the designer.
procedure TfmMain.RvSystem1Print(Sender: TObject);
var
jpeg : TJPEGImage;
strm : TMemoryStream;
begin
with (Sender as TBaseReport) do
begin
SetFont('Arial', 15);
FontColor := clRed;
PrintXY(0.5,0.5, 'Just look at the images!');
strm := TMemoryStream.Create;
jpeg := TJPEGImage.Create;
try
jpeg.LoadFromFile('images\233\IMG_2986.JPG');
jpeg.SaveToStream(strm);
strm.Position := 0;
PrintImageRect(3,1,1,1, strm,'JPG');
PrintImageRect(1,2,3,3, strm,'JPG');
finally
jpeg.Free;
strm.Free;
end;
end;
end;
When executing it, I get the error message "unexpected code [47] found in
report file"
What did I wrong?
Thanks,
Hubert Retif
Hubert Rétif
2007-07-03 18:34:59 UTC
Permalink
Thanks a lot Eldon.
Post by Eldon Lewis
You will need to define an OnDecodeImage event that will take the image
and convert it to a bitmap.
There is a tip and trick that shows how to do this out on our web site.
http://tinyurl.com/zmlbe
Eldon Lewis
Nevrona Designs
Post by Hubert Rétif
Hi,
Using D7 with rave 5.0.8
I am evaluating which is the best method for my needs (one page with some
JPEG fotos and a few data elements).
I can generate something simple, produced with the designer.
procedure TfmMain.RvSystem1Print(Sender: TObject);
var
jpeg : TJPEGImage;
strm : TMemoryStream;
begin
with (Sender as TBaseReport) do
begin
SetFont('Arial', 15);
FontColor := clRed;
PrintXY(0.5,0.5, 'Just look at the images!');
strm := TMemoryStream.Create;
jpeg := TJPEGImage.Create;
try
jpeg.LoadFromFile('images\233\IMG_2986.JPG');
jpeg.SaveToStream(strm);
strm.Position := 0;
PrintImageRect(3,1,1,1, strm,'JPG');
PrintImageRect(1,2,3,3, strm,'JPG');
finally
jpeg.Free;
strm.Free;
end;
end;
end;
When executing it, I get the error message "unexpected code [47] found in
report file"
What did I wrong?
Thanks,
Hubert Retif
Loading...