Image Device Fundamentals

The Image device descendents give the capability to easily export any report to various image formats which can be viewed using an image viewer or editor.

Begin by setting the Report.AllowPrintToFile property to True to enable the Print To File section of the Print Dialog. The print dialog can be bypassed by setting the Report.DeviceType property to the image type (ex. “BMP”), assigning the Report.TextFileName property, and setting the Report.ShowPrintDialog property to False.

uses
  ppTypes;

procedure TForm1.btnPrintClick(Sender: TObject);
begin
  ppReport1.AllowPrintToFile := True;
  ppReport1.ShowPrintDialog := False;
  ppReport1.DeviceType := dtBMP;

  ppReport1.TextFileName := 'C:\MyImageFile.bmp';

  ppReport1.Print;

end;

Download: ImageDeviceDemo.zip

 

Image Types

Bitmap Image (TppBMPDevice)

– File Extension(s): *.bmp
– DeviceType: dtBMP or ‘BMP’.
– Availability: All versions of Delphi.

JPEG Image (TppJPEGDevice)

– File Extension(s): *.jpg; *.jpeg; *.jpe; *.jfif
– DeviceType: dtJPEG or ‘JPEG’.
– Availability: All versions of Delphi.

Metafile Image (TppMetafileDevice)

– File Extension(s): *.emf; *.wmf
– DeviceType: dtMetafile or ‘Metafile’.
– Availability: All versions of Delphi.

GIF Image (TppGIFDevice)

– File Extension(s): *.gif
– DeviceType: dtGIF or ‘GIF’.
– Availability: All versions of Delphi.

PNG Image (TppPNGDevice)

– File Extension(s): *.png
– DeviceType: dtPNG or ‘PNG’.
– Availability: Delphi 2009 or later.

TIFF Image (TppTiffDevice or TppWICDevice)

– File Extension(s): *.tif; *.tiff<>br> – DeviceType: dtTIFF or ‘TIFF’.
– Availability: See the TIFF Image export article.