Interactive forms (iText 7)

I am trying to cast AcroFields to the specific types so I can set properties on them. When I call AcroFields.GetField(string name); all I get is a string. When I call AcroFields.GetFieldItem(string name); I get an object but cannot cast it to the specific type.
I have a dynamic XFA Form that I can fill out manually using Adobe Acrobat on my computer. Using iTextSharp I can read what the XFA XML data is and see the structure of the data. But how can I fill out the form programmatically?
I want create a PDF template from another template. The resulting PDF should still be a template that I can fill out with data. I tried using PdfStamper but the resulting PDF is not template.
What techniques available to fill a PDF form automatically using external data and save them. I have to use data from a database to fill a template PDF and save a copy of it on disk with that data. Language and platform is not issue but it would be good if it can run on windows and Linux.
I have used iText to fill data into existing AcroForm fields in a PDF. I am now looking for a solution to add new AcroForm fields to a PDF. Is this possible with iText? If so, how can I do this?
Tags: XFAformsiText 7pdfXfa
Are there any issues that can come up of removing the XFA format from a PDF form? If I don't drop XFA, I can see the fields pre-filled on Acrobat Reader but not in Acrobat Pro. Other viewers like Ubuntu Document Viewer, present the file correctly. I don't mind dropping XFA but I'm just checking if there might be issues that I am not aware of.
I'm trying to fill out a PDF form using the AcroFields class. I'm able to add text data perfectly, but I'm having issues adding images. How is this done?
I'm using iText to populate the data to PDF templates, which are created in OpenOffice. The form is populating fine; I'm getting proper PDF, but I want to change the alignment of some fields.
I have a PDF with named fields I created with Adobe LifeCycle. I am able to fill the fields using iTextSharp but when I change the text color for a field it does not change.
My code to fill out an XFA form throws no exception and everything seems to be OK, but if I open filled pdf, Adobe Reader says something like this: This document enabled extended features. This document was changed since it was created and using extended features isn't possible anymore.