Found it ....

in the PDF/API2/Resource/Font/CoreFont/courier.pm file I changed

'fontname' => 'Courier',

to

'fontname' => 'Courier-New',

and I added -New, in the other three courier-related files

'fontname' => 'Courier-New,Oblique',
'fontname' => 'Courier-New,Bold',
'fontname' => 'Courier-New,BoldOblique',

and now all is right with the world!

======================%< snip >%================================

I'm wondering if it is just me ...

I recently had need for the Courier font in some PDF output. I have been trying to use the corefonts in PDF::API2 but can't seem to get anything other than Courier-Oblique for output. The other corefonts seem to render fine. Here is a mini test program:

#!/usr/bin/perl use strict; use warnings; use PDF::API2; my @fonts = qw( Courier Courier-Bold Courier-BoldOblique Courier-Oblique Verdana Times Times-BoldItalic Georgia Georgia-Bold ); my $pdf = PDF::API2->new; my $page = $pdf->page; my $text = $page->text; my $y = 700; $text->translate( 100, $y ); foreach my $f (@fonts) { my $cft = $pdf->corefont($f); $text->font( $cft, 12 ); $text->text($f); $y -= 15; $text->translate( 100, $y ); } $pdf->saveas('pdftest.pdf'); $pdf->end();

I have tested this on a couple of my Linux boxes and always get the same result -- four lines of Courier-Oblique on the top. Any ideas where I might be going wrong?

Thanks, Robert M.


In reply to [SOLVED] PDF::API2 and the Elusive Courier Font by rsmeineke

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.