GetDevModeToString
Rendering and printing
Description
Returns the printer's current DEVMODE structure as a binary string, including the driver-specific bytes that follow the public part. The structure is read through the printer object's device handle, which is re-selected from the current printer index when the first query returns no handle.
The result is raw binary, not text: it holds dmSize plus dmDriverExtra bytes copied straight from the locked DEVMODE. An empty string comes back when no device handle is available. Use SetDevModeFromString to write the snapshot back, and note that a snapshot is only guaranteed to apply to the same printer and driver that produced it.
Syntax
Delphi
Function GetDevModeToString(APrinter: TPrinter): AnsiString;Parameters
| APrinter | The printer object whose current settings are captured |
|---|
Return values
| AnsiString | The binary DEVMODE copy, driver extra bytes included |
|---|---|
| '' | No device handle is available for the printer |
Remarks
The library-level GetPrinterDevModeToString method exposes this helper on a printer name, with the same pairing on the restore side.
See also
GetPrinterDevModeToString, SetPrinterDevModeFromString, GetPrinterDevModeToVariant, GetPrinterBins, GetPrinterNames