nroff and printing

Brian K. White brian at aljex.com
Mon May 14 17:32:43 PDT 2007


----- Original Message ----- 
From: "Dennis Malen" <dmalen at malen.com>
To: "Kenneth Brody" <both at hvcomputer.com>; 
<filepro-list at lists.celestial.com>
Sent: Monday, May 14, 2007 6:34 PM
Subject: nroff and printing


> When passing an nroff file (where the underlying file was created in
> filepro) off to the printer must I have the printer set to any particular
> configuration? When passed through to a PCL or ASCII printer, the carriage
> return does not work. The end of the line is continued at the next column
> but on the next line down.
>
> I am using the following:
>
> nroff {name of file created by filepro} | lp -d{name of printer} -s
>
> With or without the -s provides the same results.
>
> When the following command is used, it writes it to the screen correctly 
> and
> the form is perfect:
>
> nroff {name of file created by filepro}|pg
>

nroff takes device independant input, and outputs various forms of output 
taylored to various types of devices.
You have chanced upon a command that outputs ok for a terminal screen, and 
are expecting that same data to be correct for a printer.
Output that is appropriate for pg + your terminal, is not necessarily also 
appropriate for a printer.

The man page for the linux nroff actually says it's only meant to be used by 
man( to display man pages on your screen), which might explain why without 
any arguments it's defaulting to doing the right thing for a screen, where I 
would have thought normally the default for the roff family (groff, troff, 
nroff) would be ps (postscript)

If this is linux, and if you are printing to a laser printer, then the most 
correct thing is probably to use:
groff -T lj4 file |lp
as per the groff man page.

The crude option to just get the linefeeds converted without really knowing 
why they're generated wrong in the first place and fix that instead, would 
be one of these:

for sco
nroff file |xtod |lp

for linux;
nroff file |unix2dos |lp

That will only fix line-endings though. things like bold text will still be 
wrong.
 *roff knows several different ways to make, for example, bold text on your 
screen:
1) character, backspace, underline       # sometimes interpreted as 
underline, emulating what an old matrix or daisy wheel printer would do
2) character, backspace, same character  # sometimes interpreted as bold,as 
in over strike or double strike, again emulating what a printer would have 
to do
3) various ansi escape sequences for colors or underline or reverse video 
etc..

1 & 2 might actually still work ok on some printers (they started out as 
printer gimmicks for old, simple printers) but none of the several different 
things 3 encompasses works at all on any printer.

So the real answer is use the correct arguments with *roff for the device 
you are sending data to, and the man page for nroff also seems to imply it's 
more correct to use troff or groff for this not nroff. If on linux try this:
groff -T lj4 file |lp

I don't know offhand what the available -T options are on sco. one is 
probably "ps" which would work on postscript printers at least, but thats a 
pretty limited set of printers. "ascii" is definitely there and will 
probably work simply because it basically removes all formatting codes and 
send just the plainest text. So it'll work but not look nice.
Also on sco you can install gnu groff as part of gnutoools or gwxlibs and 
use groff commands that work on both sco or linux (or freebsd or whatever)

Brian K. White    brian at aljex.com    http://www.myspace.com/KEYofR
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro  BBx    Linux  SCO  FreeBSD    #callahans  Satriani  Filk!



More information about the Filepro-list mailing list