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
 ImageEnView1.DoPrintPreviewDialog
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

John

USA
94 Posts

Posted - Feb 19 2016 :  22:27:25  Show Profile  Reply
Hello

6.2.1

ImageEnView1.io.DoPrintPreviewDialog(iedtDialog);

The line of code above no longer shows a preview of the image, see below.








Suggestions?

John

John

USA
94 Posts

Posted - Feb 20 2016 :  09:57:49  Show Profile  Reply
Issue resolved, Sorry for the confusion.

The issue is that when the print preview initially displays, the preview is based upon the default printer. In the case of this example, this was a Dymo label printer. Once the appropriate printer was selected the preview displayed correctly.

Suggestion - What about appending the selected printer to the word "Preview" in the caption of the group box that actually displays the preview image?

TIA

John
Go to Top of Page

w2m

USA
1990 Posts

Posted - Feb 20 2016 :  10:18:22  Show Profile  Reply
You can display the printer yourself in the dialog:

function GetHPPrinterIndex: Integer;
var
  i: Integer;
begin
  for i := 0 to Printer.Printers.Count - 1 do
    if AnsiContainsText(Printer.Printers[i], 'HP') then
    begin
      exit(i);
    end;
  Result := -1;
end;

procedure TForm1.Print1Click(Sender: TObject);
var
  iPrinterIndex: Integer;
  iPrinterName: string;
begin
  iPrinterIndex := GetHPPrinterIndex;
  Printer.PrinterIndex := iPrinterIndex;
  iPrinterName := Printer.Printers.Strings[Printer.PrinterIndex];
  ImageEnView1.IO.DoPrintPreviewDialog(iedtDialog, 'Image', False, 'Print Preview- ' + iPrinterName);
end;


Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development

Go to Top of Page

John

USA
94 Posts

Posted - Feb 21 2016 :  05:53:01  Show Profile  Reply
William

I appreciate your reply with regard to the caption property.

Because I would not have knowledge of the end user's printer list or what printer they wish to use, I have changed the original code to the following.

procedure TformViewPhotographs.SpeedButtonPrintSingleClick(Sender: TObject);
var
  iPrinterIndex: Integer;
  tempPrinterName: string;
begin
  iPrinterIndex := -1;      // The assumption is that the default printer.PrinterIndex = -1;
  Printer.PrinterIndex := iPrinterIndex;
  tempPrinterName := Printer.Printers.Strings[Printer.PrinterIndex];
 
 ImageEnView1.io.DoPrintPreviewDialog(iedtDialog, 'Patient - ' + DataPatients.adsTablePatients.FieldByName('FirstName').AsString
 + ' ' + DataPatients.adsTablePatients.FieldByName('LastName').AsWideString,                                                False, 'Print Preview With Default Printer - ' + tempPrinterName);

end;


Suggestion 2:
If there was a mechanism to capture the current PrinterName in an OnCloseUp or OnChange event when the printer was changed in the print preview, then
a) the print preview caption could be updated and
b) the selected printer could be assigned to a global variable and reassigned if the print preview was closed and then reopened.

TIA

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