Bugfixing: correct handling of optional content

This commit is contained in:
Jakub Melka
2020-01-18 17:53:06 +01:00
parent 1fd01c14fd
commit 7ad4c46124
4 changed files with 52 additions and 18 deletions

View File

@ -516,7 +516,17 @@ PDFOptionalContentMembershipObject PDFOptionalContentMembershipObject::create(co
{
// First, scan all optional content groups
PDFDocumentDataLoaderDecorator loader(document);
std::vector<PDFObjectReference> ocgs = loader.readReferenceArrayFromDictionary(dictionary, "OCGs");
std::vector<PDFObjectReference> ocgs;
PDFObject singleOCG = dictionary->get("OCGs");
if (singleOCG.isReference())
{
ocgs = { singleOCG.getReference() };
}
else
{
ocgs = loader.readReferenceArrayFromDictionary(dictionary, "OCGs");
}
if (!ocgs.empty())
{