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); }
protected internal virtual void InspectAttributes(PdfStructElem kid) { PdfObject attrObj = kid.GetAttributes(false); if (attrObj != null) { PdfDictionary attrDict; if (attrObj is PdfArray) { attrDict = ((PdfArray)attrObj).GetAsDictionary(0); } else { attrDict = (PdfDictionary)attrObj; } try { foreach (PdfName key in attrDict.KeySet()) { @out.Write(' '); String attrName = key.GetValue(); @out.Write(char.ToLower(attrName[0]) + attrName.Substring(1)); @out.Write("=\""); @out.Write(attrDict.Get(key, false).ToString()); @out.Write("\""); } } catch (System.IO.IOException e) { throw new iText.IO.IOException(iText.IO.IOException.UnknownIOException, e); } } }
/// <exception cref="System.IO.IOException"/> protected internal virtual void InspectAttributes(PdfStructElem kid) { PdfObject attrObj = kid.GetAttributes(false); if (attrObj != null) { PdfDictionary attrDict; if (attrObj is PdfArray) { attrDict = ((PdfArray)attrObj).GetAsDictionary(0); } else { attrDict = (PdfDictionary)attrObj; } foreach (KeyValuePair <PdfName, PdfObject> entry in attrDict.EntrySet()) { @out.Write(' '); String attrName = entry.Key.GetValue(); @out.Write(char.ToLower(attrName[0]) + attrName.Substring(1)); @out.Write("=\""); @out.Write(entry.Value.ToString()); @out.Write("\""); } } }
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); } }