Advertisement
Guest User

/usr/lib/cups/filter

a guest
Feb 14th, 2020
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 19.19 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2. # Version:  1.0.4
  3. # Date:     2013-11-12
  4. # Author:   Jan Heinecke
  5. # Filename: KMbeuEmpPS.pl
  6. # compressed filter file
  7. use strict;
  8.  
  9. # Workaround for alternative driver settings using a file in the users home folder
  10. # $usesettingsfile= 0 for disable, 1 for enable function
  11. my $usesettingsfile=1;
  12.  
  13. # in addition the path to the home folder is needed
  14. # in most Linux distributions the home folders are located by default in "/home"
  15. # for this function, the expectation is that sub folders exists which are named as
  16. # the username transfered to Cups
  17. my $homefolderspath="/home/thibaud";
  18.  
  19. # Toggle between standard mode and debug mode
  20. # In debug mode a log file with data of important steps is written
  21. # Debug mode OFF: $dbm=0
  22. # Debug Mode ON: $dbm=1
  23. # By default this is $dbm=0
  24. my $dbg_mode=0;
  25.  
  26. # Debug file
  27. # This is the logfile to be written in debug mode
  28. # change to a suitable path if needed
  29. # The printer daemon must have write access to that file
  30. my $dbg_file="/var/tmp/kmfilterpcl.dbg";
  31.  
  32. my $dbm=$dbg_mode;my $usf=$usesettingsfile;my $hfp=$homefolderspath;my $dbh;my $if;my $dbf=$dbg_file;my @pc=();my $ph="\e\%-12345X\@PJL JOB\n";my $pf="\n\e\%-12345X\@PJL EOJ\n\e\%-12345X";my @op=();my @of=();push @pc,$ph;if($dbm==1){ open( $dbh, ">$dbf") or die "Can't open file:$dbf\n"; print $dbh '<?xml version="1.0"?>'; print $dbh "\n"; print $dbh '<debugdata>'; print $dbh "\n"; }if (defined $ARGV[5]){  $if= $ARGV[5];}else{ $if = "-";}open(INFILE, $if) or die "Can't open file: $if\n";if ($dbm==1){ print $dbh '<inputfile>'; print $dbh "$if"; print $dbh '</inputfile>'; print $dbh "\n";}while (<INFILE>){ push @op,$_;}if ($dbm==1){ print $dbh '<psdata_input>'; print $dbh "\n@op\n"; print $dbh '</psdata_input>'; print $dbh "\n";}close(INFILE);my $un='';if (defined $ARGV[1]){ $un=$ARGV[1];}if ($dbm==1){ print $dbh '<ARGV_0>'; if (defined $ARGV[0]) { print $dbh "$ARGV[0]"; } print $dbh '</ARGV_0>'; print $dbh "\n"; print $dbh '<ARGV_1>'; if (defined $ARGV[1]) { print $dbh "$ARGV[1]"; } print $dbh '</ARGV_1>'; print $dbh "\n"; print $dbh '<ARGV_2>'; if (defined $ARGV[2]) { print $dbh "$ARGV[2]"; } print $dbh '</ARGV_2>'; print $dbh "\n"; print $dbh '<ARGV_3>'; if (defined $ARGV[3]) { print $dbh "$ARGV[3]"; } print $dbh '</ARGV_3>'; print $dbh "\n"; print $dbh '<ARGV_4>'; if (defined $ARGV[4]) { print $dbh "$ARGV[4]"; } print $dbh '</ARGV_4>'; print $dbh "\n"; print $dbh '<ARGV_5>'; if (defined $ARGV[5]) { print $dbh "$ARGV[5]"; } print $dbh '</ARGV_5>'; print $dbh "\n";}$ARGV[4] =~ s/\\\s/%#%/g; my @do=split(/\s/,$ARGV[4]);my $A1=0;my $A2=0;my $A3=0;my $A4='';my $A5='';my $A6=0;my $A9=0;my $A7='';my $A8='';my $B3=0;my $B1='';my $B2='';my $B4=0;my $B5='';my $B6='';my $B8=0;my $B7='';my $C1=0;my $C2='';my $C3='';my $C4='';my $C5='';my $C6='';my $C7='';my $C8=0;my $C9=0;my $D1='';my $D2=0;my $D3='';my $D4='';my $D5='BLACK';my $D6='';my $D7='';my $D8='';my $D9='';my $E1='';my $E2='';my $E3='';my $E4='';my $E5='';my $E6='BLACK';my $E7='';my $E8=0;my $E9='';my $F1='';my $F2='';my $F3='BLACK';my $F4='';my $on;foreach $on (@do){ $on =~ s/%#%/ /g;  $_=$on; if ( m/POutputMethod/ ) { $A1=1; } if ( m/OutputMethod=ProofMode/ ) { $A6=1; next; } if ( m/OutputMethod=Secure/ ) { $A2=1; next; } if ( m/OutputMethod=Box/ ) { $B4=1;  next; } if ( m/OutputMethod=BoxPrint/ ) { $B4=2; next; } if ( m/OutputMethod=IDPrint/ ) { $A3=1; next; } if ( m/OutputMethod=SafeQ/ ) { $B8=1; next; } if ( m/KMSecID/ ) { if ( m/KMSecID=None/ ) { next; } else { $on =~ s/KMSecID=//g ; $on =~ s/Custom.//g ; $A4=$on; next; } } if ( m/KMSecPass/ ) { if ( m/KMSecPass=None/ ) { next; } else { $on =~ s/KMSecPass=//g ; $on =~ s/Custom.//g ; $A5=$on; next; } } if ( m/KMBoxNumber/ ) { if ( m/KMBoxNumber=None/ ) { next; } else { $on =~ s/KMBoxNumber=//g ; $on =~ s/Custom.//g ; $B5=$on; next; } } if ( m/KMBoxFileName/ ) { if ( m/KMBoxFileName=None/ ) { next; } else { $on =~ s/KMBoxFileName=//g ; $on =~ s/Custom.//g ; $B6=$on; next; } } if ( m/KMSafeQUser/ ) { if ( m/KMSafeQUser=<Current_User>/ ) { $B7=$un; next; } else { $on =~ s/KMSafeQUser=//g ; $on =~ s/Custom.//g ; $B7=$on; next; } }  if ( m/KMSectionManagement/ ) { if ( m/noKMSectionManagement/ ) { next; } else { $A9=1; next; } } if ( m/KMDepCode/ ) { if ( m/KMDepCode=None/ ) { next; } else { $on =~ s/KMDepCode=//g ; $on =~ s/Custom.//g ; $A7=$on; next; } } if ( m/KMAccPass/ ) { if ( m/KMAccPass=None/ ) { next; } else { $on =~ s/KMAccPass=//g ; $on =~ s/Custom.//g ; $A8=$on; next; } } if ( m/KMAuthentication/ ) { if ( m/KMAuthentication=False/ ) { next; } if ( m/KMAuthentication=Private/ ) { $B3=1; next; } if ( m/KMAuthentication=PSES/ ) { $B3=2; next; } } if ( m/KMAuthUser/ ) { if ( m/KMAuthUser=None/ ) { next; } else { $on =~ s/KMAuthUser=//g ; $on =~ s/Custom.//g ; $B1=$on; next; } } if ( m/KMAuthPass/ ) { if ( m/KMAuthPass=None/ ) { next; } else { $on =~ s/KMAuthPass=//g ; $on =~ s/Custom.//g ; $B2=$on; next; } } if ( m/KMCopySecurityEnable/ ) { if ( m/noKMCopySecurityEnable/ ) { next; } else { $C1=1; next; } } if ( m/KMCopySecurityMode=/ ) { $on =~ s/KMCopySecurityMode=//g ; $C2=$on; next; } if ( m/KMCopySecurityPass=/ ) { $on =~ s/KMCopySecurityPass=//g ; $C3=$on; next; } if ( m/KMCopySecurityCharacters=/ ) { $on =~ s/KMCopySecurityCharacters=//g ; $C4=$on; next; }  if ( m/KMCopySecurityDateTime=/ ) { $on =~ s/KMCopySecurityDateTime=//g ; $C5=$on; next; } if ( m/KMCopySecurityDateFormat=/ ) { $on =~ s/KMCopySecurityDateFormat=//g ; $C6=$on; next; } if ( m/KMCopySecurityTimeFormat=/ ) { $on =~ s/KMCopySecurityTimeFormat=//g ; $C7=$on; next; }  if ( m/KMCopySecuritySerialNumber/ ) { if ( m/noKMCopySecuritySerialNumber/ ) { next; } else { $C8=1; next; } } if ( m/KMCopySecurityDCNumber/ ) { if ( m/noKMCopySecurityDCNumber/ ) { next; } else { $C9=1; next; } }  if ( m/CopySecurityDCNStart=/ ) { $on =~ s/KMCopySecurityDCNStart=//g ; $D1=$on; next; } if ( m/KMCopySecurityJobNumber/ ) { if ( m/noKMCopySecurityJobNumber/ ) { next; } $D2=1; next; } if ( m/KMCopySecurityPatternAngle=/ ) { $on =~ s/KMCopySecurityPatternAngle=//g ; $D3=$on; next; } if ( m/KMCopySecurityPatternTextSize=/ ) { $on =~ s/KMCopySecurityPatternTextSize=//g ; $D4=$on; next; } if ( m/KMCopySecurityPatternColor=/ ) { $on =~ s/KMCopySecurityPatternColor=//g ; $D5=$on; next; } if ( m/KMCopySecurityPatternDensity=/ ) { $on =~ s/KMCopySecurityPatternDensity=//g ; $D6=$on; next; } if ( m/KMCopySecurityPatternContrast=/ ) { $on =~ s/KMCopySecurityPatternContrast=//g ; $D7=$on; next; } if ( m/KMCopySecurityPatternOverwrite=/ ) { $on =~ s/KMCopySecurityPatternOverwrite=//g ; $D8=$on; next; } if ( m/KMCopySecurityBackgroundPattern=/ ) { $on =~ s/KMCopySecurityBackgroundPattern=//g ; $D9=$on; next; } if ( m/KMCopySecurityPatternEmboss=/ ) { $on =~ s/KMCopySecurityPatternEmboss=//g ; $E1=$on; next; } if ( m/KMStampDateTime=/ ) { $on =~ s/KMStampDateTime=//g ; $E2=$on; next; } if ( m/KMStampDateFormat=/ ) { $on =~ s/KMStampDateFormat=//g ; $E3=$on; next; } if ( m/KMStampTimeFormat=/ ) { $on =~ s/KMStampTimeFormat=//g ; $E4=$on; next; } if ( m/KMStampPages=/ ) { $on =~ s/KMStampPages=//g ; $E5=$on; next; } if ( m/KMStampTextColor=/ ) { $on =~ s/KMStampTextColor=//g ; $E6=$on; next; } if ( m/KMStampPrintPosition=/ ) { $on =~ s/KMStampPrintPosition=//g ; $E7=$on; next; } if ( m/KMStampPageNumberEnable/ ) { if ( m/noKMStampPageNumberEnable/ ) { next; } $E8=1; next; } if ( m/KMStampPNStartingPage=/ ) { $on =~ s/KMStampPNStartingPage=//g ; $E9=$on; next; } if ( m/KMStampPNStartingNumber=/ ) { $on =~ s/KMStampPNStartingNumber=//g ; $F1=$on; next; } if ( m/KMStampPageNumberCoverMode=/ ) { $on =~ s/KMStampPageNumberCoverMode=//g ; $F2=$on; next; } if ( m/KMStampPNTextColor=/ ) { $on =~ s/KMStampPNTextColor=//g ; $F3=$on; next; } if ( m/KMStampPNPrintPosition=/ ) { $on =~ s/KMStampPNPrintPosition=//g ; $F4=$on; next; } }if($usf==1){ my @KS=();if ($dbm==1){ print $dbh '<USERNAME>'; if (defined $ARGV[1]) { print $dbh "$ARGV[1]"; } print $dbh '</USERNAME>'."\n";} $_=$hfp."/".$ARGV[1];if ($dbm==1){ print $dbh '<HOMEFOLDER>'; print $dbh "$_"; print $dbh '</HOMEFOLDER>'."\n";} if ((-e $_."/KMdrv.txt") && (-r $_."/KMdrv.txt")) { open (INFILE, $_."/KMdrv.txt"); while (<INFILE>) { push @KS,$_; }  my $KL; foreach $KL (@KS) { $_ = $KL; s/^\s+//; s/\s+$//;  if ( m/^\#/ ) { next; }  if ( m/^\;/ ) { next; }  if ( $_ eq '' ) { next; } if ($dbm==1){ print $dbh '<KMDRVline>'; print $dbh "$_"; print $dbh '</KMDRVline>'."\n";}  if ( m/^OutputMethod=Secure/ ) { $A2=1; $A6=0; $B4=0; $A3=0; $B8=0; next; }  if ( m/^OutputMethod=ProofMode/ ) { $A6=1; $A2=0; $B4=0; $A3=0; $B8=0; next; }  if ( m/^OutputMethod=Box/ ) { $B4=1; $A2=0; $A6=0; $A3=0; $B8=0; next; }  if ( m/^OutputMethod=BoxPrint/ ) { $B4=2; $A2=0; $A6=0; $A3=0; $B8=0; next; }  if ( m/^OutputMethod=IDPrint/ ) { $A3=1; $A2=0; $A6=0; $B4=0; $B8=0; next; }  if ( m/^OutputMethod=Print/ ) { $A2=0; $B4=0; $A6=0; $A3=0; $B8=0; next; }  if ( m/^OutputMethod=SafeQ/ ) { $A2=0; $B4=0; $A6=0; $A3=0; $B8=1; next; }   if ( m/^SecurePrintID=/ ) { s/^SecurePrintID=//;  s/^\s+//; s/\s+$//; $A4=$_; next; }  if ( m/^SecurePrintPassword=/ ) { s/^SecurePrintPassword=//;  s/^\s+//; s/\s+$//; $A5=$_; next; }  if ( m/^BoxNumber=/ ) { s/^BoxNumber=//;  s/^\s+//; s/\s+$//; $B5=$_; next; }  if ( m/^BoxFileName=/ ) { s/^BoxFileName=//;  s/^\s+//; s/\s+$//; $B6=$_; next; }  if ( m/^SafeQUser=/ ) { s/^SafeQUser=//;  s/^\s+//; s/\s+$//; $B7=$_; next; }    if ( m/^AccountTrack=True/ ) { $A9=1; next; }  if ( m/^AccountTrack=False/ ) { $A9=0; next; }  if ( m/^DepartmentCode=/ ) { s/^DepartmentCode=//;  s/^\s+//; s/\s+$//; $A7=$_; next; }  if ( m/^AccountPassword=/ ) { s/^AccountPassword=//;  s/^\s+//; s/\s+$//; $A8=$_; next; }  if ( m/^Authentication=PSES/ ) { $B3=2; next; }  if ( m/^Authentication=True/ ) { $B3=1; next; }  if ( m/^Authentication=False/ ) { $B3=0; next; }  if ( m/^AuthenticationUsername=/ ) { s/^AuthenticationUsername=//;  s/^\s+//; s/\s+$//; $B1=$_; next; }  if ( m/^AuthenticationPassword=/ ) { s/^AuthenticationPassword=//;  s/^\s+//; s/\s+$//; $B2=$_; next; }   } }}if ( $B6 == "" ) { $B6=$ARGV[2]; }if ($dbm==1){ print $dbh '<drv_settings>'; print $dbh "\n"; print $dbh "<SecurePrint>".$A2."</SecurePrint>\n"; print $dbh "<SecureID>".$A4."</SecureID>\n"; print $dbh "<SecurePass>".$A5."</SecurePass>\n"; print $dbh "<ProofPrint>".$A6."</ProofPrint>\n"; print $dbh "<AccountTrack>".$A9."</AccountTrack>\n"; print $dbh "<AccountTrackDepartmentCode>".$A7."</AccountTrackDepartmentCode>\n"; print $dbh "<AccountTrackPass>".$A8."</AccountTrackPass>\n"; print $dbh "<Authentication>".$B3."</Authentication>\n"; print $dbh "<AuthenticationUser>".$B1."</AuthenticationUser>\n"; print $dbh "<AuthenticationPass>".$B2."</AuthenticationPass>\n"; print $dbh "<BoxPrint>".$B4."</BoxPrint>\n"; print $dbh "<BoxNumber>".$B5."</BoxNumber>\n"; print $dbh "<BoxFileName>".$B6."</BoxFileName>\n"; print $dbh "<IDPrint>".$A3."</IDPrint>\n"; print $dbh "<SafeQ>".$B8."</SafeQ>\n"; print $dbh "<SafeQName>".$B7."</SafeQName>\n"; print $dbh "<CopySecurityEnable>".$C1."</CopySecurityEnable>\n"; print $dbh "<CopySecurityMode>".$C2."</CopySecurityMode>\n"; print $dbh "<CopySecurityPass>".$C3."</CopySecurityPass>\n"; print $dbh "<CopySecurityCharacters>".$C4."</CopySecurityCharacters>\n"; print $dbh "<CopySecurityDateTime>".$C5."</CopySecurityDateTime>\n"; print $dbh "<CopySecurityDateFormat>".$C6."</CopySecurityDateFormat>\n"; print $dbh "<CopySecurityTimeFormat>".$C7."</CopySecurityTimeFormat>\n"; print $dbh "<CopySecuritySerialNumber>".$C8."</CopySecuritySerialNumber>\n"; print $dbh "<CopySecurityDCN>".$C9."</CopySecurityDCN>\n"; print $dbh "<CopySecurityDCNStart>".$D1."</CopySecurityDCNStart>\n"; print $dbh "<CopySecurityJobNumber>".$D2."</CopySecurityJobNumber>\n"; print $dbh "<CopySecurityPatternAngle>".$D3."</CopySecurityPatternAngle>\n"; print $dbh "<CopySecurityPatternTextSize>".$D4."</CopySecurityPatternTextSize>\n"; print $dbh "<CopySecurityPatternColor>".$D5."</CopySecurityPatternColor>\n"; print $dbh "<CopySecurityPatternDensity>".$D6."</CopySecurityPatternDensity>\n"; print $dbh "<CopySecurityPatternContrast>".$D7."</CopySecurityPatternContrast>\n"; print $dbh "<CopySecurityPatternOverwrite>".$D8."</CopySecurityPatternOverwrite>\n"; print $dbh "<CopySecurityBackgroundPattern>".$D9."</CopySecurityBackgroundPattern>\n"; print $dbh "<CopySecurityPatternEmboss>".$E1."</CopySecurityPatternEmboss>\n"; print $dbh "<StampDateTime>".$E2."</StampDateTime>\n"; print $dbh "<StampDateFormat>".$E3."</StampDateFormat>\n"; print $dbh "<StampTimeFormat>".$E4."</StampTimeFormat>\n"; print $dbh "<StampPages>".$E5."</StampPages>\n"; print $dbh "<StampTextColor>".$E6."</StampTextColor>\n"; print $dbh "<StampPrintPosition>".$E7."</StampPrintPosition>\n"; print $dbh "<StampPageNumberEnable>".$E8."</StampPageNumberEnable>\n"; print $dbh "<StampPageNumberStartingPage>".$E9."</StampPageNumberStartingPage>\n"; print $dbh "<StampPageNumberStartingNumber>".$F1."</StampPageNumberStartingNumber>\n"; print $dbh "<StampPageNumberCoverMode>".$F2."</StampPageNumberCoverMode>\n"; print $dbh "<StampPNTextColor>".$F3."</StampPNTextColor>\n"; print $dbh "<StampPNPrintPosition>".$F4."</StampPNPrintPosition>\n"; print $dbh '</drv_settings>'; print $dbh "\n";}my @pl=();push @pl, '@PJL COMMENT'."\n";if (($A1==0 or $A2==0) and $B8==0 ){ push @pl, '@PJL SET USERNAME="'.$un.'"'."\n";}if ( $B8==1 ){ push @pl, '@PJL SET USERNAME="'.$B7.'"'."\n";}push @pl, '@PJL SET JOBNAME="'.$ARGV[2].'"'."\n";push @pl, '@PJL SET DRIVERJOBID="'.$ARGV[0].'"'."\n";push @pl, '@PJL SET QTY='.$ARGV[3]."\n";push @pl, '@PJL SET KMCOETYPE=0'."\n";if ($A2==1) { push @pl, '@PJL SET HOLD = ON'."\n"; push @pl, '@PJL SET HOLDTYPE = PRIVATE'."\n"; if ($A1==0) { push @pl, '@PJL SET KMJOBID = "'.$A4.'"'."\n"; }  else { push @pl, '@PJL SET USERNAME = "'.$A4.'"'."\n"; }  push @pl, '@PJL SET HOLDKEY = "'.$A5.'"'."\n";}if ($A6==1) { if ($A1==0) { push @pl, '@PJL SET HOLD = KMPROOF'."\n"; }  else { push @pl, '@PJL SET HOLD = PROOF'."\n"; }  push @pl, '@PJL SET HOLDTYPE = PUBLIC'."\n";}if ($A9==1) { if ($A1==0) { push @pl, '@PJL SET KMSECTIONNAME = "'.$A7.'"'."\n"; push @pl, '@PJL SET KMSECTIONKEY2 = "'.$A8.'"'."\n"; }  else { push @pl, '@PJL SET KMPSECTIONNAME = "'.$A7.'"'."\n"; push @pl, '@PJL SET KMPSECTIONKEY2 = "'.$A8.'"'."\n"; } }if ($A3==1){ push @pl, '@PJL SET HOLD = KMCERTSTORE'."\n"; if ($B3==0)  { if ($A1==0) { push @pl, '@PJL SET KMUSERNAME = "Public"'."\n"; push @pl, '@PJL SET KMUSERKEY2 = ""'."\n"; }  else { push @pl, '@PJL SET KMPUSERNAME = "Public"'."\n"; push @pl, '@PJL SET KMPUSERKEY = ""'."\n"; }  push @pl, '@PJL SET BOXHOLDTYPE = PUBLIC'."\n"; } }if ($B3==1) { if ($A1==0) { push @pl, '@PJL SET KMUSERNAME = "'.$B1.'"'."\n"; push @pl, '@PJL SET KMUSERKEY2 = "'.$B2.'"'."\n"; }  else { push @pl, '@PJL SET KMPUSERNAME = "'.$B1.'"'."\n"; push @pl, '@PJL SET KMPUSERKEY = "'.$B2.'"'."\n"; }  push @pl, '@PJL SET BOXHOLDTYPE = PRIVATE'."\n";}if ($B3==2) { push @pl, '@PJL SET KMCERTSELECTTYPE = FLEX'."\n"; push @pl, '@PJL SET KMCERTFLEXCONTNUM = 3'."\n"; push @pl, '@PJL SET KMCERTFLEXCONTID1 = "ExtSvrName"'."\n"; push @pl, '@PJL SET KMCERTFLEXCONTTYPE1 = STRING'."\n"; push @pl, '@PJL SET KMCERTFLEXSTING1 ='."\n"; push @pl, '@PJL SET KMCERTFLEXCONTID2 = "UsrName"'."\n"; push @pl, '@PJL SET KMCERTFLEXCONTTYPE2 = STRING'."\n"; push @pl, '@PJL SET KMCERTFLEXSTING2 = "'.$B1.'"'."\n"; push @pl, '@PJL SET KMCERTFLEXCONTID3 = "UsrPass"'."\n"; push @pl, '@PJL SET KMCERTFLEXCONTTYPE3 = STRING'."\n"; push @pl, '@PJL SET KMCERTFLEXSTING3 = "'.$B2.'"'."\n"; push @pl, '@PJL SET KMCERTFLEXSCREENID = "AUTHBYERIE"'."\n";}if ($B4>=1) { if ($B4==1) {  push @pl, '@PJL SET BOXHOLD = STORE'."\n"; } else { push @pl, '@PJL SET BOXHOLD = STOREANDPRINT'."\n"; } if ($B3==0)  { push @pl, '@PJL SET BOXHOLDTYPE = PUBLIC'."\n"; } push @pl, '@PJL SET BOXNUM = '.$B5."\n"; push @pl, '@PJL SET BOXFILENAME = "'.$B6.'"'."\n";}if ($A1==0){if ($C1 == 1){ my $ct="FIXED"; my $cn="1";  $_= $C4; if ( m/A/ )  { $ct="ARBITRARY"; } if ( m/2/ )  { $cn="2"; } if ( m/3/ )  { $cn="3"; } if ( m/4/ )  { $cn="4"; } if ( m/5/ )  { $cn="5"; } if ( m/6/ )  { $cn="6"; } if ( m/7/ )  { $cn="7"; } if ( m/8/ )  { $cn="8"; } my $F5="ON"; my $F6="OFF"; my $F7="OFF"; if ( $C2 =~ /CopyProtect/ )  { } if ( $C2 =~ /StampReapeat/ )  { $F5="OFF" } if ( $C2 =~ /CopyGuard/ )  { $F6="ON"; $D3=0; $ct="FIXED"; $D8="COMPOSITION1"; $E1="EFFECT2"; } if ( $C2 =~ /PasswordCopy/ )  { $F7="ON"; $D3=0; $ct="FIXED"; $D8="COMPOSITION1"; $E1="EFFECT2"; } my $F9=''; my $F8=''; if ($C4 =~ /None/) { if ($F8 ne '')  { $F8=$F8.","; } $F8=$F8."OFF"; } else { if ($F9 ne '')  { $F9=$F9.","; } $F9=$F9.$ct; } if ($C5 =~ /None/ ) { if ($F8 ne '')  { $F8=$F8.","; } $F8=$F8."OFF,OFF"; } if ( ($C5 =~ /Date/)and($C5 !~ /DateTime/) ) { if ($F8 ne '')  { $F8=$F8.","; } $F8=$F8."OFF"; if ($F9 ne '')  { $F9=$F9.","; } $F9=$F9."DATE"; } if ($C5 =~ /DateTime/ ) { if ($F9 ne '')  { $F9=$F9.","; } $F9=$F9."DATE,TIME"; } if ($C8==0) { if ($F8 ne '')  { $F8=$F8.","; } $F8=$F8."OFF"; } else { if ($F9 ne '')  { $F9=$F9.","; } $F9=$F9."SERIALNUMBER"; } if ($C9==0) { if ($F8 ne '')  { $F8=$F8.","; } $F8=$F8."OFF"; } else { if ($F9 ne '')  { $F9=$F9.","; } $F9=$F9."NUMBERING"; } if ($D2==0) { if ($F8 ne '')  { $F8=$F8.","; } $F8=$F8."OFF"; } else { if ($F9 ne '')  { $F9=$F9.","; } $F9=$F9."JOBID"; } if ($F9 ne '')  { $F9=$F9.","; } $F9=$F9.$F8.",OFF,OFF"; my $G1=''; if ( ($C5 =~ /Date/)and($C5 !~ /DateTime/) ) { $G1=$C6.",OFF"; } if ($C5 =~ /DateTime/ ) { $G1=$C6.",".$C7; } push @pl, '@PJL SET JIMONMODE = ON'."\n"; push @pl, '@PJL SET JIMONMODEHIDE = '.$F5."\n"; push @pl, '@PJL SET JIMONPATTERN = "'.$F9."\"\n"; push @pl, '@PJL SET JIMONPATTERNINDEX = "'.$cn.",0,0,0,0,0,0,0\"\n"; if ($C5 ne "None") { push @pl, '@PJL SET JIMONDATETIME = "'.$G1."\"\n";  } push @pl, '@PJL SET JIMONCHARACTER = "'.$D4.",". $E1.",".$D8.",". $D5.",".$D6.",". $D7.",".$D3."\"\n";  if ($C9==1) { push @pl, '@PJL SET JIMONNUMBERING = "NUMBER,'.$D1."\"\n"; } push @pl, '@PJL SET JIMONBACKPATTERN = '.$D9."\n";  push @pl, '@PJL SET COPYGUARD='.$F6."\n"; push @pl, '@PJL SET PWDCOPY='.$F7."\n";  if ($F7 =~ /ON/ ) { push @pl, '@PJL SET PWDCOPYKEY = "'.$C3."\"\n"; }}else{ push @pl, '@PJL SET JIMONMODE = OFF'."\n";}  if ( ($E2 =~ /Date/)and($E2 !~ /DateTime/) ) { push @pl, '@PJL SET DTSTPMODE = ON'."\n";  push @pl, '@PJL SET DTSTPDATE = '.$E3."\n";  push @pl, '@PJL SET DTSTPTIME = OFF'."\n";  push @pl, '@PJL SET DTSTPPAGE = '.$E5."\n";  push @pl, '@PJL SET DTSTPPOSITION = '.$E7."\n";  push @pl, '@PJL SET DTSTPCOLOR = '.$E6."\n";  } if ($E2 =~ /DateTime/ ) { push @pl, '@PJL SET DTSTPMODE = ON'."\n";  push @pl, '@PJL SET DTSTPDATE = '.$E3."\n";  push @pl, '@PJL SET DTSTPTIME = '.$E4."\n";  push @pl, '@PJL SET DTSTPPAGE = '.$E5."\n";  push @pl, '@PJL SET DTSTPPOSITION = '.$E7."\n";  push @pl, '@PJL SET DTSTPCOLOR = '.$E6."\n";  } if ($E2 =~ /None/ ) { push @pl, '@PJL SET DTSTPMODE = OFF'."\n";  } if ($E8==1) { if ($F1 ne "1" ) { $E9="1"; }  push @pl, '@PJL SET PAGESTAMP = "'.$F2.",".$E9.",".$F1."\"\n";   push @pl, '@PJL SET PSTPPOSITION = '.$F4."\n";  push @pl, '@PJL SET PSTPCOLOR = '.$F3."\n";  } else { push @pl, '@PJL SET PAGESTAMP = "NONE,1,1"'."\n"; }}push @pl, "\@PJL ENTER LANGUAGE = POSTSCRIPT\n ";my @pg=();my $ln;foreach $ln (@op){ $_ = $ln; if ( m/\%\%EndFeature/ || m/stopped cleartomark/ || m/\[\{/ || m/BeginFeature/) { next; } if ( m/\%\%Page:/ ) { @pg=split(/\s/,$_); print STDERR "PAGE: ".$pg[1]." ".$ARGV[3]."\n"; } }push(@of, @pc);push (@of,@pl);push(@of,@op);push(@of,$pf);print @of;if ($dbm==1){ print $dbh '<finaloutput>'; my $xo=join ("",@of); print $dbh "\n$xo\n"; print $dbh '</finaloutput>'; print $dbh "\n"; print $dbh '</debugdata>' }exit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement