I am attempting to use Aspose.Pdf to fill out a form in a PDF that contains a valid digital signature. Regardless of what I do, the signature always becomes invalidated whenever I save().
Hi Troy,
Attached is a PDF that I’ve been using as a basic example. Even with the following code, the PDF signature becomes invalid with a message like “Contains illegal data”:
Hi Troy,
Hello Troy,
I am having the same issue, testing a temporary license of aspose pdf Java at the moment.
Do you know of an existing workaround / solution to the invalidated siganture in case a form field is filled? Basically the same issue, which you mentioned as: PDFJAVA-35874
Regards,
Balazs
Thanks for your inquiry.
I would like to share with you that investigation against this issue has been started and we also have intimated respective team about your concerns. As soon as we receive some feedback from their side, we will let you know. Please spare us little time.
We are sorry for the inconvenience.
Thank you for the quick response 
Regards,
Balazs
Thanks for your patience.
Please note that signature keeps in account all the existing bytes in the document. And simply saving adds metadata for document modification date - this is enough to break the signature.To avoid this we suggest to use incremental update, that does not change the existing document but adds all the additional modifications in the additional space for the document. So the signature will be kept without changes.
Use one of the following code snippets:
Document doc = new Document(myDir+"master_copy.pdf");
//save into the same file
doc.save();
OR
Document doc = new Document(myDir + "master_copy.pdf");
FileOutputStream output = new FileOutputStream(myDir + "master_reSaved_Java.pdf");
try
{
doc.saveIncrementally(output);
} finally
{
output.close();
}
And in the Aspose.PDF for Java 18.7, we added the saveIncrementally method for String paramenter:
Document doc = new Document(myDir + "master_copy.pdf");
doc.saveIncrementally(myDir+"master_reSaved_Java.pdf");
Please download latest version of the API and in case you still face any issue, please feel free to let us know.