protected internal void SetReader(PdfReader reader)
{
this.reader = reader;
fileName = reader.SafeFile.filename;
if (!openedDocuments.ContainsKey(fileName)) {
openedDocuments.Add(fileName, false);
}
PdfObject obj = reader.Catalog.Get(PdfName.STRUCTTREEROOT);
obj = GetDirectObject(obj);
if ((obj == null) || (!obj.IsDictionary()))
throw new BadPdfFormatException(MessageLocalization.GetComposedMessage("no.structtreeroot.found"));
structTreeRoot = (PdfDictionary)obj;
obj = PdfStructTreeController.GetDirectObject(structTreeRoot.Get(PdfName.PARENTTREE));
if (!obj.IsDictionary())
throw new BadPdfFormatException(MessageLocalization.GetComposedMessage("the.document.does.not.contain.parenttree"));
parentTree = (PdfDictionary)obj;
sourceRoleMap = null;
sourceClassMap = null;
}