Pdfstamper can't find fields.
- From: "Rob Trahan" <robert.trahan (at) gmail.com>
- Date: Tue, 16 May 2006 23:31:59 -0600
Hello, I'm struggling to use the pdfstamper to fill text fields on a simple pdf.
I'm doing this in C#. What I've done is made a simple pdf document in
Acrobat 7 pro using their designer. The text field's name is
textfield1.
My code is as follows:
string formFile = (at) ".\InputPDF.pdf";
string newFile = (at) ".\OutputPDF.pdf";
PdfReader reader = new PdfReader(formFile);
PdfStamper stamper = new PdfStamper(reader, new
FileStream(newFile,FileMode.Create));
AcroFields fields = stamper.AcroFields;
String fName = fields.GetField("textfield1");
textBox1.Text = "Field name is: " + fName;
if (fields.SetField("textbox1", "doe"))
{
textBox1.Text += " ...Field was set";
}
else
{
textBox1.Text += " ...Not set.";
}
The field never gets set. If I debug, under the form object I can see
a hashtable having a key of "form[0].textbox[0]", I've tried accessing
it with that string as well, and still get nothing.
Note that I'm not using an FDF, but have seen examples without, using
SetField instead for SetFields.
I really do not want to have to build the pdf by hand using the other
iText methods. What might I be doing wrong?
Thanks,
Rob
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
iText-questions mailing list
iText-questions (at) lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions