2009/10/22 Dermot <paik...@googlemail.com>: > 2009/10/22 ANJAN PURKAYASTHA <anjan.purkayas...@gmail.com>: >> Hi All, >> I wrote a short script to test the PDF::API2::Lite module. I work on a Mac >> OSX. >> Here is the script: >> #! /usr/bin/perl >> >> use strict; >> use warnings; >> use PDF::API2::Lite; >> >> my $pdf= PDF::API2::Lite->new; >> >> my $img = $pdf->image_jpeg('/Users/anjan/Desktop/personal/me.jpeg'); >> $pdf->page($img->width, $img->height); >> $pdf->image($img, 0, 0); >> $pdf->saveas('/Users/anjan/Desktop/test.pdf'); >> ############################################################# >> >> I get an error: Can't call method "val" on an undefined value at >> /Library/Perl/5.8.8/PDF/API2/Resource/XObject/Image.pm line 99.
I haven't used the Lite version before but I have seen this rather un-helpful message before. In PDF::API2 you would have to create a graphic object first, something like my $x = 100; my $y = 200; my $imageObj = $pdf->gfx; # Create your object # realy should test -e here. my $jpeg = $imageObj->image_jpeg('/Users/anjan/Desktop/personal/me.jpeg'); $imageObj->image($jpeg, $x, $y); # lays the images. I heart this module. It really is powerful. HTH, Dp. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/