Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: PDF suggestions ?

by Eliya (Vicar)
on Mar 16, 2012 at 15:04 UTC ( [id://959991]=note: print w/replies, xml ) Need Help??


in reply to Re: PDF suggestions ?
in thread PDF suggestions ?

(I'm supposing you're the same AM as in the OP)

Don't use the corefonts, use ttfont() instead and specify the path to the respective .ttf file directly  (a subset of the font, i.e. the required glyphs, will automatically be embedded into the PDF):

my $font = $pdf->ttfont('/path/to/verdana.ttf');

See also Re^2: PDF::API2 / unicode characters.

(And do not encode("utf8", $utftext) the string yourself... — leave it decoded, so Perl can handle Unicode characters correctly.)

Replies are listed 'Best First'.
Re^3: PDF suggestions ?
by Anonymous Monk on Mar 19, 2012 at 11:18 UTC
    I got the following error: Use of uninitialized value in pack at C:/Perl/site/lib/Font/TTF/Cmap.pm line 329. Any ideas how to solve the problem ?
    my $utftext=qq(SOme UTF text); #$utftext=encode("utf8", decode("cp1251", $utftext) ) ; #$utftext=encode("utf8", $utftext ) ; my $pdf; $pdf = PDF::API2->open('first.pdf'); my $page_number = 1; my $page = $pdf->openpage($page_number); #my $font = $pdf->corefont('Verdana');# ,-encoding => 'utf8' my $font = $pdf->ttfont('mypath/times.ttf'); my $text = $page->text(); $text->font($font, 30); $text->translate(359, 713); $text->text("$utftext"); $pdf->saveas('new.pdf');

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://959991]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2024-04-23 14:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found