truetype font problem
"AAA" <always_rick-/[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.pdfapi2 |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
I have problem with the truetype font. I want to open a PDF and add
some texts, then save it as a new file.
I am required to use true-type 'Futural' font LTe50186.ttf,
LTe50154.ttf and LTe50152.ttf.
If I use these font to create a brand new pdf file with API2, it
works well.
If I use them with my existing program I got "Unable to extract
embeded font ... ...". None of those fonts are working.
So I write a simple program. It's funny that LTe50186.ttf and
LTe50154.ttf work in the following little program, but LTe50152.ttf
doesn't seem to work at all, (I even cannot open the output
Blank_.pdf).
======================================================================
#!perl
use PDF::API2;
my $pdf = PDF::API2->open("Blank.pdf") || &ErrorMessage ("unable to
open pdf");
$page = $pdf->openpage(1);
my $txt = $page->text;
$txt->textstart;
my $fnt = $pdf->ttfont('font\LTe50154.ttf');
$txt->font($fnt, 10);
$txt->translate(5,10);
$txt->text("LTe50154.ttf");
my $fnt = $pdf->ttfont('font\LTe50152.ttf');
$txt->font($fnt, 10);
$txt->translate(5,20);
$txt->text("LTe50152.ttf");
$txt->textend;
$pdf->saveas("Blank_.pdf");;
$pdf->end();
======================================================================
Thank a lot.