Back to Devexpress

dxPrintDevice Method

vcl-dxprndev-a6bddde5.md

latest1.8 KB
Original Source

dxPrintDevice Method

Provides access to the global printer manager.

Declaration

delphi
function dxPrintDevice: TdxPrintDevice;

Returns

TypeDescription
TdxPrintDevice

The global printer device manager.

|

Remarks

Call the dxPrintDevice function to access and manage printer devices in your application. For example, you can use dxPrintDevice.PrinterCount and dxPrintDevice.PrinterIndex properties to obtain the number of available printer devices and switch between them.

Refer to the TdxPrintDevice class description for detailed information on all available options.

Code Example: Change the Active Printer

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

delphi
uses
  dxPrnDev; // 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;
cpp
#include "dxPrnDev.hpp" // Declares the dxPrintDevice function

// ...
  int APrinterIndex = dxPrintDevice()->FindPrintDevice("Microsoft XPS Document Writer", "");
  if (APrinterIndex != -1) // If the specified printer device is available
    dxPrintDevice()->PrinterIndex = APrinterIndex; // Changes the active printer device

See Also

dxPrnDev Unit