Default Printer Name and Paper

TECH TIP: Windows Default Printer Settings

Default Printer Name

You can get the name of the computers default printer by accessing ReportBuilder’s global printer list object – ppPrinters.

uses
  ppPrintr;

var
  lsPrinterName: String

begin

  lsPrintername := ppPrinters.DefaultPrinterName;

end;
Default Printer Setup

Place the following code in the OnClick event-handler of a button on a form. When the button is pressed
a message will be displayed showing the default printer name and paper size.

You can get the other document defaults via the TppPrinter.PrinterSetup properties.

uses
  ppPrintr;

var
  lPrinter: TppPrinter;

begin

  lPrinter := TppPrinter.Create;

  lPrinter.PrinterName := ppPrinters.DefaultPrinterName;

  ShowMessage(ppPrinters.DefaultPrinterName + ': ' + lPrinter.PrinterSetup.PaperName);

  {assign default printer settings to a report}
  myReport.PrinterSetup := lPrinter.PrinterSetup;


  lPrinter.Free;

end;