Reputation: 33
I want to set just a field name leaving the value empty in my C# code so I am wondering is there any other way to do that except :
stamper.AcroFields.SetField("license", "");
Is that possible with setFieldProperty(String field, String name, Object value, int[] inst) method in AcroFieds class? What it is for?
Please help,
thanks in advance!
Upvotes: 0
Views: 1169
Reputation: 77606
Your question isn't clear. Let me give you three answers in the hope that one of my answers matches your question.
You want to add a field to an existing document:
This isn't done with the SetField()
method (AcroFields
) but with the AddAnnotation()
method (PdfStamper
). You create a PdfFormField
instance (e.g. with the help of the TextField
class) and you add it to a specific page.
stamper.AddAnnotation(field, pagenumber);
You want to rename an existing field
This isn't done with the SetField()
method, but with the RenameField()
method. See iTextSharp RenameField bug? for more info.
You want to change properties in an existing field
There are two methods to change properties: one to change a flag, another one to change an actual property.
Form field flags can be:
There are also annotation flags, for instance to change the visibility: only visible on screen, only visible when printed, always visible, never visible.
The actual properties are:
This info is taken from chapter 8 of my book.
Upvotes: 1