Declaration
property OnPrintPage: TIEPrintPageEvent;
Description
Occurs whenever an image is printed to allow a heading to be specified.
Parameter | Description |
Sender | Will be either a TImageEnIO or TImageEnMIO control |
Index | If ThumbnailPrinting is False, Index represents the image in the associated TImageEnMView. If ThumbnailPrinting is true, Index represents the index of the page being printed (e.g. the first of three thumbnail sheets). When printing from a TImageEnIO, Index is always 0 |
ThumbnailPrinting | True, when printing thumbnails from a TImageEnIO using PrintImages or DoPrintPreviewDialog |
DpiX, DpiY | Resolution of the printed page |
PrintWidth, PrintHeight | Dimensions in inches of the printed page |
Heading | Set a valid string to add a heading to the top of the printed page. Defaults to '', meaning that no heading is printed |
HeadingFont | If a Heading has been specified, configure the font style |
Note: This method is not called when printing PDF files with
PdfViewer
// Add headings when printing from a TImageEnView
procedure TForm1.ImageEnView1PrintPage(Sender: TObject; Index: Integer;
ThumbnailPrinting: Boolean; DpiX, DpiY: Integer; PrintWidth, PrintHeight:
Double; var Heading: string; HeadingFont: TFont);
var
heightPixels: Integer;
begin
// Output the filename as heading
Heading := ExtractFilename( ImageEnView1.IO.Params.Filename );
// Output text at 5% of page height (use percentage sizes, rather than fixed values to handle different page sizes)
heightPixels := Round( PrintHeight * DpiY );
HeadingFont.Height := heightPixels div 20;
HeadingFont.Style := [fsBold];
end;
See Also
◼PreviewPrintImage
◼PrintImage
◼OnPrintPage