/// <summary>Sets signature lock for specific fields in the document.</summary> /// <param name="action"> /// Indicates the set of fields that should be locked after the actual /// signing of the corresponding signature takes place. /// </param> /// <param name="fields">Names indicating the fields.</param> /// <returns> /// This /// <see cref="PdfSigFieldLock"/> /// object. /// </returns> public virtual iText.Forms.PdfSigFieldLock SetFieldLock(PdfSigFieldLock.LockAction action, params String[] fields) { PdfArray fieldsArray = new PdfArray(); foreach (String field in fields) { fieldsArray.Add(new PdfString(field)); } GetPdfObject().Put(PdfName.Action, GetLockActionValue(action)); GetPdfObject().Put(PdfName.Fields, fieldsArray); return(this); }
public static PdfName GetLockActionValue(PdfSigFieldLock.LockAction action) { switch (action) { case PdfSigFieldLock.LockAction.ALL: { return(PdfName.All); } case PdfSigFieldLock.LockAction.INCLUDE: { return(PdfName.Include); } case PdfSigFieldLock.LockAction.EXCLUDE: { return(PdfName.Exclude); } default: { return(PdfName.All); } } }