Hi,
PDFDoc doc = new PDFDoc(inputStream);
FDFDoc fdoc = FDFDoc.createFromXFDF(document.getXfdfData());
doc.fdfMerge(fdoc);
makeAnnotationsAppear(doc.getPageIterator()); // custom code, calling refreshAppearance() on all annotations
doc.flattenAnnotations(false);
Image 1: Free Text annotation made with Annotation Tools
Image 2: Annotation flattened into the document
(if the images aren't attached again, please check out these links: 1) https://drive.google.com/open?id=1eWON0gO1HlNj98WM48ktiKpAxu5SDKaw 2) https://drive.google.com/open?id=1wwkLz16Y2vLFNCFgL7SLZNWx-vn3l_rG )