Nigel
I was not resetting the MemoryStream.
a) If I add tempMemoryStream.Position := 0; , the scanned images do display in the ImageEnMView. However, the first scanned image is repeated in the ImageEnMView.
procedure TformPDFBuilder.AddPage;
.... existing code in demo
ImageEnView1.IO.SaveToStreamJpeg(tempMemoryStream);
tempMemoryStream.Position := 0;
ImageEnMView1.AppendImage(tempMemoryStream);
end;
b) If I change the AddPage code to the following, the scanned images correctly display in the ImageEnMView component.
procedure TformPDFBuilder.AddPage;
var
tempidx: Integer;
begin
// existing code
tempImageCount := tempImageCount + 1;
ImageEnView1.IO.SaveToStreamJpeg(tempMemoryStream);
tempMemoryStream.Position := 0;
tempidx := ImageEnMView1.AppendImage;
ImageEnMView1.SetImage(tempidx, ImageEnView1.Bitmap);
end;
c) However (as you can see from the above image), if I try to reload an existing image from the ImageInMView back into the ImageEnView with the following code in the ImageEnMView.OnImageSelect event, it does not work.
procedure TformPDFBuilder.ImageEnMView1ImageSelect(Sender: TObject; idx: Integer);
begin
ImageEnView1.Clear;
tempMemoryStream.Position := idx;
ImageEnView1.IO.LoadFromStreamJpeg(tempMemoryStream);
end;
I suspect the reloading problem relates to the fact that I am using a stream and not files, because "ImageEnView1.IO.LoadFromFile(ImageEnMView1.ImageFileName[idx]);" works for files.
Suggestions?
TIA
John
Manarsoft
The code above and that from the initial post is the only code I added to the ImageEn PDFBuilder demo to illustrate the problem.