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

What is a virtual printer?

You can have a printer that sends its output to another printer; pipe the final output to lp -s -dotherprinter You'll probably want the first printer's device to be /dev/null, but consider that it does not have to be: you can have a printer that prints to multiple places at the same time.


Hate these ads?

This scheme can be very useful for network printers that use lpd. Rather than trying to pass options through, front end with a script that does whatever needs to be done (like running it through /usr/lib/lponlcr) and then passes it to the lpd printer.

This is how you do "virtual" printers: many names all going to the same print device, but all with diferent options. This is often easier than handling all the testing for different switches inside one interface, and it gives you mnemonic names like "HPLandscape", "HPLetterTray", etc.

The simplest model for that is to create your own script:



shift; shift; shift; shift; shift
cat $* | lp -s -d otherprinter


 


Another way is to use the "network" script. Let's say you want to actually send to "kyocera":

 cp /usr/spool/lp/model/network /usr/spool/lp/model/yourscript
 vi /usr/spool/lp/model/yourscript
 (add whatever you need and then)
 /usr/lib/lpadmin -p wrapit -m yourscript -v /dev/null
 /usr/lib/accept wrapit
 enable wrapit
 echo "wrapit: lp -dkyocera" >> /usr/spool/lp/remote
 

You also need to remove the lines near the top of the script that say:



[ -r $mapping ] || exit 2
set -- `grep -e "^$printer:" $mapping` || exit 3
shift
network=$*


Now when you print to "wrapit", it will go to the kyocera carrying whatever you added in the script.

If you have 5.0.6 or newer Roberto Zini offers:




Early this year I made some tests and they actually worked; as an example:



. create the /tmp/myfilter.sh script



. this script is made of the following lines:



#!/bin/sh
hd



. give this script 755 permissions



. modify your /etc/printcap file and add, on the line which refers to 
the remote printer, the "of=/tmp/myfilter.sh" statement



. run the Printer Manager and restart both local & remote print services



. now print by using "lp -d<your_printer> filename



You should end up having the hex dump of the <filename> printed on the 
remote printer.



Please notice that I customer of ours was unable to get the same results 
until he removed and reinstalled a just-downloaded copy of RS506A.


See also Using Netcat for a simple lpr client by Carsten Hammer


Technorati tags:  

Comments /SCOFAQ/FAQ_scotec7virtualprint.html


Add your comments

ad

Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner


Change Congress

Views for this page
Today This Week This Month This Year  Overall
4681681,255 1,847

/SCOFAQ/FAQ_virtualprint.html copyright 1997-2003 (various) All Rights Reserved

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

More:
       - FAQ




Unix/Linux Consultants


UBB Computer Services Support for Openserver, Unixware and Linux. Windows integration with Unix/Linux servers. Hardware, Backup and Networking issues. Located near Sacramento CA, we provide onsite support throughout Northern CA and Nationwide via remote access. We are a SCO Authorized Partner and a Microlite BackupEdge Certified Reseller.


http://www.schewanick.com SCO Unix, Solaris, Linx (various), PHP, MySQL, Apache, uniBasic, dL4, Perl, System Administration and more....


http://www.vss3.com SCO/Caldera OpenServer, Unixware & Linux. Tarantella & Non-stop Clustering


Twitter
  • May 16 08:08
    My tea tastes like chlorine. I dumped it out, tried just the teawater. That's fine. Why does my tea taste like chlorine?
  • May 16 07:31
    Have stayed away from the gym most of the week - my neck is feeling better.




card_image








Change Congress

Related Posts