ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Demo PDF Builder

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
John Posted - Feb 25 2015 : 14:33:37
Hello

I have added an ImageEnMView to the PDF builder demo in an attempt to:
- place each scanned image into a memory stream and
- then load each image from the stream into the ImageEnMView.

The goal is to ;
- load the ImageEnMView without creating any files and
- utilize the idx in the OnClick event of the ImageEnMView to recall the image from the stream and load it back into the ImageEnView in case it needs to be reviewed prior to saving the file.

In an attempt to accomplish the above I have added an ImageEnMView component to the 3rd tab set of the demo and added the following code.

var
  tempMemoryStream: TMemoryStream;

procedure TformPDFBuilder.FormCreate(Sender: TObject);
begin
  tempMemoryStream := TMemoryStream.Create;
  ImageEnView1.IO.StreamHeaders := True;   
end;

procedure TformPDFBuilder.AddPage;
begin
// existing code

  ImageEnView1.IO.SaveToStreamJpeg(tempMemoryStream);
  ImageEnMView1.MIO.LoadFromStreamFormat(tempMemoryStream, ioJPEG);
end;




Unfortunately, the above loads the first scanned image into the ImageENMView component over and over and not the newly scanned images. The correct scanned image is, however, displayed in the ImageEnView component.

I would greatly appreciate any suggestions?

TIA

John

6   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Feb 27 2015 : 13:21:39
Hi

Perhaps you should start with the Multi\Multiview demo. The open function will append images to the TImageEnMView. It also has a save event that will allow you to output all frames to a multipage file such as a PDF (you can also use ImageEnMView1.MIO.SaveToFilePDF).

To make it show in an TImageEnView add this to the ImageSelect event:

procedure TMainForm.ImageEnMView1ImageSelect(Sender: TObject; idx: Integer);
begin
  ImageEnMView1.CopyToIEBitmap( idx, ImageEnView1.IEBitmap );
  ImageEnView1.Update;
end;



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
John Posted - Feb 27 2015 : 11:43:10
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.





Manarsoft Posted - Feb 27 2015 : 07:54:37
hi John,
can you post the source code?

...
Delphi IDE Blog!
delphiide.blogspot.com
xequte Posted - Feb 26 2015 : 17:07:37
Hi

A bug in v5.2.0 causes it to show a folder icon for invalid files. Are you sure you have reset the position of the stream before calling AppendImage.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
John Posted - Feb 25 2015 : 22:38:43
Nigel

Thanks for the reply.

My problem with this solution is that the scanned image does not display in the ImageEnMView component, rather an image of a folder, see attached image.



TIA

John

xequte Posted - Feb 25 2015 : 18:16:10
Hi John

It looks like you are trying to replace the content of the TImageEnMView, you should be appending the content, e.g.

ImageEnMView1.AppendImage( tempMemoryStream );

http://www.imageen.com/help/TImageEnMView.AppendImage.html

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com