예제 #1
0
        /// <summary>
        /// From an indirect reference object -1 0 R-,
        /// construct a Document -DocumentCatalog in the example- using the objects list
        /// previously loaded
        /// </summary>
        public T GetDocument <T>(IndirectReferenceObject indirectObj) where T : DocumentTree
        {
            IndirectObject obj;

            if (!objects.TryGetValue(indirectObj, out obj))
            {
                return(default(T));
            }
            return(GetDocument <T>(obj));
        }
예제 #2
0
        internal T GetObject <T>(IndirectReferenceObject indirectObj) where T : PdfObject
        {
            IndirectObject obj;

            if (!objects.TryGetValue(indirectObj, out obj))
            {
                throw new PdfException(PdfExceptionCodes.INVALID_CONTENT, $"Impossible to cast");
            }

            return(GetObject <T>(obj));
        }
예제 #3
0
 /// <summary>
 /// From an indirect reference, I want to know the type of this object
 /// For example: 1 0 R
 /// and exists 1 0 obj << /Type /Catalog /Pages 2 0 R >> endobj
 /// It will return "Catalog"
 /// If the obj referenced is not a dictionary, or not exists, for example
 /// 1 0 obj [ 1 2 3 ] endobj
 /// type will be null
 /// </summary>
 public string GetType(IndirectReferenceObject indirectObj)
 => objects.TryGetValue(indirectObj, out IndirectObject obj) ? GetType(obj) : null;