[Samba] ps2pdf "Print command" script trouble

Dennis dennis.moreno at pop.safetran.com
Mon Aug 12 07:35:01 GMT 2002


2.2.5, Sol 2.8
I have a perl script that I've written to convert a ps file to pdf file.
I want the user to be able to setup a postscript printer in WNT/2k and
convert ps files to pdf by printing to a [ps2pdf] printer share.

     comment = PS to PDF file in Home Directory
     path = /usr/spool/public
     guest ok = Yes
     print ok = Yes
     browseable = Yes
     printer = ps2pdf     <--There is no real unix printer named this.
     print command = /usr/local/samba.22/ssc/ps2pdf.pl %s %H
#   printer driver = Apple LaserWriter v23.0
     oplocks = No
     share modes = No

My problem:

When I run the script manually it works fine. But when I print to the
share, nothing happens. I change the print command to print out the
values of the % variables so I could see the variable substitutions were
occuring correctly and they were.

Here is my perl script:

#!/usr/local/bin/perl -w
# ps2pdf.pl Description:
# A perl script that converts postscript files to pdf files
# It creates the pdf file in the directory specified.
# It needs the following arguments:
#       ARG1    $filename       %s
#       ARG2    $targetdir      %H

use strict;

if ($#ARGV == 1) {
         my ($filename,$targetdir) = @ARGV;
         my      $psin = "/usr/spool/public/" . $filename;
         my      $pdfout = $targetdir . "/" . $filename . ".pdf";
         my      $rc = 0xffff & system("/usr/local/bin/ps2pdf $psin
         my $message;
         if ($rc == 0) {
                 $message = "Succeeded.";
         } else {
                 $message = "Failed.";
         print "Conversion: $message\n";
         system("if [ -f $psin ]; then /usr/bin/rm $psin; fi");
} else {
         print "Usage: ps2pdf.pl [filename] [target directory]\n";

exit 0;

Can someone tell me what I'm doing wrong??


This e-mail message is meant solely for the person or organisation to whom it is adressed. The message may contain personal or confidential information, or information that is not public in nature. Safetran Systems Corporation accepts no responsibility for message content and possible attachments that are unlawful or of questionable decency. Further dissemination, publication or duplication of this message is strictly prohibited if the person or organisation receiving this message is not the intended recipient. In the event that you are not the intended recipient, we request you to refrain from using the content and to immediately inform the the sender of the error by returning the message. Thank you for your co-operation. 

More information about the samba mailing list