Tighten isPageObject (fixes #310)

This commit is contained in:
Jay Berkenbilt 2019-04-20 17:47:51 -04:00
parent 131a21d36f
commit 4ccb29912a
2 changed files with 14 additions and 5 deletions

View File

@ -1,5 +1,14 @@
2019-04-20 Jay Berkenbilt <ejb@ql.org>
* Slightly tighten logic that determines whether an object is a
page. The previous logic was sometimes failing to preserve
annotations because they were passing the overly loose test for
whether something was a page. This fix has a slight risk of
causing some extraneous objects to be copied during page splitting
and merging for erroneous PDF files whose page objects contain
invalid types or are missing the /Type key entirely, both of which
would be invalid according to the PDF specification.
* Revert change that included preservation of outlines (bookmarks)
in --split-pages. The way it was implemented caused a very
significant performance penalty when splitting pages with

View File

@ -2524,14 +2524,14 @@ QPDFObjectHandle::isPageObject()
return true;
}
// Files have been seen in the wild that have /Type (Page)
if (type.isString() && (type.getStringValue() == "Page"))
else if (type.isString() && (type.getStringValue() == "Page"))
{
return true;
}
}
if (this->hasKey("/Contents"))
{
return true;
else
{
return false;
}
}
return false;
}