GroupDocs.Signature provides overloaded deleteByTypes method that accepts list of the SignatureType enumeration values.
This method writes the changed document to the file path or stream that you pass to it. To change the source document itself, pass the same path that you passed to the Signature constructor.
Here are the steps to delete signature by certain types from the document with GroupDocs.Signature:
Create new instance of Signature class and pass source document path or its stream as a constructor parameter;
This example shows how to delete various signatures types from the document at once.
Signaturesignature=newSignature(outputFilePath);{// compose the list of signature types to delete
List<Integer>signedTypes=newArrayList<Integer>();signedTypes.add(SignatureType.Text);signedTypes.add(SignatureType.Image);signedTypes.add(SignatureType.Barcode);signedTypes.add(SignatureType.QrCode);signedTypes.add(SignatureType.Digital);// deleting signatures from the document by signature types
DeleteResultresult=signature.deleteByTypes(outputFilePath,signedTypes);if(result.getSucceeded().size()>0){System.out.print("Following signatures were removed:");intnumber=1;for(BaseSignaturetemp:result.getSucceeded()){System.out.print("Signature #"+number+++": Type: "+temp.getSignatureType()+" Id:"+temp.getSignatureId()+". Created: "+temp.getCreatedOn());}}else{System.out.print("No one signature was deleted.");}}
Advanced Usage Topics
To learn more about document eSign features, please refer to the Advanced usage section.
More resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples: