42 lines
609 B
Perl
42 lines
609 B
Perl
|
package Exd::DeviceToRawFile;
|
||
|
|
||
|
use v5.40.0;
|
||
|
|
||
|
use strict;
|
||
|
use warnings;
|
||
|
|
||
|
use Moo;
|
||
|
|
||
|
use GD::Image;
|
||
|
use Path::Tiny;
|
||
|
use Printer::ESCPOS;
|
||
|
|
||
|
has output_file => (
|
||
|
is => 'ro',
|
||
|
required => 1,
|
||
|
);
|
||
|
|
||
|
has _guts_device => (
|
||
|
is => 'lazy'
|
||
|
);
|
||
|
|
||
|
sub _build__guts_device($self) {
|
||
|
my $device = Printer::ESCPOS->new(
|
||
|
driverType => 'File',
|
||
|
deviceFilePath => $self->output_file,
|
||
|
);
|
||
|
}
|
||
|
|
||
|
sub image( $self, $image ) {
|
||
|
$self->_guts_device->printer->image($image);
|
||
|
}
|
||
|
|
||
|
sub lf($self) {
|
||
|
$self->_guts_device->printer->lf;
|
||
|
}
|
||
|
|
||
|
sub print($self) {
|
||
|
$self->_guts_device->printer->print;
|
||
|
}
|
||
|
1;
|