MT#15489 Use textfmt to prepare textfile with utf for hylafax

Alternative way for the solution from review 3924

Change-Id: Ibfb4b165f1fd1d9bdbb55047f23e157f19d6dcc9
changes/27/3927/6
Irina Peshinskaya 10 years ago
parent 0da5436b6f
commit 3b8dbc8c05

@ -3,7 +3,7 @@ package NGCP::Panel::Utils::Hylafax;
use Sipwise::Base;
use File::Temp qw/tempfile/;
use TryCatch;
use IPC::System::Simple qw/capture/;
use Data::Dumper;
sub send_fax {
@ -75,6 +75,18 @@ sub send_fax {
die $c->loc("Failed to write fax data to temporary file: [_1]", $err);
}
close $fh;
my $filename_ps = $filename.'.ps';
my $cmd = "textfmt -O UTF8:Yes -B -f Courier-Bold -p 11 -s A4 > $filename_ps < $filename";
my $err_ps = capture($cmd);
$c and $c->log->debug( "$cmd: $err_ps;" );
if(!$err_ps){
unlink $filename;
$filename = $filename_ps;
}else{
unlink $filename;
unlink $filename_ps;
die $c->loc("Failed to convert text to ps: [_1]", $err_ps);
}
} else {
$filename = eval { $args{upload}->tempname };
}

Loading…
Cancel
Save