Printing to Windows Printers

I've had several people write to me not understanding that they need to PASTE THE CODE FROM THIS ARTICLE into "/usr/spool/lp/model/visionp"


Hate these ads?

NOTE: The 3.1 version of Visionfs ( latest version is always available from Sco's Vision Site) has a new method for installing printers. You can still use the method shown here, but the following command adds a new Unix printer called "winprint" and prints to a Windows share called "HP5" on the machine "Win98_17":



/usr/vision/bin/visionfs print --install winprint Win98_17 HP5



THIS ONLY WORKS BEGINNING WITH VERSION 3.1

You may still want to use this article (or J.P. Radley's version for the purpose of having more direct control. -Tony

Copyright © 1999 UniTech Informatica Ltda

Publishing Here

This is a little contribution to the sco users community. With this script, is possible send print jobs to printers attached to Windows, via lp(C) command using SCO VisionFS.






The script, by default, converts CR to CR+LF to avoid overprinting but, with the -oraw option this feature can be disabled.

I have many clients using this resource with success.

Instructions for installation and configuration are in the beginning of script.

Jose Fernando Scheid Mascarenhas
UniTech Informatica Ltda



==========================================================================>>>
CUT HERE
:
#       @(#) VisionFSp 1.1 99/01/26 
#
#       Copyright (C) 1999 UniTech Informatica Ltda
#                          Jose Fernando Scheid Mascarenhas
#                          SCO Premier Reseller - Brasil
#                          Todos direitos reservados.
#
#       The information in this file is provided for the exclusive use of
#       the licensees of The Santa Cruz Operation, Inc.  Such users have the
#       right to use, modify, and incorporate this code into other products
#       for purposes authorized by the license agreement provided they include
#       this notice and the associated copyright notice with any such product.
#       The information in this file is provided "AS IS" without warranty.
#
#!      VisionFS Printers
#
#       Options: lp -oraw  file-name ...  Send without CR to CR+LF convertion
#
#       This script will redirect the print job to the shared printer
#       specified in the Description field of mkdev lp.
#
#       Ex.:
#
#       mkdev lp
#       
#       Printer ---> Add Local
#       Name: winptr
#       Description:  SHARE=//winstation1/epson
#       Model: visionp
#       Device: /dev/null
#
#       ATTENTION: Change the permission of vfscinfo and vfsprint.
#
#       cd /usr/vision/visionfs/bin/i3sc0325
#       chown root vfscinfo vfsprint
#       chmod u+s vfscinfo vfsprint
#




M3IP inc.


       



###########
## Check arguments
###########



parse () {
        echo "`expr \"$1\" : \"^[^=]*=\(.*\)\"`"
}




#Set up some global variables.
: ${SPOOLDIR:=/usr/spool/lp}
: ${LOCALPATH:=${SPOOLDIR}/bin}
: ${COMMENT:=${SPOOLDIR}/admins/lp/printers}



#Set up printer share name in comment file



PNAME=`basename $0`
PDEST=`lpstat -p${PNAME} -l | grep "Description"`
PDEST=`expr "${PDEST}" : '.*=\(.*\)'`



#Set up VisionFS location
if [ -x "/usr/vision/bin/visionfs" ]
   then
   VISIONFS="/usr/vision/bin/visionfs"
else
  if [ -x "/usr/local/vision/bin/visionfs" ]
     then
     VISIONFS="/usr/local/vision/bin/visionfs"
  else
     VISIONFS="visionfs"
  fi
fi




#Set up the default filter.
if [  -x "${LOCALPATH}/lp.cat" ]
then
        LPCAT="${LOCALPATH}/lp.cat 0"
else
        LPCAT="cat"
fi



#If we are not using a filter, use the default one.
if [ -z "${FILTER}" ]
then
        FILTER="${LPCAT}"
fi



if [ -x "${LOCALPATH}/drain.output" ]
then
        DRAIN="${LOCALPATH}/drain.output 1"
else
        DRAIN=
fi



printer=`basename $0`
request=$1
name=$2
title=$3
copies=$4
options=$5
shift; shift; shift; shift; shift



# border around the banner
x="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"



banner=no
raw=no



if [ -z "${BANNERS}" ]
then
        nhead=1
else
        nhead=${BANNERS}
fi



for i in $options; do
        case $i in
        b|nobanner)     banner=no
                        ;;



        r|raw)          raw=yes
                        ;;



        esac
done




[ "$banner" = yes ] && {
        # get the local system id
        if test -r /etc/systemid; then
                sysid=`sed 1q /etc/systemid`
        else
                sysid=`uname -n`
        fi



        # user = fifth field of /etc/passwd
        user=`sed -n "s/^$name:.*:.*:.*:\(.*\):.*:.*$/\1/p" /etc/passwd`



        # nhead gets the value of BANNERS or 1 by default
#       nhead=`sed -n 's/^BANNERS=//p' /etc/default/lpd`
#       [ "$nhead" -ge 0 -a "$nhead" -le 5 ] || nhead=1



        # print the banner $nhead times
        while   [ "$nhead" -gt 0 ]
        do
                echo "$x\n"
                banner "$name"
                echo "$x\n"
                [ "$user" ] && echo "User: $user\n"
                echo "Request id: $request\n"
                echo "Printer: $printer\n"
                date
                echo "\nMachine: $sysid\n"
                [ "$title" ] && banner $title
                echo "\f\c"
                nhead=`expr $nhead - 1`
        done
}



# send the file(s) to the standard out $copies times
while   [ "$copies" -gt 0 ]
do
   for file
   do
    if [ "${raw}" = "yes" ]
       then
       $VISIONFS print $PDEST ${file}
    else
       awk -e '{printf("%s\r\n",$0);}' < $file | $VISIONFS print $PDEST -
    fi
   done
   copies=`expr $copies - 1`
done



exit 0
==========================================================================>>>
CUT HERE


Note: this script needs to be installed as /usr/spool/lp/model/visionp before you can use it. To do this, cut and paste the lines betwwen the "=======>>" lines into that file name (it won't currently exist; you need to create it).

See also /Unixart/jprdiff.html for an HPLaserJet version of this.



Comments /Unixart/visprint.html


Add your comments

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


ad

Views for this page
Today This Week This Month This Year  Overall
626127988 12,373

/Unixart/visprint.html copyright March 1999 UniTech Informatica Ltda 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:
       - Windows
       - Printing
       - OSR5




Unix/Linux Consultants

Your ad here - $24.00 yearly!

SCO, OpenServer, UnixWare, software, servers, security, networks, installation, administration, troubleshooting, maintenance, Watchguard, firewalls, VPNs, e-mail. Visit us at http://opensystemscomputing.com and www.go2unix.com.


http://www.cleverminds.net Need expert advice? Want a second opinion? CleverMinds is a one-stop-shop for a wide range of technology solutions. We support Unix, Linux, SCO as well as CMS, ecom, blogs, podcasts, search engines consulting and more. Contact us at web2.0@cleverminds.net 0r (617) 894-1282


http://bcstechnology.net Full service Linux & UNIX systems integrator; Windows to UNIX/Linux Client-Server Specialist; Secure E-Mail & Website Hosting; Thoroughbred Software Developer; Custom Industrial Automation; Hardware & Electronics Experts; In Business Since 1985.




card_image








Change Congress

Related Posts