set PDF field read only using XFA

653 views Asked by At

How can I set field "read only" in PDF using XFA and iTextSharp? I know that I have to modify the XML, but I don't know which attribute/value to set.

var attr = xfa.DomDocument.CreateAttribute("fflags");
attr.Value = "1";
xfa.DomDocument.GetElementsByTagName("my_field")[0].Attributes.Append(attr);
1

There are 1 answers

0
harun On

I haven't used iTextSharp but the attribute in XFA that you are looking for is the access attribute on the field. And the value is "readOnly".

<field access="readOnly">

will make the field read only.