in reply to Re: PDF::API2 font
in thread PDF::API2 font

Thank you.

I am not getting any errors, but the warning - 'Use of uninitialized value in numeric gt (>) at /usr/local/share/perl/5.10.0/PDF/API2/Basic/TTF/Cmap.pm line 258.'

But when I am using a ttf font, it works fine. The problem is with only the otf font. The pdf is being created. But when I open that pdf, it gets closed immediately. And no thumbnail preview available of that pdf file.

Replies are listed 'Best First'.
Re^3: PDF::API2 font
by almut (Canon) on Sep 23, 2009 at 11:35 UTC

    It could be a problem with the specific font, or a subtle bug in PDF::API2 triggered by that very font... But it's hard to tell without knowing more about which font it is (I presume it's not really named "myfont.otf").

    What happens when you try a different OpenType font, for example the one I used in the snippet above (it ships with recent versions of Adobe Reader, so you might already have it, or at least can easily get it).

    Also, which version of PDF::API2 are you using?  And which PDF reader? (I'm asking because not all readers can handle embedded OpenType fonts)

      I was using 'evince' to open the created pdf. As I told earlier, it was immediately closing then itself. In the terminal it showed the error "Error: Mismatch between font type and embedded font file". When I am opening it in Adobe Reader, it opens fine. No problem at all.

      Thank you.
        I am using

        PDF::API2::addFontDirs('home/username/fonts');

        my $font = $pdf->ttfont('myfont.ttf');
        $text->font($font, 14);
        $text->translate(300, 480);
        $text->text('HELLO WORLD!');

        I used different fonts as 'myfont'. But all times, the text displayed is very much expanded horizontally. Lot of space between the characters.
        Is there any options to be given to solve this problem?