You have at least 3 options to print multiple images on a page with ImageEn. You can use ImageEnMView1.MIO.DoPrintPreviewDialog, ImageEnMView1.MIO.PreviewPrintImages or the Windows Printing Wizard. The former allows you to specify the number of columns or rows and other parameters to get the thumbnails to appear as you specify:
procedure TForm1.Open1Click(Sender: TObject);
var
i: integer;
iFilename: string;
begin
if OpenPictureDialog1.Execute then
begin
Screen.Cursor := crHourGlass;
try
for i := 0 to OpenPictureDialog1.Files.Count - 1 do
begin
iFilename := OpenPictureDialog1.Files[i];
if FileExists(iFilename) then
begin
ImageEnMView1.AppendImage(iFilename);
end;
end;
finally
Screen.Cursor := crDefault;
end;
end;
StatusBar1.Panels[2].Text := 'Pages: ' + IntToStr(ImageEnMView1.ImageCount);
end;
DoPrintPreviewDialog
procedure TForm1.Print1Click(Sender: TObject);
begin
with ImageEnMView1.MIO.PrintPreviewParams do
begin
Printer.Orientation := poLandscape;
PrintThumbnails := True;
MarginTop := 0.5;
MarginLeft := 0.5;
MarginRight := 0.5;
MarginBottom := 0.5;
ThumbnailColumns := 2;
ThumbnailRows := 2;
ThumbnailSpacing := 0.5;
ThumbnailStyle := ptFlat; { ptFlat, ptSoftShadow, ptBorder };
ThumbnailShowText := False;
end;
ImageEnMView1.MIO.DoPrintPreviewDialog('Thumbnails', False, '', True);
end;
Once the PrintPreviewDialog is visible you can change the printer orientation and the number of thumbnail columns or rows.
PreviewPrintImages
PreviewPrintImages allows you to create your own print preview dialog by displaying the preview in a TImageEnView and then control how the thumbnails are displayed by setting the PreviewPrintImages parameters with your own controls.
procedure TForm1.Print2Click(Sender: TObject);
begin
FormPrintPreview := TFormPrintPreview.Create(self);
try
iMaxBitmapWidth := FormPrintPreview.ImageEnView1.Width;
iMaxBitmapHeight := FormPrintPreview.ImageEnView1.Height;
iPrinter := Printer;
iPrinter.Orientation := poLandscape;
iColumns := 2;
iRows := 2;
iHorizSpace := 0.05;
iVertSpace := 0.05;
iPrintSelected := False;
iMarginLeft := 0.05;
iMarginTop := 0.05;
iMarginRight := 0.05;
iMarginBottom := 0.05;
iDrawBox := False;
iDrawText := False;
iDrawShadow := False;
iBoxColor := clBlack;
iPageNo := 0;
ImageEnMView1.MIO.PreviewPrintImages(FormPrintPreview.ImageEnView1.Bitmap,
iMaxBitmapWidth, iMaxBitmapHeight, iPrinter, iColumns, iRows, iHorizSpace,
iVertSpace, iPrintSelected, iMarginLeft, iMarginTop, iMarginRight,
iMarginBottom, iDrawBox, iDrawText, iDrawShadow, iBoxColor, iPageNo);
FormPrintPreview.ImageEnView1.Update;
FormPrintPreview.ShowModal;
finally
FormPrintPreview.Free;
end;
Windows Printing System
The Windows Printing System can also be used to print each image as a full page, two 4"x6" thumbnails, nine wallet sized thumbnails or a contact sheet with 35 thumbnails per page. You can not control exactly how many thumbnails are on a page or the exact dimensions of the thumbnails with the Windows Printing System. It is very professional looking and it does work well with ImageEn, however.
Uses System.Win.ComObj;
procedure TForm1.Print3Click(Sender: TObject);
{ Print image to Windows Printing Wizard. }
var
i: integer;
iFilename: string;
iFiles: OleVariant;
iCommDlg: OleVariant;
begin
Screen.Cursor := crHourGlass;
try
iCommDlg := CreateOleObject('WIA.CommonDialog');
iFiles := CreateOleObject('WIA.Vector');
for i := 0 to ImageEnMView1.ImageCount - 1 do
begin
iFilename := ImageEnMView1.MIO.Params[i].FileName;
iFiles.Add(iFilename);
end;
iCommDlg.ShowPhotoPrintingWizard(iFiles);
finally
Screen.Cursor := crDefault;
end;
end;
Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development