Esempio n. 1
0
        private ObjectCollection TraversePagesTree(Object top)
        {
            ObjectCollection retval = new ObjectCollection();

            if (top.Type == "Page")
            {
                Utility.TraceLine("Found a page: " + top.ToString());
                retval.Add(top);
                return(retval);
            }

            if (top.Type == "Pages")
            {
                DictionaryItem kids = top.Dictionary.Get("Kids");
                foreach (Object kid in kids.ValueAsObjects(m_objects))
                {
                    retval.Add(TraversePagesTree(kid));
                }
                return(retval);
            }

            if (top.Type == "")
            {
                foreach (Object kid in top.DirectValueAsObjects(m_objects))
                {
                    retval.Add(TraversePagesTree(kid));
                }

                return(retval);
            }

            throw new RuntimeException("Unknown object type \"" + top.Type + "\" in object " + top.Number +
                                       " " + top.Generation + " pages tree");
        }
Esempio n. 2
0
        public Content(Pdf Document, Object PageObject)
        {
            if (PageObject.Number == -1)
            {
                throw new RuntimeException("Page object is invalid");
            }

            DictionaryItem di = PageObject.Dictionary.Get("Contents");

            if (!di.Valid)
            {
                throw new RuntimeException("Page object does not refer to a content object");
            }

            m_objects = di.ValueAsObjects(Document.Objects);
            if (m_objects.Count == 0)
            {
                throw new RuntimeException("Page object " + PageObject.Number + " " + PageObject.Generation +
                                           " does not refer to a content object which is valid");
            }
        }
Esempio n. 3
0
        public ObjectCollection DirectValueAsObjects(ObjectCollection objs)
        {
            DictionaryItem di = new DictionaryItem("Direct", DirectValue);

            return(di.ValueAsObjects(objs));
        }