I have flatten pdf form using PDFBOX acroForm.flatten(). but using this method it will remove the button.
I still want the button to work even after I flatten my pdf. This the pdf i want to flatten
Use flatten with parameters:
public void flatten(List<PDField> fields, boolean refreshAppearances)
this will only flatten the fields you want.