[Samba] Samba PDF printer...

Gus Brown lists at 9d8.com
Fri May 28 16:24:54 GMT 2004


Hello

Using Samba 2.2.8a on a Redhat 7.2 box

I set up a PDF generator relying on Samba and a shell script to create 
the output.

This works fine but I have a further trouble that I am stumped by.  The 
files cannot be viewed from within a Citrix session (the point of the 
entire exercise) unless they are available from this one NT Server 
share.  So if I mount a Windows NT server share under '/mnt/gpsc/pdfs' 
and then redirect the output to that directory, everything looks like it 
works but I get no output.

I can create/edit files, as a variety of users, on this NT share from 
the Linux box so I think that part is fine but I cannot do this from 
Samba.  I would normally expect some sort of complaint in the form of a 
log entry but nothing shows up in the logs (log level = 3).

---------8<----snip from smb.conf-----------

[PDFFiles]
         path = /mnt/gpsc/pdfs
         invalid users =
         read only = No
         guest ok = Yes

[Create a PDF]
         comment = Check your 'K:' drive for your .PDF file.  Check in 
the folder named 'PDFFiles'.
         path = /tmp
         guest ok = Yes
         printable = Yes
         print command = /usr/local/bin/printpdf %s %m %U

---------8<----end snip from smb.conf-----------

*AND*

---------8<----snip from 'printpdf'-----------
# !/bin/bash
# /usr/local/bin/printpdf
# written by Blue Groper
# Last modified 29/9/03 (d/m/y)
# Modified by Anzac 25-1-04
# Modified by Steven Macfarlane 27.5.04 - Trying to get it to write to 
'/mnt/gpsc/pdfs'
#
# Script to generated pdf files and a message for Windows domain users
# with filename.  Windows 98 clients must have WinPopup loaded.
#
# Count = value from /etc/pdf/pdfcount files.  Used for part of output 
filename.
SAMBAUSERNAME=$1

# (%s from /etc/samba/samba.conf call)
MACHINENETBIOSNAME=$2

# (%m from /etc/samba/samba.conf call)
NAMEFILE=$3

# (%U from /etc/samba/samba.conf call)
OUTPUTDIR=/mnt/gpsc/pdfs

# (Can be mapped in GPSC domain as network drive Q: if required for 
MESSAGE below)
# Write the variables somewhere, handy when it is broken
# Uncommment line below if no output file see if file is being created

# Must comment out MachineNetBiosName line for this to work
#echo "SambaPrintFileName: $1">/tmp/pdfdebug

# Machine name to check popup going to correct netbios name
echo "MachineNetBiosName: $2">/tmp/pdfdebug

# Username supplied to samba for creating filename
echo "SambaUserName: $3">>/tmp/pdfdebug

# Options are not essential, but useful to control finer features of pdf's
OPTIONS="-dSubsetFonts=true -dEmbedAllFonts=true"

# Counter ensures meaningless but unique filenames
PDFCOUNTFILE=/etc/pdf/"pdfcount"
if [ -f $PDFCOUNTFILE ] ; then
COUNT=`cat $PDFCOUNTFILE`
else
COUNT=0
fi
let COUNT=COUNT+1

# write counter to /etc/pdf/pdfcount
echo "$COUNT">$PDFCOUNTFILE

# filename for pdf output based on Windows Username and COUNT number
OUTPUTFILENAME=$NAMEFILE-$COUNT.pdf

# Send the message first to make it seem faster.

MESSAGE="\\134\134PdfServer\134pdfs\134$OUTPUTFILENAME has been created"
echo -e $MESSAGE | smbclient -M $MACHINENETBIOSNAME -U "PDF SERVER" > 
/dev/null 2>&1

# Finally, make the pdf...
ps2pdf13 $OPTIONS /tmp/$SAMBAUSERNAME $OUTPUTDIR/$OUTPUTFILENAME

# Remove the temporary file written by Samba
  rm /tmp/$SAMBAUSERNAME

# End

---------8<---- end snip -----------

Any helpful guidance would be welcomed,

Thank you for reading

Gus


More information about the samba mailing list