[Samba] PDF Print command

Martyn Ranyard ranyardm at lineone.net
Tue Mar 26 06:36:05 GMT 2002


At 08:25 AM 3/26/02 -0500, Charles Marcus wrote:
>I am very interested in setting up something like this for our network, 
>and had a couple of questions:

Always happy to help.

>I like this.  The first time I tried to set this up we had major problems 
>with filenames of documents created in M$ - they all started with 
>'Microsoft Word blah blah'...
>
><snip>
>
> > Other bits : I tried to use a magic script to do the
> > processing, but as the clients needed to create files in the
> > ToPDF directory, the magic script got erased. Grrr.
>
>Couldn't you have just named it .MagicScript so no one could see it?  Or 
>did you try that?

The way Magic Scripts are implemented in samba is you open them on the 
Client, close them, and they run on the server. THEY THEN GET DELETED, 
assuming the user connecting has permissions to delete files in the 
directory, which in unix is the same as being able to create files in the 
directory.  This is an annoyance, but the way samba implements it.  I 
didn't want to touch the source as I might get tainted by C.

Also, hiding it wouldn't help, as you could not then open it, and anyway, 
my clients are all programmers and have all got "show all files" on.

>Also, you could have just placed a copy of the script in another location, 
>and set the cron job to check for the existence of the script, and if it 
>was gone, recopy it.  That way you still have the immediate functionality 
>of the script - think I'll try that...

Could have, but couldn't really be bothered doing that much work at that 
point, when a cron job only adds up to a minute of time waiting for the 
pdf.  I'm gonna wait till VFS objects are stable.

><snip>
>
> > so without any more delay, here's the script (remember to put
> > it in crontab every minute - it checks if it has already
> > processed the files before processing them again so it
> > shouldn't be too processor intensive.)
>
>Hmmmm... since I'm not a programmer, my ignorance is gonna be readily 
>apparent here, but do you not delete the file once the PDF has been 
>created?  These things would pile up rather quickly if not.

I felt (as we were low-usage creators of PDF) that it may come in handy to 
keep the PS file, as then we can take it straight into illustrator etc. and 
edit it without looking for the original.

>Also, what happens if one with the same name already exists?

The script checks for Postscript files that have no pdf files created 
already, and then creates them, so if a pdf exists and a postscript file is 
created with the same name, it will not be overwritten.  That is by design, 
you could of course delete the postscript files, and then just remove the 
if command to let all files be generated that aren't pdfs.

The point is, if someone calls their file "My letter.ps" or "My letter.prn" 
it will create a "My letter.pdf" rather than some arbitrary name that 
Windows Printing specifies.

>Thanks!  This looks much better than the other method I was trying to use.

Hope it helps you.

Martyn

Life's a bitch, but so am I.

icq - 122500800
irc - Joran on OPN
msn - ranyardm at hotmail.com
y!  - ranyardm
e   - ranyardm at lineone.net





More information about the samba mailing list