Hello, I have created a signature field at run time (without saving the PDF document) and I want to delete this field always at runtime with its appearance. I can take the correct widget and can also eliminate appearance and eliminate the widget. Then I save the document and later reopened after an audit to check if the there exist signature fields in the documents gives me successful. I can not figure out how to remove the field in question. I attach the code (VB) I have used. Thank you for the help.
Thank you very much for your response.
For me it is important because I’m developing an application graphometric signature and a feature that the user will have is to create at runtime a signature field on the document, but then could think again and then cancel it. I had thought of developing it in the way I described in my previous post and then I realized that the field was not deleted from the document. Is there a way to delete it after you create at runtime so that it is not junk in your document?
Thank you very much.
Il giorno lunedì 5 dicembre 2016 21:46:50 UTC+1, Carlo Nesta ha scritto:
Hello, I have created a signature field at run time (without saving the PDF document) and I want to delete this field always at runtime with its appearance. I can take the correct widget and can also eliminate appearance and eliminate the widget. Then I save the document and later reopened after an audit to check if the there exist signature fields in the documents gives me successful. I can not figure out how to remove the field in question. I attach the code (VB) I have used. Thank you for the help.
In that case, the easiest way would be the following.
int sig_field_object_num = sig.GetSDFObj().GetObjNum()
and store that value
Then when you want to erase the field, add the following code.
Dim acroforms As Obj = pdfdoc.GetAcroForm() If acroforms IsNot Nothing And acroforms.IsDict() Then Dim fields As Obj = acroforms.FindObj("Forms") If fields IsNot Nothing And fields.IsArray() Then For index As Integer = 1 To fields.Size() Dim o As Obj = fields.GetAt(index) If o.GetObjNum() = sig_field_object_num Then fields.EraseAt(index) break