Exemplo n.º 1
0
 public virtual iText.Kernel.Pdf.Tagging.PdfStructElem AddKid(int index, iText.Kernel.Pdf.Tagging.PdfStructElem
                                                              kid)
 {
     if (GetStructElementType() == InlineLevel || GetStructElementType() == Illustration)
     {
         throw new PdfException(PdfException.InlineLevelOrIllustrationElementCannotContainKids, GetPdfObject());
     }
     AddKidObject(GetPdfObject(), index, kid.GetPdfObject());
     return(kid);
 }
Exemplo n.º 2
0
        /// <summary>
        /// A
        /// <see cref="iText.Kernel.Pdf.PdfName.Ref"/>
        /// identifies the structure element to which the item of content, contained
        /// within this structure element, refers (e.g. footnotes, endnotes, sidebars, etc.).
        /// <p>This value has meaning only for the PDF documents of version <b>2.0 and higher</b>.</p>
        /// </summary>
        /// <param name="ref">
        /// a
        /// <see cref="PdfStructElem"/>
        /// to which the item of content, contained within this structure element, refers.
        /// </param>
        public virtual void AddRef(iText.Kernel.Pdf.Tagging.PdfStructElem @ref)
        {
            if ([email protected]().IsIndirect())
            {
                throw new PdfException(PdfException.RefArrayItemsInStructureElementDictionaryShallBeIndirectObjects);
            }
            VersionConforming.ValidatePdfVersionForDictEntry(GetDocument(), PdfVersion.PDF_2_0, PdfName.Ref, PdfName.StructElem
                                                             );
            PdfArray refsArray = GetPdfObject().GetAsArray(PdfName.Ref);

            if (refsArray == null)
            {
                refsArray = new PdfArray();
                Put(PdfName.Ref, refsArray);
            }
            refsArray.Add(@ref.GetPdfObject());
            SetModified();
        }
Exemplo n.º 3
0
        private IPdfStructElem ConvertPdfObjectToIPdfStructElem(PdfObject obj)
        {
            if (obj.IsIndirectReference())
            {
                obj = ((PdfIndirectReference)obj).GetRefersTo();
            }
            IPdfStructElem elem = null;

            switch (obj.GetObjectType())
            {
            case PdfObject.DICTIONARY: {
                PdfDictionary d = (PdfDictionary)obj;
                if (IsStructElem(d))
                {
                    elem = new iText.Kernel.Pdf.Tagging.PdfStructElem(d);
                }
                else
                {
                    if (PdfName.MCR.Equals(d.GetAsName(PdfName.Type)))
                    {
                        elem = new PdfMcrDictionary(d, this);
                    }
                    else
                    {
                        if (PdfName.OBJR.Equals(d.GetAsName(PdfName.Type)))
                        {
                            elem = new PdfObjRef(d, this);
                        }
                    }
                }
                break;
            }

            case PdfObject.NUMBER: {
                elem = new PdfMcrNumber((PdfNumber)obj, this);
                break;
            }

            default: {
                break;
            }
            }
            return(elem);
        }
Exemplo n.º 4
0
 public virtual iText.Kernel.Pdf.Tagging.PdfStructElem AddKid(int index, iText.Kernel.Pdf.Tagging.PdfStructElem
                                                              kid)
 {
     AddKidObject(GetPdfObject(), index, kid.GetPdfObject());
     return(kid);
 }
Exemplo n.º 5
0
 public virtual iText.Kernel.Pdf.Tagging.PdfStructElem AddKid(iText.Kernel.Pdf.Tagging.PdfStructElem kid)
 {
     return(AddKid(-1, kid));
 }