On Tue, 2003-03-25 at 13:12, M. Robert Martin wrote: > Here's my simple pdf-writer script on Samba: > > 12:44:49 db root/# cat /usr/local/bin/printpdf.pl > #!/usr/bin/perl -w > use strict; > use Getopt::Long; > > my $file =''; > my $user = ''; > my $ps2pdf = `which ps2pdf`; > chomp $ps2pdf; > > GetOptions( 'file=s' => \$file, 'user=s' => \$user) or die; > my $outfile = "/vol1/home/guest/$user-" . time . ".pdf"; > > $ps2pdf .= " /tmp/$file $outfile"; > > `$ps2pdf`; > unlink($file); > > And in smb.conf: > [pdf] > path = /tmp > printer admin = rob > guest ok = Yes > printable = Yes > postscript = Yes > print command = /usr/local/bin/printpdf.pl -f %s -u %U > lpq command = > lprm command = >
I wrote my pdf (and jpg printer) script in Python... to each his own. :) Its at work behind a firewall; maybe I'll post it later if I remember. The script is a cups backend. (I did it this way so that Netatalk can share the same cups printer that samba uses.) It uses the arguments sent from samba to determine the user and filename that is printed. I am able to get filenames from just about any program, including AutoCAD. 30"x48" PDFs/JPEGs from AutoCAD. :) I use regular expressions to clean out unacceptable windows filename characters, and to change stuff like "Microsoft Project - Pennzoil 3rd Floor.mpp" to "Pennzoil 3rd Floor.mpp". I also check for files that already exist by the same name and append a sequence number to new files if needed so that nothing gets overwritten. Taking the username, I have the script create a folder for each user (the first time they make a print) on a mounted Windows share; you could easily store the share on the Linux box, of course. The file has a .tmp extension until the file is completely written, in which it is changed to .pdf or .jpg. As far as security goes, it is possible to have the script change the permission on the file (or containing directory) based on the user that printed it. I use AdobePS drivers, which I have set up to download automatically to new windows clients directly from the Linux box, just like a standard Windows Print Server (Point-and-Print). > > -- > [EMAIL PROTECTED] mailing list -- Jimmie Fulton <[EMAIL PROTECTED]> -- [EMAIL PROTECTED] mailing list
