iTextSharp.text.pdf.PdfStructureTreeRoot.BuildTree C# (CSharp) Метод

BuildTree() приватный Метод

private BuildTree ( ) : void
Результат void
        internal void BuildTree()
        {
            Dictionary<int, PdfIndirectReference> numTree = new Dictionary<int,PdfIndirectReference>();
            foreach (int i in parentTree.Keys) {
                PdfArray ar = (PdfArray)parentTree[i];
                numTree[i] = writer.AddToBody(ar).IndirectReference;
            }
            PdfDictionary dicTree = PdfNumberTree.WriteTree(numTree, writer);
            if (dicTree != null)
                Put(PdfName.PARENTTREE, writer.AddToBody(dicTree).IndirectReference);
            if (classMap != null) {
                foreach (KeyValuePair<PdfName,PdfObject> entry in classes) {
                    PdfObject value = entry.Value;
                    if (value.IsDictionary())
                        classMap.Put(entry.Key, writer.AddToBody(value).IndirectReference);
                    else if (value.IsArray()) {
                        PdfArray newArray = new PdfArray();
                        PdfArray array = (PdfArray)value;
                        for (int i = 0; i < array.Size; ++i) {
                            if (array[i].IsDictionary())
                                newArray.Add(writer.AddToBody(array.GetAsDict(i)).IndirectReference);
                        }
                        classMap.Put(entry.Key,newArray);
                    }
                }
                Put(PdfName.CLASSMAP, writer.AddToBody(classMap).IndirectReference);
            }
            NodeProcess(this, reference);
        }