public override AccessibilityProperties AddAttributes(PdfDictionary attributes)
        {
            PdfObject attributesObject   = backingElem.GetAttributes(false);
            PdfObject combinedAttributes = CombineAttributesList(attributesObject, JavaCollectionsUtil.SingletonList(attributes
                                                                                                                     ), backingElem.GetPdfObject().GetAsNumber(PdfName.R));

            backingElem.SetAttributes(combinedAttributes);
            return(this);
        }
Пример #2
0
        internal static void Apply(AccessibilityProperties properties, PdfStructElem elem)
        {
            if (properties.GetActualText() != null)
            {
                elem.SetActualText(new PdfString(properties.GetActualText(), PdfEncodings.UNICODE_BIG));
            }
            if (properties.GetAlternateDescription() != null)
            {
                elem.SetAlt(new PdfString(properties.GetAlternateDescription(), PdfEncodings.UNICODE_BIG));
            }
            if (properties.GetExpansion() != null)
            {
                elem.SetE(new PdfString(properties.GetExpansion(), PdfEncodings.UNICODE_BIG));
            }
            if (properties.GetLanguage() != null)
            {
                elem.SetLang(new PdfString(properties.GetLanguage(), PdfEncodings.UNICODE_BIG));
            }
            IList <PdfStructureAttributes> newAttributesList = properties.GetAttributesList();

            if (newAttributesList.Count > 0)
            {
                PdfObject attributesObject   = elem.GetAttributes(false);
                PdfObject combinedAttributes = CombineAttributesList(attributesObject, -1, newAttributesList, elem.GetPdfObject
                                                                         ().GetAsNumber(PdfName.R));
                elem.SetAttributes(combinedAttributes);
            }
            if (properties.GetPhoneme() != null)
            {
                elem.SetPhoneme(new PdfString(properties.GetPhoneme(), PdfEncodings.UNICODE_BIG));
            }
            if (properties.GetPhoneticAlphabet() != null)
            {
                elem.SetPhoneticAlphabet(new PdfName(properties.GetPhoneticAlphabet()));
            }
            if (properties.GetNamespace() != null)
            {
                elem.SetNamespace(properties.GetNamespace());
            }
            foreach (TagTreePointer @ref in properties.GetRefsList())
            {
                elem.AddRef(@ref.GetCurrentStructElem());
            }
        }
 internal virtual void SetToStructElem(PdfStructElem elem) {
     if (GetActualText() != null) {
         elem.SetActualText(new PdfString(GetActualText()));
     }
     if (GetAlternateDescription() != null) {
         elem.SetAlt(new PdfString(GetAlternateDescription()));
     }
     if (GetExpansion() != null) {
         elem.SetE(new PdfString(GetExpansion()));
     }
     if (GetLanguage() != null) {
         elem.SetLang(new PdfString(GetLanguage()));
     }
     IList<PdfDictionary> newAttributesList = GetAttributesList();
     if (newAttributesList.Count > 0) {
         PdfObject attributesObject = elem.GetAttributes(false);
         PdfObject combinedAttributes = CombineAttributesList(attributesObject, newAttributesList, elem.GetPdfObject
             ().GetAsNumber(PdfName.R));
         elem.SetAttributes(combinedAttributes);
     }
 }