On Thu, 31 Oct 2002 16:22:55 -0500 (EST)
Daniel E Singer <[EMAIL PROTECTED]> wrote:

> And, in our Samba `smb.conf' file, we've replaced these lines:

<SNIP>

> with these:
> 
>       print command = /usr/cs/bin/samba_lpr -r -P%p %s
>       lprm command = /usr/cs/bin/samba_lprm -P%p %j
>       lpq command = /usr/cs/bin/samba_lpq -P%p
> 
> `samba_lpr' is just a wrapper for the lpr commands, and if the printer
> name has a "-h" suffix, then the suffix is stripped and a "-h" option
> is added to the command arguments; then the appropriate command is
> exec'd with the otherwise same argument list.  The samba_lpr script is
> attached.

While you're at it, you can put in some added perl (or other language) goo to get the 
job name and submit it with to lpr with the -J flag...then the document name shows up 
in the queue correctly from both the Windows and Unix side of things (without using 
temporary SAMBA filename).

Our lpr wrapper looks something like this:

if ($#ARGV !=1){
  die "Usage: lpr <printer> <printjob>\n";
}

$printer = $ARGV[0];
$printjob = $ARGV[1];
$reallpr = "/s/std/bin/lpr";

open PJOB, $printjob || die "Error: could not open $printjob";

$title = $printjob;
while (<PJOB>) {
    if ($_ =~ /^%%Title: (Microsoft PowerPoint - |Microsoft Word - )?(.*)$/) {
        $title = $2;
        $title =~ s/
//g;
        last;
    }
}

close PJOB;

# Build up print command
$command = $reallpr." -P".$printer." -J\"".$title."\" -r ".$printjob;

# Go print the job
exec($command);


============================================================================
   John Perkins                   |   University of Wisconsin-Madison
   Associate Researcher           |   Department of Computer Science
   [EMAIL PROTECTED]               |   1210 W. Dayton St.
   608-262-0438/608-262-9997 FAX  |   Madison, WI  53706-1685
============================================================================



-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address

If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
to subscribe to a list with name LIST,  send mail to [EMAIL PROTECTED]
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr>     |  unsubscribe lprng [EMAIL PROTECTED]

If you have major problems,  send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------

Reply via email to