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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 PrintImage IEM_SELECTED_IMAGES prints one page
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

fourwhey

20 Posts

Posted - Jan 24 2014 :  13:08:43  Show Profile  Reply
I can print images individually. However, if I call TImageEnMView.MIO.PrintImage(IEM_SELECTED_IMAGES, ...) only the last selected image prints when Printer.EndDoc is called.

Any idea how I might work around this?
Here's the code I'm using to print.

procedure TForm1.btnPrintSelectedClick(Sender: TObject);
begin
  if iemvDocs.MultiSelectedImagesCount > 0 then
  begin
    Printer.BeginDoc;
    iemvDocs.MIO.PrintImage(IEM_SELECTED_IMAGES, Printer.Canvas, 0, 0, 0, 0, ievpCENTER, iehpCENTER, iesFITTOPAGE, 0, 0, 1);
    Printer.EndDoc;
  end
  else
    ShowMessage('There are no selected items.');
end;

fourwhey

20 Posts

Posted - Jan 24 2014 :  13:48:10  Show Profile  Reply
I ended up implementing the check for selected items myself. There does still seem to be an issue with calling PrintImage using the constants to PrintSelected or PrintAll. From what I've seen, it only prints the last selected image - or basically the last one to be handled by _PrintImage(I) prior to Printer.EndDoc being called.

Snippet...

  if iemvDocs.MultiSelectedImagesCount > 0 then
  begin
    for I := 0 to iemvDocs.ImageCount -1 do
      if iemvDocs.IsSelected(I) then
      begin
        Printer.BeginDoc;
        iemvDocs.MIO.PrintImage(I, Printer.Canvas, 0, 0, 0, 0, ievpCENTER, iehpCENTER, iesFITTOPAGE, 0, 0, 1);
        Printer.EndDoc;
      end;
  end...


Perhaps Printer.BeginDoc and Printer.EndDoc need to be handled inside the loop for ImageEnMView.MIO.PrintImage when PrintSelected or PrintAll are requested?

This does work, but I'm not sure if it was left out for some reason that I'm unaware of.
Go to Top of Page

xequte

39061 Posts

Posted - Jan 28 2014 :  19:36:15  Show Profile  Reply
Hi

This is fixed for the next release.

A better way to handle your code would be:


  if iemvDocs.MultiSelectedImagesCount > 0 then
  begin
    bFirstImage := True;
    Printer.BeginDoc;
    for I := 0 to iemvDocs.ImageCount -1 do
      if iemvDocs.IsSelected(I) then
      begin
        if bFirstImage then
          Printer.NewPage;
        bFirstImage := False;
        iemvDocs.MIO.PrintImage(I, Printer.Canvas, 0, 0, 0, 0, ievpCENTER, iehpCENTER, iesFITTOPAGE, 0, 0, 1);
      end;
    Printer.EndDoc;
  end...


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

fourwhey

20 Posts

Posted - Jan 31 2014 :  14:44:26  Show Profile  Reply
Great! Thank you for following up on this.

I implemented your suggestion and see why it's a good idea.

In case anyone else see's this, Printer.NewPage checks to see if the printer is available prior to starting and does some cleanup to prep for a new print job -- among other things.

Thanks.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: