Ejemplo n.º 1
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());
            }
        }
Ejemplo n.º 2
0
        internal virtual void ThrowExceptionIfRoleIsInvalid(AccessibilityProperties properties, PdfNamespace pointerCurrentNamespace
                                                            )
        {
            PdfNamespace @namespace = properties.GetNamespace();

            if (@namespace == null)
            {
                @namespace = pointerCurrentNamespace;
            }
            ThrowExceptionIfRoleIsInvalid(properties.GetRole(), @namespace);
        }