AssignPrn procedure (WinPrn)
Assigns a text file to a printer.
procedure AssignPrn(var F: Text; Device, Driver, Port: PChar)
Assigns the printer described by Device and Driver on port Port to F. These values must match a device specified in the WIN.INI file under the [devices] section. For example, if you have a LaserJet IIP printer connected to the LPT1, your WIN.INI file would look something like,
HP LaserJet IIP=HPPCL,LPT1
To assign this printer to a text file the call to AssignPrn would be,
AssignPrn(F, 'HP LaserJet IIP', 'HPPCL', 'LPT1:');
You can obtain the list of valid parameter values using the Windows API function GetProfileString.
If Device is nil, Driver, and Port are ignored and AssignPrn will assign the default printer to F. The default printer is listed in WIN.INI under the keyword "device" in the [windows] section. This can also be achieved by callingwhich calls AssignPrn with Device, Driver, and Port set to nil.
If Windows' Print Manager is active, any text written to F is stored by the Print Manager and will be printed when the file is closed.