Closed hakonhagland closed 1 year ago
Consider this example:
use strict; use warnings; use GD::Image; use PDF::API2; my $image = GD::Image->new(300,300); $image->colorAllocate(255,255,255); $image->colorAllocate(0,0,0); $image->colorAllocate(255,0,0); $image->rectangle(0,0,300,300,0); $image->filledRectangle(10,10,50,50,2); my $pdf = PDF::API2->new(); my $page = $pdf->page(); $page->boundaries(media => '8x11'); my $image2 = $pdf->image($image); $page->object($image2, 0, 0, 200 * 72/96, 200 * 72/96); $pdf->save('test.pdf');
The program fails with
Not a HASH reference at /home/hakon/perlbrew/perls/perl-5.34.1/lib/site_perl/5.34.1/PDF/API2.pm line 2360.
I believe the problem is
https://github.com/ssimms/pdfapi2/blob/afd003e49d4378a27e033055303e1e791657e17d/lib/PDF/API2.pm#L2248
this line should rather be
return $self->image_gd($file, %options);
passing $self as first argument.
$self
You are correct, and this is now fixed. Thanks for the report and patch.
Consider this example:
The program fails with
I believe the problem is
https://github.com/ssimms/pdfapi2/blob/afd003e49d4378a27e033055303e1e791657e17d/lib/PDF/API2.pm#L2248
this line should rather be
passing
$self
as first argument.