Skip to main content

TdxPrintDevice.PrinterCount Property

Returns the number of available printers.

Declaration

property PrinterCount: Integer read;

Property Value

Type Description
Integer

The number of available printers available in the operating system.

Remarks

You can use the PrinterCount property value to identify the following:

  • The maximum PrinterIndex property value (PrinterCount minus 1).
  • The number of printer names accessible through the Printers property.
  • The number of objects accessible through the PrinterInfos property.

Code Example

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
  I: Integer;
begin
  for I := 0 to dxPrintDevice.PrinterCount - 1 do
  begin
    if dxPrintDevice.Printers.Strings[I] = 'Microsoft XPS Document Writer' then
    begin
      dxPrintDevice.PrinterIndex := I;  // Changes the active printer device
      break;
    end;
  end;
end;
See Also