#!/usr/bin/perl # Command line: c:\perl\bin\perl.exe "%1\printpdf.pl" "%1" "%2" "%4" # Tested with: Foxit Reader 6.0.3.0524 #------------------------------------------------------------------------------# my $Script = $ARGV [0]; my $Spool = $ARGV [1]; my $Name = $ARGV [2]; my $Res = 0; my $Cmd; if ($Script eq "" || $Spool eq "" || $Name eq "") { $Res = -11; # at least one of the parameters is missing # } else { if ($Name =~ /.*\.pdf/) # extension of file is '.pdf' # { if ($Name =~ /Mahnung.*/) { $Process = "IM0OEG2"; } # reminder # else { $Process = "IN45FK2"; } # all others # $Cmd = "\"$Script\\p2fSetProcess.exe\" \"-wp2f Printer\" -p$Process"; $Res = system ($Cmd) / 256; # setup printer configuration # if ($Res eq 0) { $Cmd = "\"C:\\Programme\\Foxit Software\\Foxit Reader\\" . "Foxit Reader.exe\" /t \"$Spool\\$Name\" \"p2f Printer\""; $Res = system ($Cmd) / 256; # print pdf file # unlink ("$Spool\\$Name"); # remove file afterwards # } } else { $Res = -12; } # not a pdf document # } exit $Res; #------------------------------------------------------------------------------#