1 year ago
#380913
sgch
Programmatically fill IRS forms
I'm trying to fill IRS forms (for example https://docs.google.com/document/d/1ZpqwUusHIOKToKhf8eufywS_8lGxcDuGo0AcNGsQmyw/edit#) programmatically using ITextSharp:
var file = @"w8BENEV1021.pdf";
var fileS = @"w8BENEV1021_1.pdf";
using (var reader = new PdfReader(file))
{
reader.RemoveUsageRights(); // This is needed for some readers (acrobat) so they will not show pop that we sealed the file to changes
using (var memStream = new MemoryStream())
{
using (var stamper = new PdfStamper(reader, memStream))
{
AcroFields fields = stamper.AcroFields;
fields.SetField("topmostSubform[0].Page1[0].f1_1[0]", "nameodfodod");
fields.SetField("topmostSubform[0].Page1[0].c1_1[12]", "13");
fields.SetField("topmostSubform[0].Page2[0].c2_5[0]", "11");
stamper.FormFlattening = true;
stamper.Close();
var data = memStream.ToArray();
File.WriteAllBytes(fileS, data);
}
}
}
I was wondering how do I know to which control in the PDF does each key maps to (like topmostSubform[0].Page1[0].f1_1[0]) is there some GUI that shows that?
c#
itext
0 Answers
Your Answer