SetDevModeFromString
Rendering and printing
Description
Writes a DEVMODE snapshot captured by GetDevModeToString back into the printer object's device mode. The structure is only copied when the string's length equals the printer's current dmSize plus dmDriverExtra; a length mismatch leaves the current settings untouched, so a snapshot from another driver is silently rejected instead of corrupting the DEVMODE.
Apply the snapshot before starting a print job so the job inherits the stored orientation, paper size, duplex setting and driver extras.
Syntax
Delphi
Procedure SetDevModeFromString(APrinter: TPrinter; Const DevModeString: AnsiString);Parameters
| APrinter | The printer object whose device mode receives the snapshot |
|---|---|
| DevModeString | The binary DEVMODE string produced by GetDevModeToString; a length that does not match the current structure is ignored |
Remarks
The library-level SetPrinterDevModeFromString method exposes this helper on a printer name.
See also
SetPrinterDevModeFromString, GetPrinterDevModeToString, SetPrinterDevModeFromVariant, NewCustomPrinter, PrintDocument