Hi, i'm trying to put a picture from a database into a report using PictureStream.
I went through the reference manual but I can't get it to work, and the manual is pretty unclear to me about this.
I'm using Delphi and VPE Professional version 6
I came this far, no clue if i'm barking up the wrong tree or that's it's just a minor problem.
(this is not the actual code, it's just an example i tried to create)
Can you help me out ?
Procedure ImagePrint;
var
Blob : Tstream;
PictureStream : VPEStream;
VertPos : Double; // vertical position
Buffer : Tbytes;
begin
VertPos := 0.5;
Report.OpenDoc;
Report.License('VPE-xxxxx-xxxx', 'xxxx-xxxx'); // enable license
PictureStream := Report.CreateMemoryStream(64000); // picture should fit in 64k
Data.dbImage.First; // go to first record of database
while not Data.dbImage.Eof do // until end reached
begin
// fill the blob with the Picture;
Blob := Data.dbImage.CreateBlobStream(Data.dbImage.FieldByName('PICTURE'), bmread);
// ... problem code starts here
SetLength(Buffer, Blob.Size);
Blob.Read(Buffer, Blob.size);
PictureStream.Write(Buffer,Blob.Size);
// ... problem code ends here
// Put the picture in the document and give it the ID of the picture
Report.PictureStream(PictureStream,1,VertPos,6,VertPos+5,data.dbImage.FieldValues['CATID']);
VertPos := VerPos + 6;
end;
Report.Preview;
end;
Kind regards, Erik van Putten