[Samba] PDF Print command

Rashkae rashkae at wealthmap.ca
Tue Mar 26 05:56:03 GMT 2002


For those of us who like to simplity our lives and find all those switches
to gs confusing, the ps2pdf script that comes with Ghostscript works
rather well....

As for a disk share, just create a script (I would use perl, but that's
only cause I'm not as familiar with shell scripting), that scans a given
directory for any ps files, runs the ps2pdf script, saves the ouput pdf in
a designated folder, and use cron to run that every minute.. (Of course,
the better way would be to program your script as a deamon that runs
itself continuously with a small pause between executions.) (Don't forget
to remove or rename the source ps file).

On Tue, 26 Mar 2002, Wouter Verhelst wrote:

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