@@ -, +, @@ --- C4/Creators/PDF.pm | 11 ++++++++--- labels/label-create-pdf.pl | 7 +++---- 2 files changed, 11 insertions(+), 7 deletions(-) --- a/C4/Creators/PDF.pm +++ a/C4/Creators/PDF.pm @@ -55,8 +55,7 @@ sub new { sub End { my $self = shift; - # if the pdf stream is utf8, explicitly set it to utf8; this avoids at lease some wide character errors -chris_n - utf8::encode($PDF::Reuse::stream) if utf8::is_utf8($PDF::Reuse::stream); + prEnd(); # slurp temporary filename and print it out for plack to pick up @@ -112,7 +111,13 @@ sub Field { sub Font { my $self = shift; my $fontName = shift; - return prFont($fontName); + my $ttf_path = '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf'; + if ( -e $ttf_path ) { + warn "# using ttf_path $ttf_path"; + return prTTFont($ttf_path); + } else { + return prFont($fontName); + } } sub FontSize { --- a/labels/label-create-pdf.pl +++ a/labels/label-create-pdf.pl @@ -88,10 +88,9 @@ sub _calc_next_label_pos { sub _print_text { my $label_text = shift; foreach my $text_line (@$label_text) { - my $pdf_font = $pdf->Font($text_line->{'font'}); - my $line = "BT /$pdf_font $text_line->{'font_size'} Tf $text_line->{'text_llx'} $text_line->{'text_lly'} Td ($text_line->{'line'}) Tj ET"; - utf8::decode($line); - $pdf->Add($line); + $pdf->Font($text_line->{'font'}); + $pdf->FontSize( $text_line->{'font_size'} ); + $pdf->Text( $text_line->{'text_llx'}, $text_line->{'text_lly'}, $text_line->{'line'} ); } } --