ImageEn, unit imageenio

TImageEnIO.DoPrintPreviewDialog

TImageEnIO.DoPrintPreviewDialog


Declaration

function DoPrintPreviewDialog(DialogType: TIEDialogType = iedtDialog; TaskName: WideString = ''; PrintAnnotations: Boolean = false; const Caption: WideString = ''; PrintLayers: Boolean = false): Boolean;


Description

Displays a print preview dialog to allow the user to configure and print the current image.

Parameter Description
DialogType Select the style of print dialog
TaskName Specifies the description of the task in the Print Manager and network header pages (defaults to the application name)
PrintAnnotations If true and the image contains imaging or ImageEn annotations they will be printed
Caption Specifies the caption of the Print Preview dialog
PrintLayers If true and the attached TImageEnView image contains multiple layers, they will be printed. If False, only the image (i.e. current layer) is printed

Note:
 The language used in the dialog is controlled by MsgLanguage. The styling can also be adjusted using UseButtonGlyphsInDialogs
 Use the OnPrintPage or OnPrintPage event to add a heading to the printed page
 If you are printing a PDF, DoPrintPreviewDialog() will redirect to Print


Demos

Demo  Demos\ImageEditing\CompleteEditor\PhotoEn.dpr
Demo  Demos\InputOutput\PrintSelected\PrintSelected.dpr
Demo  Demos\Other\ImageEn_Dialogs\ImageEn_Dialogs.dpr


Examples

ImageEnView1.IO.DoPrintPreviewDialog( iedtDialog );




ImageEnView1.IO.DoPrintPreviewDialog( iedtMaxi );




// Print same as above, but not maximized
ImageEnView1.IO.PrintPreviewParams.MaxiDlgMaximized := False;
ImageEnView1.IO.DoPrintPreviewDialog( iedtMaxi );


// Preview image with layers
ImageEnView1.IO.DoPrintPreviewDialog( iedtDialog, '', False, '', True );


// If an area of the image is selected, print the selection, otherwise print the whole image
procedure TForm1.PrintImageClick(Sender: TObject);
var
  bmp: TIEBitmap;
  IO: TImageEnIO;
begin
  if ImageEnView1.Selected = False then
    ImageEnView1.IO.DoPrintPreviewDialog( iedtDialog, '' )
  else
  begin
    bmp := TIEBitmap.Create;
    IO := TImageEnIO.CreateFromBitmap( bmp );
    try
      ImageEnView1.CopySelectionToBitmap( bmp );
      IO.DoPrintPreviewDialog( iedtDialog, '' );
    finally
      IO.Free;
      bmp.Free;
    end;
  end;
end;


Compatibility Information

Prior to v8.0.0, if the user specified a width and height in the Preview dialog, it would not adjust the output to ensure the image aspect ratio was maintained (i.e. image may print stretched). With 8.0.0, the aspect ratio is maintained by default. To restore the older functionality, set ImageEnView1.IO.PrintingMaintainAR := False;


See Also

 PrintPreviewParams
 DialogMeasureUnit
 PrintImage
 OnIOPreview
 OnShowDialog