Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/PDF/API2.pm
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ sub proc_pages {
$pdf->{' apipagecount'} ||= 0;
foreach my $page ($object->{'Kids'}->elements()) {
$page->realise();
if ($page->{'Type'}->val() eq 'Pages') {
if (defined $page->{'Type'} && $page->{'Type'}->val() eq 'Pages') {
push @pages, proc_pages($pdf, $page);
}
else {
Expand Down
24 changes: 24 additions & 0 deletions lib/PDF/API2/Basic/PDF/Dict.pm
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,30 @@ sub type {
return $self->{'Type'}->val();
}

=head2 $p->find_prop($key)

Searches up through the inheritance tree to find a property.

=cut

sub find_prop {
my ($self, $prop) = @_;

if (defined $self->{$prop}) {
if (ref($self->{$prop}) and $self->{$prop}->isa('PDF::API2::Basic::PDF::Objind')) {
return $self->{$prop}->realise();
}
else {
return $self->{$prop};
}
}
elsif (defined $self->{'Parent'}) {
return $self->{'Parent'}->find_prop($prop);
}

return;
}

=head2 @filters = $d->filter(@filters)

Get/Set one or more filters being used by the optional stream attached to the dictionary.
Expand Down