title: How to get and set field format for all the fields in a pdf
body: <p>I have created <strong>EditTextField</strong> in PDF using iTextSharp library. I can able to set <strong>FieldName</strong> to <strong>EditTextField</strong>. I also want to set <strong>DataFormat</strong> to it. I will get XML file containing only FieldName and Value. So While merging Value to PDF Template, I want to check the <strong>DataFormat</strong>  and according to that I want to convert the value and set.</p>
  
  <p>I have added a EditTextField. I can able to add name to textfield. I want to add format (Like DateTime format) to TextField. So that next time I can able to fetch all the text fields from PDF and check the format and according to the format, I can able to set the data to it programmatically.</p>
  
  <p><a href="https://i.stack.imgur.com/6FtBj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6FtBj.png" alt="enter image description here"></a></p>
  
  <pre><code>TextField _DOBtext = new TextField(pdfStamper.Writer,
      new Rectangle(40, 670, 110, 650), "patient-dob");
  _DOBtext.SetFormat("DateFormat", "mm/dd/yyyy"); // we want to set format like this.
  pdfStamper.AddAnnotation(_DOBtext.GetTextField(), 1);
  pdfStamper.Close();
  </code></pre>
  
  <p>And while processing the same PDF for filling data, we will first check the AcrofieldName, and logic is written below (its not working code) </p>
  
  <pre><code>var GetField = pdfStamper.Acrofields.Field.where(u=&gt;u.Key == "patient-dob").FirstOrDefault();
  var Format = GetField.GetFormat(); // we want like this feature
  if (Format != null) {
      if (Format.Type = "DateTime") {
          value=string.Format(data, Format.FormatString));
          stamper.AcroFields.SetField(fieldId, value); //fieldId = "patient-dob"
      }
  }
  </code></pre>
  
  <p>Please help me to Set and get the DataFormat</p>
  
  <p>(ediit: add iTextSharp tag)</p>