I have one more patch that does a little clean-up, attached.
diff --git PDF-API2/lib/PDF/API2/Basic/PDF/Filter/Predictor.pm PDF-API2/lib/PDF/API2/Basic/PDF/Filter/Predictor.pm
index 7d2c388dcfc0..813951d0f6fc 100644
--- PDF-API2/lib/PDF/API2/Basic/PDF/Filter/Predictor.pm
+++ PDF-API2/lib/PDF/API2/Basic/PDF/Filter/Predictor.pm
@@ -22,8 +22,7 @@ sub new {
sub outfilt {
my ($self) = @_;
- warn 'The "outfilt" method is not implemented';
- return;
+ die 'The "outfilt" method is not implemented';
}
sub infilt {
@@ -44,7 +43,7 @@ sub infilt {
} elsif ($predictor >= 10 && $predictor <= 15) {
$self->_depredict_png;
} else {
- warn "Invalid predictor: $predictor";
+ die "Invalid predictor: $predictor";
}
return $obj->{' stream'};
@@ -133,7 +132,7 @@ sub _depredict_png {
sub _depredict_tiff {
my ($self) = @_;
- warn "The TIFF predictor logic has not been implemented";
+ die "The TIFF predictor logic has not been implemented";
}
1;
diff --git PDF-API2/lib/PDF/API2/Resource/XObject/Image/PNG.pm PDF-API2/lib/PDF/API2/Resource/XObject/Image/PNG.pm
index bdf3356a9f8d..3fd5832cb675 100644
--- PDF-API2/lib/PDF/API2/Resource/XObject/Image/PNG.pm
+++ PDF-API2/lib/PDF/API2/Resource/XObject/Image/PNG.pm
@@ -8,6 +8,7 @@ use POSIX qw(ceil);
use IO::File;
use PDF::API2::Util;
+use PDF::API2::Basic::PDF::Filter::Predictor;
use PDF::API2::Basic::PDF::Utils;
no warnings qw[ deprecated recursion uninitialized ];
@@ -31,7 +32,10 @@ sub new {
open($fh,$file);
binmode($fh);
seek($fh,8,0);
+ $self->{Length}=PDFNum(-s $file);
$self->{' stream'}='';
+ $self->{' streamloc'}=0;
+ $self->{' streamsrc'}=$fh;
$self->{' nofilt'}=1;
while(!eof($fh)) {
read($fh,$buf,4);