<< Back to man.ChinaUnix.net

8.5 Printing PostScript and DOS command files

One problem with printing under Win31 and Win95 with the LPR methods discussed is the lack of a “raw” LPT1: device. This is annoying to the administrator who wants to print an occasional text file, such as a file full of printer control codes, without their being intercepted by the Windows printer driver. Of course this is also an issue with DOS programs, but a commercial site that runs significant DOS software and wants to print directly to UNIX with LPR really only has one option--to use a commercial TCP/IP stack containing a DOS LPR program.

Normally, under Windows printing, virtually all graphical programs print through the Windows printer driver. This is true even of basic programs such as Notepad. For example, an administrator may have a DOS batch file named filename.txt containing the following line:

echo \033&k2G > lpt1:

This batch file switches a HP LaserJet from CR-LF, MS-DOS textfile printing into Newline termination UNIX textfile printing. Otherwise, raw text printed from UNIX on the HP prints with a stairstep effect.

If the administrator opens this file with Notepad and prints it using a regular printer driver, such as an Epson LQ, the Windows printer driver encapsulates this print output into a series of printer-specific control codes that do things such as initialize the printer, install fonts, and so on. The printer won't interpret this output as control code input. Usually, if the printer is locally attached, the user can force a "raw text print" of the file by opening a DOS window and running:

copy filename.txt lpt1: /b

Since the LPR client program doesn't provide a DOS driver, it cannot reroute input from the LPT1: device ports. The solution is to use the Generic / Text Only printer driver in conjunction with Wordpad (under Win95); under Win31 use a different text editor. The Notepad editor supplied with Windows is unsuitable for this - it "helpfully" inserts a 1 inch margin of spaces around all printed output, as well as the filename title. Wordpad supplied with Win95, can be set to use margins of zero, and inserts no additions into the printed output. Also, make sure that banner pages are turned off, and the print type is set to raw.

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.