By default XDP and input prefill data will be read as w3c dom document, you need to convert to AEMFD document using ByteArrayOutputStream, tranformfactory to inputstream and then return new com.adobe.aemfd.docmanager.Document(is)public static Document createFlatPDF(String pathToXDP, com.adobe.aemfd....