We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Filling form without invalidating signature

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().

I believe that may be by design, but…

1) I’m wondering if there is a way I can open and save a PDF without invalidating a digital signature.
2) Once step 1 is possible, is there a way I can fill out the form and save without invalidating a digital signature.

This is entirely possible when you fill out and save a form in Adobe Acrobat/Reader, so I’m wondering why I can’t seem to get this to happen through Aspose.

I found this post (Filling fields on multiple signature form invalidates previous signature) but seems to be slightly different than my request.


Hi Troy,

Thanks for your inquriy. We will appreciate if you please share your sample PDF document here, we will look into it and will provide you information accordingly.

We are sorry for the inconvenience caused.

Best Regards,

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”:

License license = new License();

Document document = new Document("…/master.pdf");

This PDF also include a text field, and it’s my intention in the end to fill out this text field and save without invalidating the signature (which is possible in Reader/Acrobat).


Hi Troy,

Thanks for using our API’s.

I have tested the scenario and have managed to reproduce same problem. For the sake of correction, I have logged it as PDFJAVA-35874 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

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



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 :slight_smile:


@balazs-gabonyi, @thawley

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


Document doc = new Document(myDir + "master_copy.pdf");
FileOutputStream output = new FileOutputStream(myDir + "master_reSaved_Java.pdf");
} finally

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");

Please download latest version of the API and in case you still face any issue, please feel free to let us know.