use Modern::Perl;
use CGI;
-use File::Temp qw( :POSIX );
-use Carp;
+use File::Temp qw( tmpnam );
+use Carp qw( carp );
use C4::Templates qw ( gettemplate );
+use C4::Letters qw( GetPreparedLetter );
use Koha::Database;
use Koha::DateUtils qw( dt_from_string output_pref );
$letter->{'title'} =~ s/<<today>>/$today/g;
$letter->{'content'} =~ s/<<today>>/$today/g;
- my $tmpl = C4::Templates::gettemplate('batch/print-notices.tt', 'intranet', new CGI);
+ my $tmpl = C4::Templates::gettemplate('batch/print-notices.tt', 'intranet', CGI->new);
$tmpl->param(
stylesheet => C4::Context->preference("NoticeCSS"),
today => $today,
else {
my $pdf = PDF::FromHTML->new( encoding => 'utf-8' );
$pdf->load_file( $html_path );
- $pdf->convert;
+
+ my $ttf = C4::Context->config('ttf');
+ if ( $ttf && exists $ttf->{font} ) {
+
+ my $type2path;
+ foreach my $font ( @{ $ttf->{font} } ) {
+ $type2path->{ $font->{type} } = $font->{content};
+ }
+
+ $pdf->convert(
+ FontBold => $type2path->{'HB'} || 'HelveticaBold',
+ FontOblique => $type2path->{'HO'} || 'HelveticaOblique',
+ FontBoldOblique => $type2path->{'HBO'}|| 'HelveticaBoldOblique',
+ FontUnicode => $type2path->{'H'} || 'Helvetica',
+ Font => $type2path->{'H'} || 'Helvetica',
+ );
+ } else {
+ $pdf->convert();
+ }
$pdf->write_file( $pdf_path );
}