Hi all,

I'm trying out some PDF modules and have had some success with PDF::Report
(http://search.cpan.org/author/AORR/PDF-Report-1.10/Report.pm) adding text
and primitive graphics. PD::Report is a wrapper for PDF::API2.

But I'm not having any luck inserting images. Here are the instructions:

     $pdf->addImg($file, $x, $y);

     Add image $file to the current page at position ($x, $y).

I assume that I should provide a filename here. If I do that with a jpeg
image for example, I get this error:

sputnik:~/perl/pdf -> ./new_report > report-new.pdf
Can't call method "val" on an undefined value at
/usr/lib/perl5/site_perl/5.8.0/PDF/API2/PDF/Image.pm line 43.
 
If I try this with a png image (say cpan_banner.png) the program runs
successfully, but Adobe Acrobat Reader reports an error while trying to
parse the image.

#!/usr/bin/perl
use warnings;
use strict;

use PDF::Report;

my $pdf = new PDF::Report();
$pdf->newpage();

my $file = 'image.jpg';
my $x1 = 50;
my $y1 = 450;

$pdf->addImg($file, $x1, $y1, $scale);
### Same problem with 'addImgScaled'

# generate output stream
print $pdf->Finish();

__END__

If I try with a gif, I get:
sputnik:~/perl/pdf -> ./new_report > report-new.pdf
image 'balloon.gif' has unknown format with signature '474946383961' at
/usr/lib/perl5/site_perl/5.8.0/PDF/API2/Image.pm line 75.


I've looked at the various modules (Gfx.pm, Image.pm) but see nothing that I
can puzzle out.


-- 
Kevin Pfeiffer
International University Bremen



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to