Hi zentara
Thanks for the reply.
I have studied the perl doc extensively but have not been able to work it out.
I missed that but as per your notes and their example, I have added a font size but still get the same error:
my $font_obj = $pdf->pdf->ttfont('freemono.ttf');
$pdf->add_font('MonoFont',$font_obj,12);
Can't call method "text" without a package or object reference at /usr
+/share/perl5/PDF/API2/Simple.pm line 435.
The subroutine in Simple.pm that has line 435 is:
sub add_font {
my ($self, $font_name, $font_obj, $font_size) = @_;
if ( $font_obj ) {
LINE 435 --> $self->current_page->text->font($font_obj, $font_size);
$self->fonts->{$font_name} = $font_obj;
}
if ( ! exists $self->fonts->{$font_name} ) {
$self->fonts->{$font_name} = $self->pdf->corefont($font_name);
}
$self->current_font( $self->fonts->{$font_name} );
}
I have been unable to see where I'm going wrong.
I presume that what PDF::API2::Simple sends to PDF::API2 is already coded within PDF::API2::Simple, so I figured their example should be all that is needed for it to work?
Would you have any other suggestions that would help track it down or do you think I am missimg something with the above?
I would appreciate any help you could offer with this very frustrating problem.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.