Please see attached FlattenIssue.java. This code populates form fields in the OpenOfficeForm.pdf form and then it flattens the form. However the output OpenOfficeForm_filled_flattened.pdf is not correct. The values of the fields are incorrectly moved in left down corner.
I have found a way how to workaround the issue please see FlattenIssueWorkaround.java which generates correct OpenOfficeForm_filled_flattened_workaround.pdf
Attaching whole eclipse java project