[comp.mail.elm] Printing from ELM to a printer attached to a PC

cookc@computing-maths.cardiff.ac.uk (Chris Cook) (06/05/91)

I've been trying to work out a way that you can print directly from Elm to 
a printer attached to a PC.  Several Vt100 emulators allow you to print 
direct to an attached printer by sending the sequences <ESC>[5i <ESC>[4i before
and after the desired section of text.  The printer in question is a Postscript
printer so we would have to pass it through a filter on the way.  All this is 
done by the local command 
                pspr -v filename
I've tried inserting this into the options page 
PRINT =  pspr -v %s
but the best I get is the message is sent to the default print queue.  Is there
something in Elm that says if the print option is invalid, send it to some sort
of default?  Is there any way this could be overcome - has anybody done this?
It would be a very handy feature as it would allow the printing of messages at
the push of a button, right to your desk.  Especially good if your a director
and am printing messages of a sensitive or confidential nature.

	Many thanks,

		Chris Cook - Postmaster

CookC@cardiff.ac.uk

"It was only when Lister noticed that the ashtray was nibbling at his elbow
that he realised he hadn't landed in paradise..."  Red Dwarf III - The Sixth
Universe

dwolfe@oakhill.sps.mot.com (Dave Wolfe) (06/06/91)

In <1991Jun5.141703.522@cm.cf.ac.uk> cookc@computing-maths.cardiff.ac.uk (Chris Cook) writes:

>I've been trying to work out a way that you can print directly from Elm to 
>a printer attached to a PC.  Several Vt100 emulators allow you to print 
>direct to an attached printer by sending the sequences <ESC>[5i <ESC>[4i before
>and after the desired section of text.

Maybe I'm reading too much into this, but it sounds to me like the
system running elm doesn't even know that the printer in question
exists.  When you print a file through the vt100 emulator w/ the escape
sequences, do you just use the regular print spooler or do you have to
copy the file to /dev/tty?

>The printer in question is a Postscript
>printer so we would have to pass it through a filter on the way.  All this is 
>done by the local command 
>                pspr -v filename
>I've tried inserting this into the options page 
>PRINT =  pspr -v %s
>but the best I get is the message is sent to the default print queue.

Sounds to me like pspr is sending its output to the print spooler and,
in the absence of a specific option or environment variable, that goes
in the default print queue.  RTFM for pspr (if such exists) to see how
to direct the output to a specific printer.

If the system doesn't know about the printer connected to the PC, then
you're probably going to have to direct pspr's output to a file and
blow that file down the line to the PC w/ the escape sequences.  A
shell script should work nicely; then just set elm's print command to
envoke that script.  Heaven help you if something else outputs to the
PC between the escape sequences, 'cuz that's going to get printed too
and it probably won't be valid postscript.

-- 
Dave Wolfe (dwolfe@oakhill.sps.mot.com)		| Motorola Incorporated
"[RISC is] like obscenity,			| MMTG (formerly MPG)
 we all know what RISC is when we see it,	| Austin, Texas  78735-8598
 but no one can define it."	Chris Torek	| m/d OE112  (512)891-3246

les@chinet.chi.il.us (Leslie Mikesell) (06/06/91)

In article <1991Jun5.141703.522@cm.cf.ac.uk> cookc@computing-maths.cardiff.ac.uk (Chris Cook) writes:
>I've been trying to work out a way that you can print directly from Elm to 
>a printer attached to a PC.  Several Vt100 emulators allow you to print 
>direct to an attached printer by sending the sequences <ESC>[5i <ESC>[4i before
>and after the desired section of text.  The printer in question is a Postscript
>printer so we would have to pass it through a filter on the way.  All this is 
>done by the local command 
>                pspr -v filename
>I've tried inserting this into the options page 
>PRINT =  pspr -v %s
>but the best I get is the message is sent to the default print queue.  Is there
>something in Elm that says if the print option is invalid, send it to some sort
>of default?

If the pspr program can take standard input, try using "|pspr -v" instead
of "p" to print.  I've never understood why print isn't just a special
case of piping or why elm doesn't just send out the data directly instead
of making readmsg parse the headers all over again each time you print.
If pspr insists on having a filename, you can make a little shell script
to capture stdin to a file before executing it.

Les Mikesell
  les@chinet.chi.il.us

grahamt@syma.sussex.ac.uk (Graham S Thomas) (06/06/91)

From article <1991Jun5.174013.16184@oakhill.sps.mot.com>, by dwolfe@oakhill.sps.mot.com (Dave Wolfe):
> In <1991Jun5.141703.522@cm.cf.ac.uk> cookc@computing-maths.cardiff.ac.uk (Chris Cook) writes:
> 
>>I've been trying to work out a way that you can print directly from Elm to 
>>a printer attached to a PC.  Several Vt100 emulators allow you to print 
>>direct to an attached printer by sending the sequences <ESC>[5i <ESC>[4i before
>>and after the desired section of text.
> 
>>The printer in question is a Postscript
>>printer so we would have to pass it through a filter on the way.  All this is 
>>done by the local command 
>>                pspr -v filename
>>I've tried inserting this into the options page 
>>PRINT =  pspr -v %s
>>but the best I get is the message is sent to the default print queue.

We have a program called micropr on our Unix machine, which sends a file
to a printer attached to a PC being used as a terminal.  Like you, we
found that the 'print' variable in elmrc doesn't let us use this.

However, we also found an easy solution.

Make sure the message you want to print is highlighted, then issue the
pipe command '|'.  Elm will ask you which program you want to pipe the
message through.  We just type in 'micropr', and it works.  Something
analogous ought to work for your pspr program.

Best of luck,

Graham

this

for the

50%

rule.
-- 
Graham Thomas, SPRU, Mantell Building, U of Sussex, Brighton, BN1 9RF, UK
Email: grahamt@syma.sussex.ac.uk   Phone: +44 273 678165   Fax: .. 685865

malc@equinox.unr.edu (Malcolm Carlock) (06/12/91)

In article <1991Jun5.141703.522@cm.cf.ac.uk> cookc@computing-maths.cardiff.ac.uk (Chris Cook) writes:
>
>I've been trying to work out a way that you can print directly from Elm to 
>a printer attached to a PC.

We have a utility here called PL which should do what you want, and in fact
its main use here is probably printing ELM messages to PC printers.  PL reads
from one or more files or from the standard input, and prints directly to the
terminal's printer port, if the terminal has such a capability according to
the Unix system's termcap or terminfo database.  Since PL uses termcap/terminfo,
it can be used with any terminal that supports such operations, including PC
terminal emulators (such as Kermit's VT102 and Procomm's VT100) that support
the appropriate ANSI control sequences.  PL comes with a set of terminfo/
termcap entries to support several terminals, including VT102, Heath-19,
Qume QVT102, Freedom 100, Wyse 50, and several Televideos (hint: the TVI's
all use the same sequence...)

PL is invoked using 'p' in elm, and appears in the option file as follows:

	print = pl -q %s 1>&2

The -q option turns off chatty "printing to your terminal's printer"
messages.  The intent here is to not mess up the ELM screen.  ELM seems
to intercept stdout from print programs, so the 1>&2 is there to redirect
stdout to stderr and get the data to the terminal no matter what.

PL is ftp-able from unr.edu (134.197.1.2), in pub/pl.  If you can't get
to unr.edu using ftp, let me know and I'll mail you the shar file.

Hope this helps.
-- 

Malcolm L. Carlock                      Internet:  malc@unr.edu
                                        UUCP:      unr!malc
                                        BITNET:    malc@equinox