Exemple #1
0
        public virtual PdfIndirectReference GetPageIndirectReference()
        {
            PdfObject page = null;

            if (GetPdfObject() is PdfDictionary)
            {
                page = ((PdfDictionary)GetPdfObject()).Get(PdfName.Pg, false);
            }
            if (page == null)
            {
                page = parent.GetPdfObject().Get(PdfName.Pg, false);
            }
            if (page is PdfIndirectReference)
            {
                return((PdfIndirectReference)page);
            }
            else
            {
                if (page is PdfDictionary)
                {
                    return(page.GetIndirectReference());
                }
            }
            return(null);
        }
Exemple #2
0
        private static PdfDocument GetDocEnsureIndirect(PdfStructElem structElem)
        {
            PdfIndirectReference indRef = structElem.GetPdfObject().GetIndirectReference();

            if (indRef == null)
            {
                throw new PdfException(PdfException.StructureElementDictionaryShallBeAnIndirectObjectInOrderToHaveChildren
                                       );
            }
            return(indRef.GetDocument());
        }
Exemple #3
0
        public PdfObjRef(PdfAnnotation annot, PdfStructElem parent)
            : base(new PdfDictionary(), parent)
        {
            PdfDictionary parentObject = parent.GetPdfObject();

            EnsureObjectIsAddedToDocument(parentObject);
            PdfDocument doc = parentObject.GetIndirectReference().GetDocument();

            annot.GetPdfObject().Put(PdfName.StructParent, new PdfNumber((int)doc.GetNextStructParentIndex()));
            PdfDictionary dict = (PdfDictionary)GetPdfObject();

            dict.Put(PdfName.Type, PdfName.OBJR);
            dict.Put(PdfName.Obj, annot.GetPdfObject());
        }
 public virtual PdfStructElem AddKid(int index, PdfStructElem structElem)
 {
     AddKidObject(index, structElem.GetPdfObject());
     return(structElem);
 }