I looked at XML, but it seems as though it does not have the required tags for creating forms. Plus it is probably far easier to do the document in Word, then convert to PDF and add the form fields using Acrobat.
It looks like the steps I have to take are:
- Use PdfReader to get the original PDF.
- Use PdfStamper to edit the form fields, save into a MemoryStream.
- Populate a PdfWriter document from the PdfStamper (which actually contains PdfStamper.Writer, but I dont think you can access the document part of it). Save into MemoryStream which is then sent to the user.
Don't know why you have to go through all those stages just to modify a file (only need the first two if you don't need to change the title). The last stage seems as though it would be inefficient.
Although PdfStamper does have a SetMoreInfo method that may be able to change the meta information (at least in iText, not checked if iTextSharp has this).
Pity there are no iTextSharp forums to ask on.
Can you tell me how to write pdf contents to word doc.