[Samba] PDF Print command

Wouter Verhelst wouterv at isw.be
Tue Mar 26 01:28:03 GMT 2002


Since everyone now starts asking me privately how I set up that PDF 
Printer, I suppose I'd better post that here instead of privately 
replying to everyone interested ;-)

Unfortunately, I don't have the exact script anymore. However, the 
procedure is fairly simple: All you need is Samba (obviously), GNU 
Ghostscript and a way to get the resulting PDF file to the user; I used 
the 'mime-construct' Perl program for that purpose, but there are other 
ways too, of course.

The required ghostscript call is as follows:

gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=output.pdf input.ps

You can write a script that takes the path&filename of input.ps and the 
username as its input (see the '%s' and '%u' Samba substitutions to get 
these) and that gets the result to the user in some way. As said, I used 
mime-construct to send the PDF as a MIME-attachement to the user, but 
this has its drawbacks in that your mailserver administrator may not 
like someone printing a 30Meg .pdf; you may want to look into putting 
this in the users' homedirectory or something likewise.

Then, everything else you need to do is to set up a printer share with 
the parameter 'print command' set to the name of your script, and 
install a PostScript printer driver on the users' computer to print to 
your PDF service (Any postscript printer should do; I used an Apple 
Laserwriter which worked flawlessly).

Still, I'd like to know whether someone knows a way to achieve something 
similar for a disk share ;-)

Regards,

Wouter





More information about the samba mailing list