Exemple #1
0
        /// <summary>
        /// From an object reference, I want to know the type of this object
        /// For example: 1 0 obj << /Type /Catalog /Pages 2 0 R >> endobj
        /// It will return "Catalog"
        /// If the obj referenced is not a dictionary, for example
        /// 1 0 obj [ 1 2 3 ] endobj
        /// type will be null
        /// </summary>
        public string GetType(IndirectObject obj)
        {
            var dic = obj.Child <DictionaryObject>(0);

            if (dic == null)
            {
                return(null);
            }
            if (dic.Dictionary.ContainsKey("Type"))
            {
                return(GetObject <NameObject>(dic.Dictionary["Type"]).Value);
            }
            return(null);
        }