Summary: smbprint with PCL/PJL statements

Mike Box mbox at cleopas.stat.vt.edu
Fri Dec 15 17:06:57 GMT 2000


Thanks to Glenn Burkhardt, Richard Brodie, and John P. Nelson for their 
responses.

Suggested reference documents:
http://www.maths.usyd.edu.au:8000/u/psz/ps.html
http://www.ettl.co.at/heiligenblut/mike/pcl5/pjltkref.pdf
http://www.ettl.co.at/heiligenblut/mike/pcl5/ctechref.pdf

Below is the modified smbprint.sysv that includes PCL/PJL to print w/o manual
intervention.  You may need to use the comments to recover control characters in 
the PCL/PJL control statements.

Mike Box                       Phone: (540)231-9506
Systems Administrator            Fax: (540)231-3863
Department of Statistics      E-mail: Mike.Box at vt.edu
Virginia Tech

-------------------------------Cut-Here---------------------------------------
#!/bin/sh
#
# @(#) smbprint.sysv version 1.0 Ross Wakelin <r.wakelin at march.co.uk>
#
#      Version 1.0 13 January 1995
#		modified from the original smbprint (bsd) script
#
# this script is a System 5 printer interface script. It 
# uses the smbclient program to print the file to the specified smb-based 
# server and service. 
# 
# To add this to your lp system, copy this file into your samba directory 
# (the example here is /opt/samba), modify the server and service variables 
# and then execute the following command (as root) 
#
# lpadmin -punixprintername -v/dev/null -i/opt/samba/smbprint 
# 
# where	unixprintername is the name that the printer will be known as 
# on your unix box. 
# 
# the script smbprint will be copied into your printer administration 
# directory (/usr/lib/lp or /etc/lp) as a new interface 
# (interface/unixprintername)
# Then you have to enable unixprintername and accept unixprintername
#
# This script will then be called by the lp service to print the files
# This script will have 6 or more parameters passed to it by the lp service.
# The first five will contain details of the print job, who queued it etc,
# while parameters 6 onwards are a list of files to print.  We just
# cat these at the samba client.
#
# Set these to the server and service you wish to print to 
# In this example I have a WfWg PC called "lapland" that has a printer 
# exported called "printer" with no password.
#
# clear out the unwanted parameters
shift;shift;shift;shift;shift
# now the argument list is just the files to print

server=admin
service=hplj2
password=""

(
# NOTE You may wish to add the line `echo translate' if you want automatic
# CR/LF translation when printing.
       echo translate
	echo "print -"
	echo `tail -2 $0 | head -1`
	cat $*
	echo `tail -1 $0`
) | /opt/samba/smbclient "\\\\$server\\$service" $password -N -P  > /dev/null
exit $?

Character and hexadecimal display (from od command) of PCL statements below:
0000000 033   %   -   1   2   3   4   5   X 033   E
            1b25    2d31    3233    3435    581b    4500

0000000 033  \f 033   E 033   %   -   1   2   3   4   5   X
            1b0c    1b45    1b25    2d31    3233    3435    5800

DO NOT DELETE THESE PCL STATEMENTS:
%-12345XE
E%-12345X345X
---------------------------------Cut-Here---------------------------------------





More information about the samba mailing list