#!/usr/bin/perl # Command line: c:\perl\bin\perl.exe "%1\pdfprint.pl" "%2" "%4" # Tested with: Foxit Reader 6.0.3.0524 #------------------------------------------------------------------------------# my $Spool = $ARGV [0]; my $Name = $ARGV [1]; my $Res = 0; my $WrkName; my $Cmd; my $Log = "$Spool\\perldbg.log"; open (LOG, '>>', $Log); printf LOG "\nStart processing of script pdfprint.pl\n"; if ($Spool eq "" || $Name eq "") { $Res = -11; # at least one of the parameters is missing # printf LOG "One of the parameters is missing, error = %d\n", $Res; } else { if ($Name =~ /.*\.pdf/) # extension of file is '.pdf' # { if ($Name =~ /:/) { # file name with path # $WrkName = $Name; } else { # file name without path # $WrkName = "$Spool\\$Name"; # add path # } $Cmd = "\"C:\\Programme\\Foxit Software\\Foxit Reader\\" . "Foxit Reader.exe\" /t \"$WrkName\" \"c4p Converter\""; printf LOG "Run command: %s\n", $Cmd; $Res = system ($Cmd) / 256; # print pdf file # printf LOG "system () returns %d\n", $Res; unlink ($WrkName); # remove file afterwards # } else { $Res = -12; # not a pdf document # printf LOG "Not a PDF Document, error = %d\n", $Res; } } printf LOG "Script processing done\n"; close LOG; exit $Res; #------------------------------------------------------------------------------#