0

I have a template that I am reading in and filling fields with data. Some of the entries are a group of checkboxes, like CITIZENSHIP - US, FN, OTHER. When I read the key all I see is "GROUP 1". I am using the stamper to fill the fields:

string pdfTemp = System.Web.HttpContext.Current.Server.MapPath("~/Images/template.pdf");
iTextSharp.text.pdf.PdfReader reader = new PdfReader(pdfTemp);
StringBuilder sb = new StringBuilder();
iTextSharp.text.pdf.PdfStamper stamper = new PdfStamper(reader, new FileStream(System.Web.HttpContext.Current.Server.MapPath("~/Images/1.pdf"), FileMode.Create));
AcroFields form = stamper.AcroFields;
form.SetField("user_name", "test name");
form.SetField("2 ORGANIZATION", "test org");
form.SetField("4 PHONE DSN and Commercial", "test number");
form.SetField("3 OFFICE SYMBOLDEPARTMENT", "test dept");
form.SetField("5 OFFICIAL EMAIL ADDRESS", "test email");
form.SetField("6 JOB TITLE AND GRADERANK ", "test job");
form.SetField("7 OFFICIAL MAILING ADDRESS ", "test address");

stamper.Close();
Chris Haas
  • 53,986
  • 12
  • 141
  • 274
Dean.DePue
  • 1,013
  • 1
  • 21
  • 45
  • This is a duplicate of [How to check a check box?](http://itextpdf.com/question/how-check-check-box). You need to inspect the PDF to see which values are available. For a longer answer, read [How to get specific types from AcroFields? Like PushButtonField, RadioCheckField, etc](http://itextpdf.com/question/how-get-specific-types-acrofields-pushbuttonfield-radiocheckfield-etc) – Bruno Lowagie Jan 07 '16 at 14:39
  • @BrunoLowagie - OK, I can see the type of fields that are there now, and the one I am asking about is actually a radio button group. How do I check one of them? Those links don't help. – Dean.DePue Jan 07 '16 at 15:13
  • *Those links don't help* is not a constructive comment. As I am the author of the content on those links, I could feel insulted. Moreover since those links explain how to get the different *appearance states* of check boxes as well as radio fields. Give it another try and read [Chapter 6](https://manning-content.s3.amazonaws.com/download/d/3645210-8560-4e6d-9b03-3f9aca1921a5/samplechapter6.pdf) of my book, more specifically pages 181 and 183. – Bruno Lowagie Jan 07 '16 at 15:35
  • @BrunoLowagie - I apologize, I meant no harm. I've looked at those docs and tried to get the different states of Group2 and it lists, Choice1, 4, 0, 1. Which is weird because there are only three options. I will have a partner take a look at the innerds of the doc to see what the originator called those fields and values and see if that helps. – Dean.DePue Jan 07 '16 at 15:59

0 Answers0