He used saveIncremental but that one works too when using setValue(),
(my post from yesterday was useless, these checkboxes already have their
appearances).
PDAcroForm pDAcroForm = pDDocument.getDocumentCatalog().getAcroForm();
COSDictionary cosDictionary1 = pDAcroForm.getField("ap.name
fam").getCOSObject();
pDAcroForm.getField("ap.name fam").setValue("family Name");
//cosDictionary1.setString(COSName.V, "family Name");
COSDictionary cosDictionary2 = pDAcroForm.getField("ap.birth
cntry").getCOSObject();
//cosDictionary2.setString(COSName.V, "India");
pDAcroForm.getField("ap.birth cntry").setValue("India");
COSDictionary cosDictionary3 = pDAcroForm.getField("ap.sex").getCOSObject();
//cosDictionary3.setString(COSName.V, "female");
pDAcroForm.getField("ap.sex").setValue("female");
COSDictionary cosDictionary4 =
pDAcroForm.getField("ap.chinese").getCOSObject();
//cosDictionary4.setString(COSName.V, "Yes");
pDAcroForm.getField("ap.chinese").setValue("yes");
FileOutputStream fileOutputStream = new FileOutputStream(new
File("XXXX", "80-saved.pdf"));
Set<COSDictionary> set = new HashSet<>();
set.add(cosDictionary1);
set.add(cosDictionary2);
set.add(cosDictionary3);
set.add(cosDictionary4);
pDDocument.saveIncremental(fileOutputStream, set);
Here's how it looks with PDFBox:
Same with Adobe: