APLawrence - Information and Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds Get APLawrence.com by RSS











(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Home > FAQ > How do I do Transparent or pass-through printing?
Printer Friendly Version




SCO Unix ® FAQ section

This article is from a FAQ concerning SCO operating


systems. While some of the information may be applicable to any OS, or any Unix or Linux OS, it may be specific to SCO Xenix, Open Desktop or Openserver.

There is lots of Linux, Mac OS X and general Unix info elsewhere on this site: Search this site is the best way to find anything.

Printing FAQ

How do I do Transparent or pass-through printing (slave printing)?



Many terminals, and just about all terminal emulators, have the ability to do "local" printing. It's sometimes called "transparent printing" or "pass-through", but the idea is that if the terminal sees a special key sequence, it will start sending the data out some other port (parallel or serial) until it sees some sequence that tells it to stop.

In general terms, it's a lousy way to print. If you can possibly do this any other way, you'll be much better off.

If you have an intelligent multiport card serving these terminals, the vendor may have provided a way to make this better (still not great, but definitely much better). Digiboard, for example, creates transparent print devices that match your tty id's- if you have terminals /dev/ttyb01 through /dev/ttyb16, you also have /dev/prb01 through /dev/prb16, and as long as you have told the Digiboard driver what escape sequence will start and stop the printing (common terminal types like ansi and wyse60 are configurable by name), the driver will do a nice job of handling this for you: anything directed at those "pr" ports will get printed.

If you don't have something like this, you use commands like "lprint" (SCO OSR5) or you wrap your data in the start-stop sequences yourself. You can find the start-stop sequences in /etc/termcap: PN is the sequence to start local print; PS is the sequence to stop. For example, if you look at the vt100 entry, you'll see:

:PN=\E[5i:PS=\E[4i:\
 

That means that to start local printing on a vt100 terminal (or any ansi emulator) you'd echo an ESCAPE (ascii 27) followed by the characters "[5i". You'd then send the stuff to be printed, and stop with ESCAPE-[4i. You could also use "tput prtr_on" and "tput prtr_off" to send the codes if they are defined in terminfo.

But again, before you do this, consider your other choices: if this is a printer on a Windows network, both Visionf and Samba can treat that as a Unix printer. Or, there are Windows LPD programs that allow Windows to be treated as an LPD server ( see /Reviews/alphacom3.html for one).

If this is Windows with an emulator, the emulation software will either use the "default" Windows printer or will let you specify which printer to use. You may not be able to use the so-called "Windows" printers - the ultra-cheap inkjet printers that I do not recommend but that are so common nowadays and require tremendous support from drivers.












If it is a real terminal, the auxiliary printer port may be serial or parallell. If it just says "AUX", it's serial.

Debug this stuff by putting the appropriate codes into a file you can "cat". Put in the start code, some text, and the stop code. You can use Vi for this: to enter characters like ESC, hit CTRL-V first. So, to enter ESC [ 4 i in vi, you would type:

i (enter insert mode)
Ctrl-V  (want to enter control character)
ESCAPE  
[
4
i
ENTER
ESC (end insert mode)
 

Your whole session might be (keys shown on separate lines for clarity; don't press ENTER unless shown)

vi mytest
i
CTRL-V 
ESCAPE 
[ 
5 
i 
ENTER
This will be printed
ENTER
CTRL-V
ESCAPE
[
4
i
ESCAPE
:
w
q 
ENTER

Cat that file, and you should print the text. If it prints on the screen, the start codes are wrong. If it never stops going to the printer, the stop codes are the problem. If nothing at all happens, the codes are probably right but something is wrong at the printer interface.

You may also have problems with flow control or the amount of data sent. Some of the products like Digi allow you to control how much print data is sent in each burst.

See also http://www.anzio.com/support/whitepapers/printguide.htm and Terminals

Cups and transparent printing

Like many all too helpful programs, Cups can give you grief with transparent printing. The problem is that Cups sees the serial line as busy because a getty or agetty process is using it.

The way around it is to fake Cups out with a named pipe. You create a printer using the named pipe as its serial device to wite to, and you have a background script reading that to send the data where you really want it.

For example, you created /dev/myterminalpipe and gave it perms so Cups can write to it. You create a serial printer in Cups that uses that device as its output. Your background script picks up data written to that and sends it to the place you want:

while :
do
exec </dev/myterminalpipe
cat > /dev/prb01
done
 

See A solution to transparent printing using cups in Linux for details.


If this page was useful to you, please click to help others find it:  

Your +1's can help friends, contacts, and others on the web find the best stuff when they search.

Comments?




More Articles by



Click here to add your comments



Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar



Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.


My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!


book graphic unix and linux troubleshooting guide


 I sell and support
 Kerio Mail server
pavatar.jpg

This post tagged:

       - FAQ
       - Printing
       - Terminals




Unix/Linux Consultants

Skills Tests

Guest Post Here