title: iTextSharp, code to submit all fields on post
body: <p>I am using iTextSharp and I have run across a problem I cannot solve.  I am loading an existing PDF form that contains a mixture of text fields and check boxes.  I dynamically add a submit button to the form before sending it to the browser where it will be filled out then resubmitted to the server.  My problem is that I cannot get the PDF to submit back ALL of the filled and empty fields.  I have identified the code that should return all fields but I can't get empty check boxes to return.  I am at the point where I think its not possible.  Anyone doing this using a PDF Acroform created using Acrobat Pro - not LiveCycle.  See below for code snippet that creates the button.  I am doing this in C# asp.net 4 using iTextSharp.</p>
  
  <pre><code>    ButtonRect = MakeButtonRect(PDFFormOut, ButtonPos);
      button = new PushbuttonField(PDFFormOut.Writer, ButtonRect, "postSubmit");
      button.BackgroundColor = BaseColor.LIGHT_GRAY;
      button.BorderColor = GrayColor.BLACK;
      button.BorderWidth = 1f;
      button.BorderStyle = PdfBorderDictionary.STYLE_BEVELED;
      button.TextColor = GrayColor.GREEN;
      button.FontSize = 8f;
      button.Text = "Submit";
      button.Visibility = PushbuttonField.VISIBLE_BUT_DOES_NOT_PRINT;
      field = button.Field;
      field.Put(PdfName.TU, new PdfString("Save changes and return to the folder."));
      **field.Action = PdfAction.CreateSubmitForm(@"http://" + Application["WebSiteRoot"].ToString() + @"/SaveForm.aspx?OP=SAV", null, PdfAction.SUBMIT_HTML_FORMAT | PdfAction.SUBMIT_INCLUDE_NO_VALUE_FIELDS);**
      PDFFormOut.AddAnnotation(field, 1);
  </code></pre>