Sending output to a file

Category

Code Based - General

Question

Code Based - General

Solution

There is an undocumented command called SetOutputName which allows you to redirect the assigned port that the current printer is assigned to. This port can be another I/O device such as 'LPT2:' or can be a file name like 'C:\TEST.DAT'. This can be useful for some printer caching systems, a SneakerNet or just for saving the actual data that is being sent to the printer.

Example:

{ Send raw printer output to C:\PRINTER.BIN }
  ReportPrinter1.SetOutputName('C:\PRINTER.BIN');