Declaration
property OnPrintPage: TIEPrintPageEvent;
Description
Occurs whenever an image or page of thumbnails 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 |
// Add headings when printing from a TImageEnMView
procedure TForm1.ImageEnMView1PrintPage(Sender: TObject; Index: Integer;
ThumbnailPrinting: Boolean; DpiX, DpiY: Integer; PrintWidth, PrintHeight:
Double; var Heading: string; HeadingFont: TFont);
var
heightPixels: Integer;
begin
// If thumbnails, output the current page number. If image printing, output the filename
if ThumbnailPrinting then
Heading := format( 'Thumbnail Page %d', [ Index + 1 ])
else
Heading := ExtractFilename( ImageEnMView1.ImageFilename[ Index ]);
// 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
◼DoPrintPreviewDialog◼PrintImages◼PrintImage◼PrintImagesToBitmap◼PrintImagesToFile◼OnPrintPage