Declaration
procedure PrintImage(Margins: 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; AutoOrient: Boolean = False); overload;
procedure PrintImage(PrtCanvas: TCanvas = 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; AutoOrient: Boolean = False); overload;
procedure PrintImage(Margins: double = 1; VerticalPos: TIEVerticalPos = ievpCenter; HorizontalPos: TIEHorizontalPos = iehpCENTER; const Heading: string = ''; HeadingHeight: Integer = 5; HeadingColor: TColor = clBlack; AutoOrient: Boolean = False); overload;
Description
Print the current image by specifying margins, vertical position, horizontal position and size.
Parameter | Description |
PrtCanvas | The canvas to bring to. Specify nil to use Printer.Canvas |
MarginLeft | Left page margin in inches (Specify zero for no margin) |
MarginTop | Top page margin in inches (Specify zero for no margin) |
MarginRight | Right page margin in inches (Specify zero for no margin) |
MarginBottom | Bottom page margin in inches (Specify zero for no margin) |
VerticalPos | How the image is vertically aligned on the page |
HorizontalPos | How the image horizontally aligned on 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 (Specify 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 |
AutoOrient | When enabled, will automatically set the printing to landscape or portrait to best match the image |
Note:
◼You do not need to call Printer.BeginDoc/Printer.EndDoc unless you want to print a batch of images. However if you specify a custom PrtCanvas you MUST call Printer.BeginDoc/Printer.EndDoc)
◼Use the
OnPrintPage or
OnPrintPage events to customize the heading
◼When using iesSpecifiedSize,
SpecWidth or
SpecHeight will be adjusted to maintain the image's aspect ratio. Set
PrintingMaintainAR to false to prevent this
◼If you are
printing a PDF, you should use
Print
| Demos\ImageEditing\CompleteEditor\PhotoEn.dpr |
// Add Printers unit to your uses clause...
uses
Printers;
// Print the image in the center of the page at the original size
Printer.Title := 'Original Image';
ImageEnView1.IO.PrintImage( 0, ievpCenter, iehpCenter, iesNormal );
// Print the image in the center of the page stretched to page dimensions (respecting the proportions)
Printer.Title := 'Stretched Image';
ImageEnView1.IO.PrintImage( 0, ievpCenter, iehpCenter, iesFitToPage );
// Print the image as a poster, four pages wide and six pages high
Printer.Title := 'Poster';
ImageEnView1.IO.PrintImage( 0, ievpCenter, iehpCenter, iesMultiplePages, 4, 6, 1 );
// Print all pages of a TIFF (TImageEnView)
Printer.Title := 'TIFF Pages';
Printer.BeginDoc();
for I := 0 to ImageEnView1.IO.Params.ImageCount - 1 do
begin
ImageEnView1.IO.Params.ImageIndex := I;
ImageEnView1.IO.LoadFromFile( 'C:\input.tif' );
ImageEnView1.IO.PrintImage();
end;
Printer.EndDoc();
// Print all frames of a multi-page TIFF (TIEBitmap)
procedure PrintAllPages(const Filename: string);
Var
bmp: TIEBitmap;
io: TImageEnIO;
i: Integer;
Begin
bmp := TIEBitmap.Create();
io := TImageEnIO.CreateFromBitmap(bmp);
try
io.LoadFromFile( Filename );
Printer.Title := 'TIFF Pages';
Printer.BeginDoc();
for i := 0 to io.Params.ImageCount - 1 do
begin
io.Params.ImageIndex := i;
if i > 0 then
io.LoadFromFile( Filename );
io.PrintImage();
end;
Printer.EndDoc();
finally
io.Free;
bmp.Free;
end;
End;
// Print the image in the center with layers
ImageEnView1.LayersCurrent := 0; // Select background layer
ImageEnView1.IO.PrintImage( 0, ievpCenter, iehpCenter, iesNormal, 0, 0, 1, False, True );
See Also
◼PrintImagePos
◼OnPrintPage