[Overview][Types][Classes][Variables][Index] | Reference for unit 'Printers' (#lcl)

# TPrinter.DoSetPrinter

Performs actions needed to select the specified printer name.

## Declaration

Source position: printers.pas line 279

`protected function TPrinter.DoSetPrinter(`
`aName: string`
`):Integer; virtual;`

## Arguments

`aName` |  | Printer name to use as the selected print device.

## Function result

Ordinal position for the specified printer name, or -1 when not found.

## Description

DoSetPrinter is a virtual Integer function used to perform actions needed to set the selected printer to the name specified in aName. The return value contains the ordinal position in Printers where the name is located, or -1 when the specified name was not found.

Remark: | In TPrinter, DoSetPrinter always returns the value -1. It must be overridden in a descendent class to perform the actions needed for the operating system / widgetset / printer-related technology used in the implementation.

DoSetPrinter is called from the SetPrinter method.

## See also

TPrinter.Printers |  | Contains the names for devices that can be selected for printing.
TPrinter.SetPrinter |  | Makes the device with the specified name the current printer.
TPrinter.PrinterIndex |  | Contains the ordinal position in Printers for the selected print device.