Answer:
Depending on a given use case scenario, removing a signature
field would involve the following:
1.) Assuming there is only one valid signature in a document. In
order to remove this digital signature, you will need to
determine whether the digital signature was applied on the first
time the PDF was created, or the digital signature was added
after the PDF was created. If the former case (digital signature
was added during PDF creation) is correct, then you will need to
find the signature field and delete the value (which is the
signature dictionary). You may also need to delete the AP field
if you wish to remove the signature appearance.
If it is the latter case (where the signature is added after the
PDF was created), usually these documents are saved in
incremental mode. To remove an existing signature, you simply go
back to the previous version of the document. Adding a new
signature on an exisitng document requires preserving the
current version which is why signed PDF documents are saved in
incremental mode. One way to go back to a previous version of
the PDF is to find the document's 2nd to last "%%EOF\r\n"
(assuming the most recent incremental saving involved adding
signatures only) and delete anything after this string. This
will give you the version of the document before it was signed.
2.) If there are more than one signatures in the document, you
will only be able to remove the most recent signature so that
other signatures do not get invalidated. As mentioned above,
signed PDF's are usually saved in incremental mode -especially
if counter signatures are involved. To remove the most recent
signature, you will have to revert back to the version before
this most recent signature is applied (see previous use case
scenario). If you want to remove an older signature, you will
need to remove all counter signatures that were added after.