Have you read closely the perldoc for the module?
You can optionally pass a font object and font size if you have loade
+d an external font.
my $font_obj = $pdf->pdf->ttfont('new_font.ttf');
$pdf->add_font('NewFont', $font_obj, '12');
Refer to PDF::API2 for the various font methods, like "ttfont",
+ available.
Just from that, it appears that your $pdf->add_font('MonoFont',$font_obj);
needs a font size specification added.
Furthermore, looking through the examples in PDF::API2, there are code constructs like
# from examples/*02_truetype_fonts-pl
foreach $fe (qw(
adobe-standard cp437 cp850 latin1
)) {
print STDERR "$fn ($fe)\n";
$font=$pdf->ttfont($fn , -encode =>$fe);
# from examples/*02_synthetic_fonts-pl
use PDF::API2;
use PDF::API2::SynFont;
$pdf=PDF::API2->new;
$f1=$pdf->corefont('Arial',-encode=>'latin1');
$f2=$pdf->corefont('Helvetica-Bold',-encode=>'latin1');
$f3=$pdf->corefont('Helvetica-Oblique',-encode=>'latin1');
$f4=$pdf->corefont('Helvetica-BoldOblique',-encode=>'latin1');
my $font=PDF::API2::SynFont->new_api($pdf,$f1,-bold=>4);
so you may need to specify an encoding, or at least run some simple examples to see how to get your font code right.
|