--- PDF\API2\Basic\PDF\Pages.old Fri Jul 7 04:53:59 2017 +++ PDF\API2\Basic\PDF\Pages.pm Sat Mar 30 01:14:48 2019 @@ -216,7 +216,7 @@ $ppnum = scalar $ppages->{'Kids'}->realise->elementsof; for ($pindex = 0; $pindex < $ppnum; $pindex++) { last if ($ppages->{'Kids'}{' val'}[$pindex] eq $self); } - $pindex = -1 if ($pindex == $ppnum); + $pindex ++ if $index == -1; $ppages->add_page_recurse($newpages, $pindex); } }