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
 Unable to Print

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
bmesser Posted - Oct 06 2024 : 06:22:52
Hi

I am using v8 of ImageEN, and I wrote some code ten or more years ago to print a BMP from a TImagENView component that worked well for a number of years.

I tend to use screenshots rather than hard copies these days, so it's been on my bug list to fix for a long while, and although I can initiate printing, Windows 10 always reports a printing error.

I notice in the latest version you can now print directly from an IEBitmap but unfortunately I'm stuck with what I have.

All I can assume is that something happened in Windows and you can't print from v8 anymore.

Any suggestions for a work round are welcome#128521;

Bruce.


procedure PrintControl(AControl: TWinControl; Title: string =''; Shadow: boolean = True);
var
  bmp : TBitMap;
  DC  : HDC;
  img : TImageEnView;
  dlg : TPrinterSetupDialog;
begin
  bmp:=TBitmap.Create;

  try
    bmp.Width:=AControl.ClientWidth;
    bmp.Height:=AControl.ClientHeight;
    bmp.PixelFormat:=pf24bit;

    DC:=GetWindowDC(AControl.Handle);

    try
      BitBlt(bmp.Canvas.Handle,0,0,bmp.Width,bmp.Height,DC,0,0,SrcCopy);

      bmp.Canvas.Brush.Color:=clBlack;
      bmp.Canvas.FrameRect(rect(0,0,bmp.Width,bmp.Height));

      img:=TImageEnView.Create(nil);

      try
        img.Bitmap.Assign(bmp);

        if Shadow then
          img.Proc.AddSoftShadow(2,10,10,True,clBlack,80);

        dlg:=TPrinterSetupDialog.Create(nil);

        try
          if dlg.Execute then
          begin
            // Print the image in the center of the page stretched to page dimensions
            Printer.BeginDoc;

            try
              Printer.Title:=Title;
              img.IO.PrintImage(Printer.Canvas,0,0,0,0,ievpCenter,iehpCenter,iesFitToPage,0,0,1);
            finally
              Printer.EndDoc;
            end;
          end;
        finally
          dlg.Free;
        end;
      finally
        img.Free
      end;
    finally
      ReleaseDC(AControl.Handle,DC);
    end;
  finally
    bmp.Free
  end;
end;
4   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Oct 14 2024 : 17:32:22
Hi

I'm not sure those files are actually missing, otherwise your application wouldn't compile at all. When stepping through the code, I would just ignore those units. You want to find the ImageEn line where the printing code fails to process as you would expect.

Nigel
Xequte Software
www.imageen.com
bmesser Posted - Oct 14 2024 : 11:06:02
I have run across missing paths to files before on my PC but not missing files.
I had to set the path to pick up vcl.printers.pas before I could get that far!
bmesser Posted - Oct 14 2024 : 11:03:16
Hi Nigel

I've just traced the code and it balked when it got to here.

Believe it or not despite a search I don't have a copy of Winapi.Windows.pas on my Pc so can't go any further.

I'm running Delphi 10.2.

Bruce.




xequte Posted - Oct 06 2024 : 15:55:09
Hi Bruce

We're going to need more information to help you here. Do you get any error message? Have you tried stepping into ImageEn code to see where it fails?

Nigel
Xequte Software
www.imageen.com