Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TdxPrintDevice.PrinterIndex Property

Specifies the index of the active printer device.

#Declaration

Delphi
property PrinterIndex: Integer read; write;

#Property Value

Type Description
Integer

The index of the active printer device.

Use the PrinterCount property to identify the number of available printer devices.

#Remarks

Use the PrinterIndex property to switch between available printers in your application.

#Code Example: Change the Active Printer

The following code example sets Microsoft XPS Document Writer as the active printer device for TdxComponentPrinter:

uses
  dxPrnDev;  // This unit declares the dxPrintDevice function

// ...
var
  APrinterIndex: Integer;
begin
  APrinterIndex := dxPrintDevice.FindPrintDevice('Microsoft XPS Document Writer', '');
  if APrinterIndex <> -1 then  // If the specified printer device is available
    dxPrintDevice.PrinterIndex := APrinterIndex;  // Changes the active printer device
end;
See Also