Why previous signature is deleted

Hi, I use this code to sign my pdf

The pdf has been signed twice and I found signature that signed on the fisrt time was deleted.
Is that normal? or Are there any solution to prevent this.

Thank you


Incremental saving can often cause issues with multiple signatures. Check if you’re using the incremental saving mode and if so, changing it to REMOVE_UNUSED. See the following post for more info:

If this does not solve your problem, please send me the following information:

  1. Input file(s)
  2. Generated output file(s)
  3. Code and settings used to generate (2) from (1)
  4. Screenshots showing the output, and clearly indicating what you expected to get instead, and also clearly indicating the application/browser being used to view.

I have tried to use REMOVE_UNUSED mode for saving pdf as you suggested and the result is the first signature is gone. There is just one signature that i just signed.
My expectation is when i sign the pdf that already have valid signature, that signature should be still there and valid.
This input file : PDFTron_signed_1666075071125.pdf - Google Drive
This is my code for signing pdf

This is output file : (SDFDoc.SaveMode.INCREMENTAL) PDFTron_signed_1666076438640.pdf - Google Drive
This is my pdf viewer

Thank you.

This is output file : (SDFDoc.SaveMode.REMOVE_UNUSED) PDFTron_signed_1666249082222.pdf - Google Drive


Apologies, I made a mistake. The proper way to sign multiple times is using the incremental flag as opposed to the linearized or remove_unused flag.

The incremental flag does not edit the pdf and simply adds to the end, preserving previous signatures whereas the other flags will overwrite.

For more information you can visit the link I had posted earlier that correctly talks about this: