Printer connection question

Stephen L Arnold arnold.steve at ensco.com
Wed May 19 18:08:29 GMT 1999


When the world was young, Craig Weatherhead <cweather at fastenal.com> 
carved some runes like this:  

[snip]
>  I then had to modify the smbprint file so that the only thing that I was
> utilizing was the smbclient part. I had to change the "print -" to "print
> $6" since it appears that when you do an lp <file-name> on the Sun
> machine, the sixth parameter is the name of the file. I had to do this
> because the "print -" was just giving me an error message stating that it
> couldn't find the file. I also hardcoded the printer share and the
> user-name and password.......
> 
>  (
>    echo translate
>    echo "print $6"
>    cat
>  ) /usr/local/bin/smbclient "<service-name-of-printer>" guest -U guest -P
> 
> This appears to print the file just fine except that it sits in the
> queue until another print job pushes it out.
> Basically, I'm just wondering if you can print to an NT printer
> utilizing the smbprint utility through smbclient without having to use lpr
> because my machine is running lpsched.
>  Does anyone have any experience with this? 

Don't know about lpsched (sorry), but it looks like all you need to 
do is add a form-feed to either your smbprint or your printfilter.  
You could do it with an lpr switch (see the man page) or send an 
escape code.  You might want to think about installing lprng (it's 
supposed to be really slick, cool, etc).  Here is a print filter 
with a bunch of PCL5 escape codes for formatting text, etc:

#!/bin/sh
#
# Filter for LaserJet 4MPlus to treat LF as CRLF and add some text
# formatting (uses PCL-5 escape codes).
# The "echo -ne" assumes that /bin/sh is actually bash, while the
# 033 is ascii char #27 (ESC) in octal.
#
echo -ne \\033\E # reset
echo -ne \\033\&k2G # treat lf as cr-lf
echo -ne \\033\&l0O # portrait mode
echo -ne \\033\&l8D # 8 lines per inch
echo -ne \\033\&l8E # 1" top margin (8 lines)
echo -ne \\033\&l66F # 66 lines per page
echo -ne \\033\&a10L # 1" left margin
echo -ne \\033\(10U # PC-8 symbol set
echo -ne \\033\(s3T # courier
echo -ne \\033\(s0P # fixed
echo -ne \\033\(s0S # upright
echo -ne \\033\(s0B # medium
echo -ne \\033\&k4S # 12 char. per inch
cat -
echo -ne \\f # form feed
echo -ne \\033\E

Hope this helps, Steve

****************************************************************
Stephen L. Arnold                        Senior Systems Engineer
ENSCO Inc.                        email:  arnold.steve at ensco.com
P.O. Box 5488                         www:  http://www.ensco.com
Vandenberg AFB, CA  93437                    voice: 805.606.8838
                                               fax: 805.734.4779
#include <std_disclaimer.h>
****************************************************************


More information about the samba mailing list