ndnalibi has asked for the wisdom of the Perl Monks concerning the following question:

I am writing a perl CGI script to create a PDF. Everything was working fine. I added some code related to fonts and now I'm getting the following error: Can't locate object method "image_jpg" via package "PDF::API2" at /var/www/cgi-bin/upl.cgi line 308., referer: http://tweak/font_test/ I'm not really looking for an answer, but more of a hint. I want to understand this.
use CGI; # load the CGI.pm module use DBI; # load database module use DBD::mysql; # load mysql driver use PDF::API2;
my $jpeg = $pdf->image_jpeg('/var/www/html/font_test/Pumpkins/backgrou +nd.jpg'); my $png = $pdf->image_png('/var/www/html/font_ +test/Pumpkins/foreground.png'); my $tag = $pdf->image_jpg('/var/www/html/font_ +test/Pumpkins/tagline.jpg');

Replies are listed 'Best First'.
Re: Can't locate object method "image_jpg"
by themage (Friar) on Sep 11, 2008 at 15:47 UTC
    Hi ndnalibi,

    You mistyped the image_jpeg method as image_jpg (missing the e) in your second call the the method, or am I missing anything?

      themage : That's correct. You didn't miss asomething. jpg ne jpeg has bit me before as well.
        Thanks so much. I guess it's true that sometimes you're too close to the problem to see the obvious.