Reputation: 1958
I've manually created a PDF fillable form file and filled it out using an existing xfdf file.
When I try to do this programatically (creating the PDF fillable form on the fly to be filled out by existing xfdf), I notice that the properties of the field are "Visible but doesnt print".
When I compare this to the manually created PDF fillable form file, it has "Visible".
How can I programmatically set the generated field's property to "Visible"?
Is there something more I should add?
PdfFormField field = PdfFormField.CreateTextField(stamper.Writer, false, false, 0);
field.SetWidget(new iTextSharp.text.Rectangle(40, 500, 360, 530), PdfAnnotation.HIGHLIGHT_INVERT);
field.SetFieldFlags(PdfAnnotation.FLAGS_PRINT);
field.FieldName = "gender";
stamper.AddAnnotation(field, 1);
Upvotes: 0
Views: 938
Reputation: 1958
There is a difference between
field.Flags = PdfAnnotation.FLAGS_PRINT; //use this for "Visible"
and
field.SetFieldFlags(PdfAnnotation.FLAGS_PRINT); // produces "Visible but doesnt print"
Upvotes: 1