Background
Pre-populate the form items based on the PDF Template, generate a new PDF file, and keep the form fields allowed to continue modifying.
Code snippet
Using ITextSharp.text.pdf;/ * Code Snippet * /using (var dia = new SaveFileDialog ())) {dia. Filter = @ "PDF files|*.pdf"; Dia. FileName = string. Format ("pdf_{0}", DateTime.Today.ToString ("Yyyy-mm-dd")); if (DIA. ShowDialog () = = DialogResult.OK) {using (FileStream Fswrite = new FileStream (DIA.) FileName, FileMode.OpenOrCreate, FileAccess.Write)) {using (var reader = new Pdfreader (@ "\templates\pdf Template\template01.pdf ")) {using (var stamper = new Pdfstamper (reader, Fswrite)) {Stamper. Writer.closestream = false;//Keep form fields, allow to continue editingStamper. Formflattening = false;//Update form field fieldsvar form = Stamper. Acrofields; Form. SetField ("form1[0]. #subform [0].flt_txtusername[0]", "username"); Stamper. Close (); }}} MessageBox.Show ("Report had been exported", resources.common_successed, MESSAGEBOXBUTTONS.O K, MessageBoxIcon.Information); }}
[. Net]-use ITEXTSHARP to generate template-based PDFs, generate new files, and retain form fields