@darshpatel
We were able to reproduce the issue using below code snippet:
Document document = new Document();
Page page = document.getPages().add();
TextBoxField txtField = new TextBoxField(page, new Rectangle(35, 50, 150, 100));
txtField.getDefaultAppearance().setFontSize(10);
txtField.setPartialName("Test");
txtField.setMaxLen(20);
txtField.setReadOnly(false);
txtField.getCharacteristics().setBackground(Color.getLightGray());
txtField.setValue("Fillable Pdf\'s Test's Pdf");
Border border = new Border(txtField);
border.setWidth(1);
border.setDash(new Dash((int) 0.1, (int) 0.1));
border.setHCornerRadius(4);
txtField.setBorder(border);
document.getForm().add(txtField, 1);
document.save(dir+"output_ReadOnly_false.pdf");
As a workaround, you can explicitly set the font for the TextBoxField.
The next code snippet creating correct pdf file:
Document document = new Document();
Page page = document.getPages().add();
TextBoxField txtField = new TextBoxField(page, new Rectangle(35, 50, 150, 100));
txtField.getDefaultAppearance().setFontSize(10);
txtField.setPartialName("Test");
txtField.setMaxLen(20);
txtField.setReadOnly(false);
txtField.getCharacteristics().setBackground(Color.getLightGray());
txtField.setValue("Fillable Pdf\'s Test's Pdf");
txtField.getDefaultAppearance().setFontName("Arial");
Border border = new Border(txtField);
border.setWidth(1);
border.setDash(new Dash((int) 0.1, (int) 0.1));
border.setHCornerRadius(4);
txtField.setBorder(border);
document.getForm().add(txtField, 1);
document.save(dir+"output_ReadOnly_false_arial.pdf");
The result pdf file and screenshot are attached too.
out_screenshot_2.png (14.3 KB)
output_ReadOnly_false_arial.pdf (77.0 KB)