I used itextSharp dll, add this dll in our reference and include in namespace
using iTextSharp;
using iTextSharp.text;
using iTextSharp.text.pdf;
· From this PDF we can Generate XML
PdfReader reader = new PdfReader(Load_USPTO_PDF_Template_Path);
PdfStamper stamper = new PdfStamper(reader, new FileStream(Temp_PDF_Copy_Path, FileMode.CreateNew, FileAccess.ReadWrite));
AcroFields form = stamper.AcroFields;
XfaForm xfa = form.Xfa;
· We can access the Xml to fill data using XmlDocument method
XmlDocument xmldoc = new XmlDocument();
xmldoc.LoadXml(form.Xfa.DatasetsNode.FirstChild.OuterXml);
· Now data filled XML can be saved in temporary path and can be imported to the PDF
….Our code to fill XML
xmldoc.Save(Temp_XML_Save_path);
· Now we can fill the XML into PDF & Give to user
xfa.FillXfaForm(Temp_XML_Save_path);
stamper.Close();