Revert "Don't forget to copy /Pages properties too"

This reverts commit 224d9dc6e52245f9d16a22af460f386545403cd1.
This commit is contained in:
Inusual
2020-02-25 05:48:52 -04:00
committed by Eliot Jones
parent 20ff625c2e
commit 932857cf8c

View File

@@ -221,29 +221,15 @@
pageReferences.Add(new IndirectReferenceToken(newEntry));
}
var contentDictionary = new Dictionary<NameToken, IToken>
var pagesDictionary = new DictionaryToken(new Dictionary<NameToken, IToken>
{
{ NameToken.Type, NameToken.Pages },
{ NameToken.Kids, new ArrayToken(pageReferences) },
{ NameToken.Count, new NumericToken(pageReferences.Count) },
{ NameToken.Parent, treeParentReference }
};
});
// Copy page tree properties, if there any that doesn't conflict with the new ones
foreach(var set in treeNode.NodeDictionary.Data)
{
var nameToken = NameToken.Create(set.Key);
// We don't want to override any value
if (contentDictionary.ContainsKey(nameToken))
continue;
contentDictionary.Add(NameToken.Create(nameToken), CopyToken(set.Value, tokenScanner));
}
var pagesToken = new DictionaryToken(contentDictionary);
return Context.WriteObject(Memory, pagesToken, currentNodeReserved);
return Context.WriteObject(Memory, pagesDictionary, currentNodeReserved);
}
private ObjectToken CopyPageNode(PageTreeNode pageNode, IndirectReferenceToken parentPagesObject, IPdfTokenScanner tokenScanner)