Example #1
0
        public static PdfDictionary OutputNamedDestinationAsStrings(Dictionary <string, string> names, PdfWriter writer)
        {
            Dictionary <string, PdfObject> n2 = new Dictionary <string, PdfObject>(names.Count);

            foreach (String key in names.Keys)
            {
                try {
                    String   value = names[key];
                    PdfArray ar    = CreateDestinationArray(value, writer);
                    n2[key] = writer.AddToBody(ar).IndirectReference;
                }
                catch {
                    // empty on purpose
                }
            }
            return(PdfNameTree.WriteTree(n2, writer));
        }
Example #2
0
        public static PdfDictionary OutputNamedDestinationAsStrings(Hashtable names, PdfWriter writer)
        {
            Hashtable n2 = new Hashtable();

            foreach (String key in names.Keys)
            {
                try {
                    String   value = (String)names[key];
                    PdfArray ar    = CreateDestinationArray(value, writer);
                    n2[key] = writer.AddToBody(ar).IndirectReference;
                }
                catch {
                    // empty on purpose
                }
            }
            return(PdfNameTree.WriteTree(n2, writer));
        }
Example #3
0
        internal void BuildTree()
        {
            CreateNumTree();
            PdfDictionary dicTree = PdfNumberTree.WriteTree(numTree, writer);

            if (dicTree != null)
            {
                Put(PdfName.PARENTTREE, writer.AddToBody(dicTree).IndirectReference);
            }
            if (classMap != null && classes.Count > 0)
            {
                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.GetPdfObject(i).IsDictionary())
                            {
                                newArray.Add(writer.AddToBody(array.GetAsDict(i)).IndirectReference);
                            }
                        }
                        classMap.Put(entry.Key, newArray);
                    }
                }
                Put(PdfName.CLASSMAP, writer.AddToBody(classMap).IndirectReference);
            }
            if (idTreeMap != null && idTreeMap.Count > 0)
            {
                PdfDictionary dic = PdfNameTree.WriteTree(idTreeMap, writer);
                this.Put(PdfName.IDTREE, dic);
            }
            NodeProcess(this, reference);
        }