I would like to lock PDF file after certain form field has been filled out using itext7 in java.
I know that I can lock PDF if I set PdfSigFieldLock on certain signature field after it has been signed.
But I am having hard time figuring out is it possible to do something like this for plain text form field? I am guessing it is not but wanted to make sure that I'm not missing anything
"Locking PDFs" as a whole is the process of lowering the current MDP (Modification Detection and Prevention) value of a PDF to 1 ("No changes are permitted except updates of the DSS and applications of document time stamps").
"Locking individual fields" is another MDP mechanism.
Both are activated by applying signatures with DocMDP or FieldMDP transforms to the PDF. See ISO 32000-2 section 12.7.5.5 "Signature fields" and section 12.8.2 "Transform methods".
MDP cannot be applied without a signature with a DocMDP or FieldMDP transform.
Thus, no, it is not possible to do something like this for plain text form fields.
Well, you can of course make use of iText to set all fields to read-only after some field e.g. is filled in. Or you can use it to flatten the form. Or you can add JavaScript to prevent certain operations. But all this is easy to override while undoing MDP locking will also invalidate the associated signature. Thus, these other options are not really like MDP locking.