How to remove digital signatures?

38 views
Skip to first unread message

Ryan

unread,
May 16, 2019, 12:43:49 PM5/16/19
to pdfne...@googlegroups.com
Question:

We have PDF files that cannot be edited because they have been digitally signed. It is more important to us to be able to edit the PDF, then it is to preserve the digital signature.

How can I remove the signatures so it can be edited?

Answer:

There are three things you need to do.

1. First you need to find all the digital signature fields, and delete any signatures.

FieldIterator itr;
for(itr=doc.GetFieldIterator(); itr.HasNext(); itr.Next())
{
 
Field field = itr.Current();
 
 
if(field.GetType() == Field.Type.e_signature)
 
{
 field
.GetSDFObj().Erase("V");  // remove crypto component
 field.GetSDFObj().Erase("AP"); // remove visual component
 }
}

2. Delete the signature flags entry.
doc.GetAcroForm().Erase("SigFlags");

3. Delete any permissions entry
doc.GetRoot().Erase("Perms");

Finally, save the file so all the now unused entries are erased completely.
doc.Save(outPath, SDFDoc.SaveOptions.e_linearized);



Reply all
Reply to author
Forward
0 new messages