private void FlushAllKids(IStructureNode elem) { foreach (IStructureNode kid in elem.GetKids()) { if (kid is PdfStructElem && !((PdfStructElem)kid).IsFlushed()) { FlushAllKids(kid); ((PdfStructElem)kid).Flush(); } } }
private static void Process(IStructureNode elem, StringBuilder builder) { if (elem == null) { return; } builder.Append("Role: " + elem.GetRole() + "\n"); builder.Append("Class name: " + elem.GetType().FullName + "\n"); if (elem is PdfStructElem) { ProcessStructElem((PdfStructElem)elem, builder); } if (elem.GetKids() != null) { foreach (IStructureNode structElem in elem.GetKids()) { Process(structElem, builder); } } }
private void RemovePageTagFromParent(IStructureNode pageTag, IStructureNode parent) { if (parent is PdfStructElem) { PdfStructElem structParent = (PdfStructElem)parent; if (!structParent.IsFlushed()) { structParent.RemoveKid(pageTag); PdfDictionary parentStructDict = structParent.GetPdfObject(); if (waitingTagsManager.GetObjForStructDict(parentStructDict) == null && parent.GetKids().Count == 0 && !(structParent .GetParent() is PdfStructTreeRoot)) { RemovePageTagFromParent(structParent, parent.GetParent()); PdfIndirectReference indRef = parentStructDict.GetIndirectReference(); if (indRef != null) { // TODO how about possible references to structure element from refs or structure destination for instance? indRef.SetFree(); } } } else { if (pageTag is PdfMcr) { throw new PdfException(PdfException.CannotRemoveTagBecauseItsParentIsFlushed); } } } }