From 00e5ce0d02a0d1e5a6f7b8a28744ee7961932a0b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 20 Jul 2010 11:15:30 +0200 Subject: [PATCH] =?utf8?q?STDOUT=20erneut=20=C3=B6ffnen=20und=20UTF8-Flag?= =?utf8?q?=20und=20FastCGI=20gefixt=20Teil=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Conflicts: SL/DN.pm --- SL/DN.pm | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/SL/DN.pm b/SL/DN.pm index 5cf42b543..f1e132fb7 100644 --- a/SL/DN.pm +++ b/SL/DN.pm @@ -663,29 +663,26 @@ sub melt_pdfs { my $in = IO::File->new("gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=- $inputfiles |"); $form->error($main::locale->text('Could not spawn ghostscript.')) unless $in; - my $out; - if ($form->{media} eq 'printer') { $form->get_printer_code($myconfig); + my $out; if ($form->{printer_command}) { $out = IO::File->new("| $form->{printer_command}"); } + $::locale->with_raw_io($out, sub { $out->print($_) while <$in> }); + $form->error($main::locale->text('Could not spawn the printer command.')) unless $out; } else { my $dunning_filename = $form->get_formname_translation('dunning'); - $out = IO::File->new('>-'); - $out->print(qq|Content-Type: Application/PDF\n| . - qq|Content-Disposition: attachment; filename="${dunning_filename}_${dunning_id}.pdf"\n\n|); - } + print qq|Content-Type: Application/PDF\n| . + qq|Content-Disposition: attachment; filename="${dunning_filename}_${dunning_id}.pdf"\n\n|; - while (my $line = <$in>) { - $out->print($line); + $::locale->with_raw_io(\*STDOUT, sub { print while <$in> }); } $in->close(); - $out->close(); map { unlink("${main::spool}/$_") } @{ $form->{DUNNING_PDFS} }; -- 2.20.1