We’re struggling to control the behavior of bidirectional text within text form fields. Using “This is a test الشاشة الرئيس” as a test case the text order gets switched. Input and output files along with test code below.
@Test
public void setFieldValue() {
final Document doc = new Document("./input.pdf");
final Form form = doc.getForm();
final String fieldName = "Text1";
Arrays.stream(form.getFields())
.filter(f -> f.getFullName().equals(fieldName))
.forEach(tb -> {
if (tb instanceof TextBoxField)
{ tb.setValue("This is a test الشاشة الرئيس"); }
});
doc.save("./output.pdf");
doc.close();
}
input.pdf (11.3 KB)
output.pdf (88.1 KB)