ImageEn, unit imageenio

TImageEnIO.PreviewPrintImage

TImageEnIO.PreviewPrintImage


Declaration

procedure PreviewPrintImage(DestBitmap: TBitmap; MaxBitmapWidth: Integer; MaxBitmapHeight: Integer; PrinterObj: TPrinter = nil; MarginLeft: Double = 1; MarginTop: Double = 1; MarginRight: Double = 1; MarginBottom: Double = 1; VerticalPos: TIEVerticalPos = ievpCenter; HorizontalPos: TIEHorizontalPos = iehpCenter; Size: TIESize = iesFitToPage; SpecWidth: Double = 0; SpecHeight: Double = 0; GammaCorrection: Double = 1; PrintAnnotations: Boolean = False; PrintLayers: Boolean = False; const Heading: string = ''; HeadingHeight: Integer = 5; HeadingColor: TColor = clBlack; PreviewPage: Integer = -1);


Description

Draws a preview of the printing of the current image by specifying margins, vertical position, horizontal position and size.
It also paints a rectangle over the image to show the margin limits.

Parameter Description
DestBitmap Destination bitmap where to paint the preview. Resizes DestBitmap as needed.
MaxBitmapWidth Maximum destination bitmap width. Preview will be stretched to match this size.
MaxBitmapHeight Maximum destination bitmap height. Preview will be stretched to match this size.
Printer This is the Printer object. PreviewPrintImage need it to know printer settings as orientation or page sizes.
MarginLeft Left page margin in inches. Specying zero causes no margin to be used.
MarginTop Top page margin in inches. Specying zero causes no margin to be used.
MarginRight Right page margin in inches. Specying zero causes no margin to be used.
MarginBottom Bottom page margin in inches. Specying zero causes no margin to be used.
VerticalPos Determines how the image vertically aligns within the page.
HorizontalPos Determines how the image horizontally aligns within the page.
Size How the image should be sized for printing
SpecWidth The absolute width of the image in inches if Size = iesSpecifiedSize. The number of pages wide if Size = iesMultiplePages
SpecHeight The absolute height of the image in inches if Size = iesSpecifiedSize. The number of pages high if Size = iesMultiplePages
GammaCorrection The gamma correction value, use 1.0 to disable gamma correction.
PrintAnnotations If true and the image contains imaging or ImageEn annotations they will be printed
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
Heading Specifies the heading to print at the top of the page.
HeadingHeight The height of the heading, as a PERCENTAGE of the overall page height, e.g. 5 will make the heading 5% of the page height.
HeadingColor Specifies the color of the heading text.
PreviewPage Specifies the page to preview if if Size = iesMultiplePages.

Notes:
- Use the OnPrintPage or OnPrintPage events to customize the heading
- If you are printing a PDF, you should use Print


Examples

// Paint and display the preview in ImageEnView2 component.
ImageEnView1.IO.PreviewPrintImage(ImageEnView2.IEBitmap.VclBitmap, ImageEnView2.Width, ImageEnView2.Height, Printer, 0, 0, 0, 0, ievpCenter, iehpCenter, iesFitToPage , 0 , 0 , 1);
ImageEnView2.Update;

// Show print preview in ImageEnView2 of ImageEnView1 layers
ImageEnView1.LayersCurrent := 0; // Select background layer
ImageEnView1.IO.PreviewPrintImage( ImageEnView2.IEBitmap.VCLBitmap,
                                   ImageEnView2.ClientWidth, ImageEnView2.ClientHeight, Printer,
                                   1, 1, 1, 1, ievpCenter, iehpCENTER, iesFitToPage, 0, 0, 1,
                                   False, True );
ImageEnView2.Update();


See Also

- PrintPreviewParams
- PrintImage
- OnPrintPage