Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
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.


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re^3: External font with PDF::API2::Simple by zentara
in thread External font with PDF::API2::Simple by Iceman1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (4)
    As of 2014-12-27 10:22 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (176 votes), past polls