Iceman1 has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I am trying to use an external font (FreeMono.ttf) with PDF::API2::Simple but get the following error:
cannot find font '' ... at /usr/local/share/perl/5.10.1/PDF/API2/Resource/CIDFont/TrueType/FontFile.pm line 424.
#!/usr/bin/perl use strict "vars"; use PDF::API2::Simple; # Start new PDF my $page_number = 1; my $pdf = PDF::API2::Simple->new( file => 'test.pdf', header => \&header, footer => \&footer ); # Set a custom font my $font_obj = $pdf->pdf->ttfont($pdf,'FreeMono.ttf'); $pdf->add_font('MonoFont',$font_obj); $pdf->set_font('MonoFont'); # Add a page to the PDF $pdf->add_page(); # Insert some text # Set text color $pdf->fill_color( '#000000' ); for (my $i = 0; $i < 35; $i++) { my $text = "$i - Example text"; $pdf->text( $text, x => $pdf->margin_left, autoflow => 'on' ); } # Save PDF to disk $pdf->save();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: External font with PDF::API2::Simple
by zentara (Cardinal) on Sep 19, 2011 at 12:03 UTC | |
by Iceman1 (Novice) on Sep 19, 2011 at 21:02 UTC | |
|
Re: External font with PDF::API2::Simple
by keszler (Priest) on Sep 19, 2011 at 22:58 UTC | |
by Iceman1 (Novice) on Sep 20, 2011 at 03:37 UTC | |
by zentara (Cardinal) on Sep 20, 2011 at 10:55 UTC | |
by Speedy G (Initiate) on Apr 27, 2012 at 23:58 UTC | |
by Ruilong Deng (Initiate) on Dec 13, 2014 at 12:05 UTC | |
by zentara (Cardinal) on Apr 28, 2012 at 11:06 UTC | |
by Iceman1 (Novice) on Sep 21, 2011 at 04:23 UTC | |
by zentara (Cardinal) on Sep 21, 2011 at 14:12 UTC | |
|