Set all PDF Fields to ReadOnly

你离开我真会死。 提交于 2019-12-02 05:52:25

问题


In iTextSharp is there a way to set ALL fields on a form to read only? Currently I'm setting each one individually which is a pain like...

formFields.SetFieldProperty( "Applicant.Phone", "setfflags", PdfFormField.FF_READ_ONLY, null );
formFields.SetFieldProperty( "Applicant.SSN", "setfflags", PdfFormField.FF_READ_ONLY, null );

etc.


回答1:


Can't you do something like this:

foreach (DictionaryEntry de in pdfReader.AcroFields.Fields)
{
  formFields.SetFieldProperty(de.Key.ToString(), 
                             "setfflags", 
                              PdfFormField.FF_READ_ONLY, 
                              null);
}


来源:https://stackoverflow.com/questions/11171864/set-all-pdf-fields-to-readonly

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!