Remove field signature

75 views
Skip to first unread message

Carlo Nesta

unread,
Dec 5, 2016, 3:46:50 PM12/5/16
to PDFTron PDFNet SDK
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.
Allegato.txt

Ryan

unread,
Dec 7, 2016, 1:00:08 PM12/7/16
to PDFTron PDFNet SDK
The field and Widget are not necessarily the same object. In particular, a field can have multiple Widgets.

Your code is removing the annotation from the page, but the field remains in the document.

However, I am curious on what your overall user story is. Why is this important for you?

Carlo Nesta

unread,
Dec 9, 2016, 2:04:36 PM12/9/16
to PDFTron PDFNet SDK
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.

Ryan

unread,
Dec 9, 2016, 5:50:07 PM12/9/16
to PDFTron PDFNet SDK
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

Reply all
Reply to author
Forward
0 new messages