public virtual float?GetAttributeAsFloat(String attributeName)
        {
            PdfName   name    = PdfStructTreeRoot.ConvertRoleToPdfName(attributeName);
            PdfNumber attrVal = GetPdfObject().GetAsNumber(name);

            return(attrVal != null ? (float?)attrVal.FloatValue() : (float?)null);
        }
        public virtual String GetAttributeAsText(String attributeName)
        {
            PdfName   name    = PdfStructTreeRoot.ConvertRoleToPdfName(attributeName);
            PdfString attrVal = GetPdfObject().GetAsString(name);

            return(attrVal != null?attrVal.ToUnicodeString() : null);
        }
        public virtual String GetAttributeAsEnum(String attributeName)
        {
            PdfName name    = PdfStructTreeRoot.ConvertRoleToPdfName(attributeName);
            PdfName attrVal = GetPdfObject().GetAsName(name);

            return(attrVal != null?attrVal.GetValue() : null);
        }
        public virtual iText.Kernel.Pdf.Tagging.PdfStructureAttributes RemoveAttribute(String attributeName)
        {
            PdfName name = PdfStructTreeRoot.ConvertRoleToPdfName(attributeName);

            GetPdfObject().Remove(name);
            SetModified();
            return(this);
        }
        public virtual iText.Kernel.Pdf.Tagging.PdfStructureAttributes AddFloatAttribute(String attributeName, float
                                                                                         attributeValue)
        {
            PdfName name = PdfStructTreeRoot.ConvertRoleToPdfName(attributeName);

            GetPdfObject().Put(name, new PdfNumber(attributeValue));
            SetModified();
            return(this);
        }
        public virtual iText.Kernel.Pdf.Tagging.PdfStructureAttributes AddTextAttribute(String attributeName, String
                                                                                        attributeValue)
        {
            PdfName name = PdfStructTreeRoot.ConvertRoleToPdfName(attributeName);

            GetPdfObject().Put(name, new PdfString(attributeValue, PdfEncodings.UNICODE_BIG));
            SetModified();
            return(this);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Adds to the namespace role map (see
        /// <see cref="SetNamespaceRoleMap(iText.Kernel.Pdf.PdfDictionary)"/>
        /// ) a single role mapping to the
        /// default standard structure namespace.
        /// </summary>
        /// <param name="thisNsRole">
        /// a
        /// <see cref="System.String"/>
        /// identifying structure element type in this namespace.
        /// </param>
        /// <param name="defaultNsRole">
        /// a
        /// <see cref="System.String"/>
        /// identifying a structure element type in the default standard structure namespace.
        /// </param>
        /// <returns>
        /// this
        /// <see cref="PdfNamespace"/>
        /// instance.
        /// </returns>
        public virtual iText.Kernel.Pdf.Tagging.PdfNamespace AddNamespaceRoleMapping(String thisNsRole, String defaultNsRole
                                                                                     )
        {
            PdfObject prevVal = GetNamespaceRoleMap(true).Put(PdfStructTreeRoot.ConvertRoleToPdfName(thisNsRole), PdfStructTreeRoot
                                                              .ConvertRoleToPdfName(defaultNsRole));

            LogOverwritingOfMappingIfNeeded(thisNsRole, prevVal);
            SetModified();
            return(this);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Adds to the namespace role map (see
        /// <see cref="SetNamespaceRoleMap(iText.Kernel.Pdf.PdfDictionary)"/>
        /// ) a single role mapping to the
        /// target namespace.
        /// </summary>
        /// <param name="thisNsRole">
        /// a
        /// <see cref="System.String"/>
        /// identifying structure element type in this namespace.
        /// </param>
        /// <param name="targetNsRole">
        /// a
        /// <see cref="System.String"/>
        /// identifying a structure element type in the target namespace.
        /// </param>
        /// <param name="targetNs">
        /// a
        /// <see cref="PdfNamespace"/>
        /// identifying the target namespace.
        /// </param>
        /// <returns>
        /// this
        /// <see cref="PdfNamespace"/>
        /// instance.
        /// </returns>
        public virtual iText.Kernel.Pdf.Tagging.PdfNamespace AddNamespaceRoleMapping(String thisNsRole, String targetNsRole
                                                                                     , iText.Kernel.Pdf.Tagging.PdfNamespace targetNs)
        {
            PdfArray targetMapping = new PdfArray();

            targetMapping.Add(PdfStructTreeRoot.ConvertRoleToPdfName(targetNsRole));
            targetMapping.Add(targetNs.GetPdfObject());
            PdfObject prevVal = GetNamespaceRoleMap(true).Put(PdfStructTreeRoot.ConvertRoleToPdfName(thisNsRole), targetMapping
                                                              );

            LogOverwritingOfMappingIfNeeded(thisNsRole, prevVal);
            SetModified();
            return(this);
        }
 public PdfStructureAttributes(String owner)
     : base(new PdfDictionary())
 {
     GetPdfObject().Put(PdfName.O, PdfStructTreeRoot.ConvertRoleToPdfName(owner));
 }