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
 ImageEnView Print Preview Issues ?

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
andyhill Posted - Apr 01 2025 : 15:34:23
I have tried several ways to Print Preview with option to print and it does not show the image (it is either blank, distorted or no show) ?


    Printer.Orientation:= poLandscape; // Need To Select Default Printer

    // Paint and display the preview in ImageEnView2 component.
    (* BLANK CANVAS *)
    ImageEnView.LayersCurrent:= 2; // Select background layer
    ImageEnView.IO.PreviewPrintImage(PrintPreviewForm.ImageEnViewPrint.IEBitmap.VclBitmap,
                                     PrintPreviewForm.ImageEnViewPrint.Width,
                                     PrintPreviewForm.ImageEnViewPrint.Height,
                                     Printer, 0, 0, 0, 0, ievpCenter, iehpCenter, 
                                     iesFitToPage , 0 , 0 , 1);
    PrintPreviewForm.ImageEnViewPrint.Update();
    PrintPreviewForm.ShowModal;
    (* *)

    // Show print preview in ImageEnView2 of ImageEnView1 layers
    (* DISTORTED MINITURE PIXELS
    ImageEnView.LayersCurrent:= 2; // Select background layer
    ImageEnView.IO.PreviewPrintImage(PrintPreviewForm.ImageEnViewPrint.IEBitmap.VCLBitmap,
                                     PrintPreviewForm.ImageEnViewPrint.ClientWidth,
                                     PrintPreviewForm.ImageEnViewPrint.ClientHeight,
                                     Printer,
                                     1, 1, 1, 1, ievpCenter, iehpCENTER, iesFitToPage,
                                     0, 0, 1, False, True );
    PrintPreviewForm.ImageEnViewPrint.Update();
    PrintPreviewForm.ShowModal;
    *)

    (* NOTHING NO SHOW ?
    ImageEnView.LayersCurrent:= 2; // Select background layer
    ImageEnView.IO.DoPrintPreviewDialog(iedtDialog, '', False);
    *)


Base Layer Image (0) and Perimeter Layer Polyline (1) are non selectable
Layers 2 .. 99 selectable

I want to Preview Layers 0 .. 99

PrintPreviewForm contains ImageEnViewPrint

I have tried with and without ImageEnView.LayersCurrent:= 2;

What am I doing wrong ?


Andy
6   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Apr 02 2025 : 19:45:16


Nigel
Xequte Software
www.imageen.com
andyhill Posted - Apr 02 2025 : 01:41:13
"Assign" Seniors moment - sorry

Andy
xequte Posted - Apr 01 2025 : 23:54:04
Hi Andy

This is not correct:

    ImageEnView2:= TImageEnView.Create(nil);
    ImageEnView2:= ImageEnView1;

In step 1, you've created a TImageEnView and assigned it to ImageEnView2.
Then in Step 2, you say ImageEnView2 is just pointer to ImageEnView1.
That means any changes you make in ImageEnView2 are really just changing ImageEnView1.
Plus you will get a memory leak because you never freed the object from step 1.

What you want to do is copy the content to ImageEnView2:

  ImageEnView2.Assign( ImageEnView1 );


Sorry, I cannot reproduce the font size issue. It correctly changes when I test it here. Please give me the steps to reproduce it in one of our demos.

Nigel
Xequte Software
www.imageen.com
andyhill Posted - Apr 01 2025 : 22:27:43
Also, using OnPrintPage I cannot change Font Size (when debugging it shows the value has changed in the object but in preview and when printing it does not change (it is always 9) ?


procedure TMainForm.ImageEnView2PrintPage(Sender: TObject; Index: Integer;
  ThumbnailPrinting: Boolean; DpiX, DpiY: Integer; PrintWidth,
  PrintHeight: Double; var Heading: string; HeadingFont: TFont);
var
  s, ds: String;
  heightPixels: Integer;
begin
  DateTimeToString(ds, 'yyyy-mm-dd-hh-mm', Now());
  s:=       IntToStr(Length(Tables));
  Heading:= ds+' - '+
            'HorzOffset: ' +FormatFloat('0.####', TableHorzBeginGap)+'mtrs, '+
            'VertOffset: ' +FormatFloat('0.####', TableVertBeginGap)+'mtrs, '+
            'HorzSpacing: '+FormatFloat('0.####', TableHorzGap)+'mtrs, '+
            'VertSpacing: '+FormatFloat('0.####', TableVertGap)+'mtrs, '+
            'TblWidth: '   +FormatFloat('0.####', TableWidth)+'mtrs, '+
            'TblHeight: '  +FormatFloat('0.####', TableHeight)+'mtrs - '+
            'Table Count: '+s;
  HeadingFont.Size:=   6;
  HeadingFont.Style:=  [fsBold];



Andy
andyhill Posted - Apr 01 2025 : 21:48:15
I found that if Layer[0] is un-selectable then no go, so I transferred to new object, set all selectable, merged and printed - OK.

However my problem now is that all adjustments I do to ImageEnView2 permanently affect ImageEnView, how can I copy ImageEnView to ImageEnView2 without ImageEnView being affected by adjustments I make to ImageEnView2 ?


    ImageEnView2:= TImageEnView.Create(nil);
    ImageEnView2:= ImageEnView;
    for i:= 0 to ImageEnView2.LayersCount-1 do begin
      ImageEnView2.Layers[i].Selectable:= True;
    end;
    ImageEnView2.LayersCurrent:= 0;
    ImageEnView2.LayersMergeAll();
    ImageEnView2.Update();
    ImageEnView2.IO.DoPrintPreviewDialog(iedtDialog, '', False);
    //ImageEnView2.Free;
    Exit;


Andy
xequte Posted - Apr 01 2025 : 19:28:29
Hi Andy

Your code works fine for me when layers current is a valid image. It creates a preview of the image as it will be printed.

DoPrintPreviewDialog() shows a preview of the currently selected layer and allows printing.

If you specify ImageEnView.LayersCurrent:= 2, the third layer will be selected and shown (assuming it is an image layer). If you don't specify it, the current layer is shown.

Can you show me a screenshot of what you are seeing. Is your Layer[2], an image layer?



Nigel
Xequte Software
www.imageen.com