3 # Simulate EVOLIS Dualys printer
8 use Data::Dump qw(dump);
21 die "no escape at beginning" unless s/^\x1B//;
23 my @a = split(/;/,$_);
26 my $f = $a[0] || die 'missing feeder';
27 print "feeder $f | $feeder->{$f}\n";
29 } elsif ( $c eq 'Pc' ) {
32 my $temperature = $a[2];
33 print "temperature $color = $temperature\n";
34 } elsif ( $c eq 'Pr' ) {
35 print "improve $a[0]\n";
36 # FIXME windows sends it, cups doesn't
37 } elsif ( $c eq 'Dbc' ) {
38 my ( $color, $line, $len, $data ) = @a;
39 while ( $len > length($data) ) {
40 warn "# slurp more ",length($data), " < $len\n";
43 $len == length $data or die "wrong length $len != ", length $data;
45 my $path = "page-$page-$color.pbm";
46 open(my $pbm, '>', $path);
51 $h = int( $len * 8 / $w );
53 print $pbm "P4\n$w $h\n", $data;
55 print "printed $path $w * $h size ", -s $path, "\n";
57 warn "UNKNOWN: $c ", dump(@a);