[Koha] Problem with unicode character in pdf export label

Bernardo Gonzalez Kriegel bgkriegel at gmail.com
Wed Apr 9 04:56:34 NZST 2014


Well, with current setup is not possible.

But if you don't mind to do a few changes in a file, then it can be done

You need:
1) An unicode TTF font on your system, for example DejaVuSans (good for
Arabic), or GNU unifont (complete but ugly),
or Arial Unicode MS (complete but not free)
Take note of it's path

2) Edit on your staff dir "labels/label-create-pdf.pl", and rewrite
function "_print_text"
(lines with # are original, font path on TTFont line)

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);
        my $pdf_font =
$pdf->TTFont('/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf');
        $pdf->FontSize($text_line->{'font_size'});
        $pdf->Text( $text_line->{'text_llx'}, $text_line->{'text_lly'},
$text_line->{'line'}, '', '');
    }
}

3) With this you can get something like
https://www.dropbox.com/sh/0ksf8foxcqia037/z2uRe6BCpf/label_batch_1.pdf
(using Arial Unicode MS)

But, as you can see, is for ltr languages :(


Regards,
Bernardo



-- 
Bernardo Gonzalez Kriegel
bgkriegel at gmail.com


On Mon, Apr 7, 2014 at 10:22 AM, حسين رضوي <reza0770 at gmail.com> wrote:

> hello all,
>
> We have a problem when printing labels with Arabic content (characters).
> when we print the spine label with non-Latin (Arabic) characters became
> codes not characters.
>
> Has anybody an idea how we can fix the problem.
>
> Best Regards.
> Hussain A.
> _______________________________________________
> Koha mailing list  http://koha-community.org
> Koha at lists.katipo.co.nz
> http://lists.katipo.co.nz/mailman/listinfo/koha
>


More information about the Koha mailing list