-
Notifications
You must be signed in to change notification settings - Fork 8
/
data_kpslcmp.pl
executable file
·57 lines (41 loc) · 1.17 KB
/
data_kpslcmp.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/perl -w
use strict;
use Encode qw(decode encode);
use utf8;
require "kpslcmp.pl";
binmode(STDOUT,':utf8');
# Usage: data_kpslcmp.pl
# generates kpsl from all pdf in the data directory.
sub checkFile($$) {
my ($file, $opts) = @_;
my $kpsl1 = $file;
$kpsl1 =~ s/\.pdf/1\.kpsl/;
my $kpsl2 = $file;
$kpsl2 =~ s/\.pdf/2\.kpsl/;
print "File: $file\n";
# original kpsl
`/usr/sbin/cupsfilter -p Kyocera_FS-1020MFPGDI.ppd -m printer/foo $opts $file -e > $kpsl1`;
# re kpsl
`/usr/sbin/cupsfilter -p Kyocera_FS-1020MFPGDI_RE.ppd -m printer/foo $opts $file -e > $kpsl2`;
# check kpsl
if (compKpsl($kpsl1, $kpsl2)) {
print "Not equal kpsl: $file\n";
return 1;
} else {
# rm kpsl
unlink $kpsl1, $kpsl2;
return 0;
}
}
if (-e "data")
{
(-d _) or die ("data not drectory!");
}
foreach my $file (<"data/*.pdf">) {
if (-f $file) {
(!checkFile($file, "")) or die "Not equal kpsl: $file\n";
(!checkFile($file, "-o CaBrightness=20")) or die "Not equal kpsl: $file\n";
(!checkFile($file, "-o CaContrast=20")) or die "Not equal kpsl: $file\n";
}
}
print "ALL OK\n";