'PdfBox images Alignation Issue after using flatten function

Using flatten function of pdfbox changes the position of images from the required box to be filled.I would like to know if there is a fix for this. I would like the pdfbox team to look into it.Images attached The images are moving out of their respective position after using PDAcroForm.flatten() Images attached here

Irregular image -1

Irregular image - 2



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source