- my $printer;
- $printer = SL::DB::Printer->new(id => $printer_id)->load if $printer_id;
- if (!$printer) {
- return $self->js->flash('error', t8('Printer not found.'))->render;
- }
-
- my $command = SL::Template::create(type => 'ShellCommand', form => Form->new(''))->parse($printer->printer_command);
-
- for my $i (1 .. $copies) {
- open my $out, '|-', $command or die $!;
- binmode $out;
- print $out $pdf;
- close $out;
- }