If you are opening the pdf from stream, Document.Save will save the modification to the byte array. So you will need to re-write the byte array into the file system (check the below code)
The above code will get all types of annotations, you will need to filter them based on type, maybe also field name.. use something like the following:
Document document = new Document();
PDFMemStream memStream = new PDFMemStream(File.ReadAllBytes(path));
if(document.OpenStream(memStream, "") == 0)
{
for(int i = 0; i < document.PageCount; i++)
{
Page page = document.GetPage(i);
page.ObjsStart();
for (int j = 0; j < page.AnnotCount; j++)
{
Page.Annotation annot = page.GetAnnot(j);
if (annot.EditType > 0 && annot.FieldName.Equals("Text3"))
{ //edit form
annot.SetEditText("New string");
} else if(annot.CheckStatus >= 0)
{ //cehck box
} else if (annot.ComboItemCount >= 0)
{ //combo box
}
}
page.Close();
}
}
document.Save();
document.Close();
File.WriteAllBytes(path, memStream.Get_data());
You can also check
www.radaeepdf.com/documentation/javadocs...ation.html#GetType--