Skip to content

Commit 4611117

Browse files
committed
Use IAccessible element to set language of formfields
DEVSIX-8205
1 parent 0fde73f commit 4611117

9 files changed

+6
-5
lines changed

src/main/java/com/itextpdf/html2pdf/attach/impl/tags/ButtonTagWorker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public IPropertyContainer getElementResult() {
108108
if (formField == null) {
109109
if (hasChildren) {
110110
Button button = new Button(name);
111-
button.setProperty(FormProperty.FORM_ACCESSIBILITY_LANGUAGE, lang);
111+
button.getAccessibilityProperties().setLanguage(lang);
112112
Div div = (Div) super.getElementResult();
113113
for (IElement element : div.getChildren()) {
114114
if (element instanceof IAccessibleElement) {
@@ -124,7 +124,7 @@ public IPropertyContainer getElementResult() {
124124
formField = button;
125125
} else {
126126
Button inputButton = new Button(name);
127-
inputButton.setProperty(FormProperty.FORM_ACCESSIBILITY_LANGUAGE, lang);
127+
inputButton.getAccessibilityProperties().setLanguage(lang);
128128
inputButton.setValue(fallbackContent.toString().trim());
129129
formField = inputButton;
130130
}

src/main/java/com/itextpdf/html2pdf/attach/impl/tags/InputTagWorker.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ This file is part of the iText (R) project.
4040
import com.itextpdf.layout.element.IElement;
4141
import com.itextpdf.layout.element.Paragraph;
4242
import com.itextpdf.layout.properties.Property;
43+
import com.itextpdf.layout.tagging.IAccessibleElement;
4344
import com.itextpdf.styledxmlparser.css.util.CssDimensionParsingUtils;
4445
import com.itextpdf.styledxmlparser.node.IElementNode;
4546

@@ -160,7 +161,7 @@ public InputTagWorker(IElementNode element, ProcessorContext context) {
160161
}
161162
if (formElement != null) {
162163
formElement.setProperty(FormProperty.FORM_FIELD_FLATTEN, !context.isCreateAcroForm());
163-
formElement.setProperty(FormProperty.FORM_ACCESSIBILITY_LANGUAGE, lang);
164+
((IAccessibleElement)formElement).getAccessibilityProperties().setLanguage(lang);
164165
if (context.getConformanceLevel() != null) {
165166
formElement.setProperty(FormProperty.FORM_CONFORMANCE_LEVEL, context.getConformanceLevel());
166167
}

src/main/java/com/itextpdf/html2pdf/attach/impl/tags/SelectTagWorker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public SelectTagWorker(IElementNode element, ProcessorContext context) {
8282
selectElement = new ComboBoxField(name);
8383
}
8484
String lang = element.getAttribute(AttributeConstants.LANG);
85-
selectElement.setProperty(FormProperty.FORM_ACCESSIBILITY_LANGUAGE, lang);
85+
selectElement.getAccessibilityProperties().setLanguage(lang);
8686
selectElement.setProperty(FormProperty.FORM_FIELD_FLATTEN, !context.isCreateAcroForm());
8787
if (context.getConformanceLevel() != null) {
8888
selectElement.setProperty(FormProperty.FORM_CONFORMANCE_LEVEL, context.getConformanceLevel());

src/main/java/com/itextpdf/html2pdf/attach/impl/tags/TextAreaTagWorker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public TextAreaTagWorker(IElementNode element, ProcessorContext context) {
7373
textArea.setProperty(FormProperty.FORM_FIELD_ROWS, rows);
7474
textArea.setProperty(FormProperty.FORM_FIELD_COLS, cols);
7575
textArea.setProperty(FormProperty.FORM_FIELD_FLATTEN, !context.isCreateAcroForm());
76-
textArea.setProperty(FormProperty.FORM_ACCESSIBILITY_LANGUAGE, element.getAttribute(AttributeConstants.LANG));
76+
textArea.getAccessibilityProperties().setLanguage(element.getAttribute(AttributeConstants.LANG));
7777

7878
// Default html2pdf text area appearance differs from the default one for form fields.
7979
// That's why we need to get rid of several properties we set by default during TextArea instance creation.

0 commit comments

Comments
 (0)