Printing
If everything is working, you should now be able to print. Feed a piece of paper into the printer and send a test print from the Terminal with, for example echo "this is a test" | lpr -P cables2go_IEEE-1284_Controller
Those unfamiliar with printers of this era — you may need to take the printer off-line to advance the paper, then put it back on-line to print. The off-line/on-line toggle goes by different names on different printers; on the NEC it’s just called “print”.
For text files of any length, simply piping the files to the printer will probably not produce the output you want — these printers do not recognize when they have reached the end of the page and will cheerfully print past the end of a line. Further, if told to go to a new line, but not to back up to the left, they will produce bizarre laddered text, and if told to go back to the start of the line but not to advance the roller, they’ll print right on top of the text they just printed. There are two solutions to this:
1. force line-ends in the software that creates your files. Most sophisticated text editors can do this. In a normal typeface, 80 characters will fit neatly across an 8.5” page. It is important that you save such files in ‘DOS’ format, which includes both carriage return and linefeed commands at the end of each line. If you can not save in this format, don’t bother forcing line-ends at all; they won’t work. On the Mac, I use TextWrangler.
2. Alternatively, you can pipe the file through a UNIX utility that breaks your text into lines (fold -s
) , and then through a second command that converts the breaks into the carriage returns and linefeeds the printer needs. There are dedicated utilities that you can install to do this latter task (dos2unix
), or you can use awk
another similar, more general translation tool.
I generally use the latter path, printing the file example.txt with a command like
cat example.txt | fold -s | awk 'sub("$", "\r")' | lpr -P PrintAdapter
Forcing line breaks as in the first proposed solution can create a bit of a hassle with later edits; the fold -s | awk | lpr
solution is therefore more general and typically easier.
The following idea gives some idea of the interaction of file format and output processing
line-end | forced linebreaks | fold-s | awk | print |
CR | bad | bad |
LF | bad | good |
CRLF | good | good |