Digital Signature is Invalid after Compressing PDF in C#

When I compress a PDF, it works well using these OptimizationOptions:

optimizationOptions.LinkDuplcateStreams = false; 
optimizationOptions.RemoveUnusedObjects = false; 
optimizationOptions.AllowReusePageContent = true; 
optimizationOptions.RemoveUnusedStreams = true; 
optimizationOptions.UnembedFonts = false; 
optimizationOptions.ImageCompressionOptions:ImageQuality = 95; 
optimizationOptions.ImageCompressionOptions:CompressImages = true; 

The PDF seems fine (open well, no problem).

But then, when we try to sign it using our global digital signature server, we get a Pdf with an invalid signature.

2022-02-03_11-30-30.jpg (9.3 KB)

Note that if we do not apply optimizationOptions, the Pdf gets signed properly and is considered valid.


Would you kindly share the sample PDF document with us along with some more details of process that you are using to sign the PDF? Please also make sure to test the scenario using 22.1 version of the API before sharing the requested information. We will further proceed to assist you accordingly.


We are trying to sign with Acrobat Signature using a certificate. I have included 4 dummy PDF below. For these signature, we did it manually with Acrobat Signature.

I confirm the Aspose DLL is the latest (22_1).

  1. this is the original PDF
  2. this is the Optimized PDF with Aspose
  3. this is the original PDF (1) that I signed using Acrobat Signature
  4. this is the Optimized PDF with Aspose (2) that I signed using Acrobat Signature

If you look at 3, the signature is fine. If you look at 4, the signature is invalid.



4. AsposeTest_compressed_signed.pdf (1.3 MB)
3. AsposeTest_NotCompressed_Signed.pdf (1.3 MB)
2. AsposeTest_compressed.pdf (1.3 MB)
1. AsposeTest_NotCompressed.pdf (1.3 MB)


It looks like the optimizing process is changing some thing in the PDF structure causing this issue. We have logged an issue as PDFNET-51295 in our issue management system for further investigation. We will look into its details and let you know as soon as it is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.

1 Like

Hi Asad,

Concerning this:

We bought the Aspose.PDF license especially for this scenario. Can you provide me some estimate on when we can expect a solution? Q1, Q2, next year…

I need to know if I have to look for another solution (hoping I don’t!).




We definitely understand your concerns and will surely investigate and fix the issue. However, please note that the issues in free support model are resolved on first come first serve basis. The ticket has recently been logged and has not been reviewed yet. It will be analyzed after clearing the issues logged prior to it and as soon as it is completely investigated, we will be in a position to share some ETA or resolution timeline. We will surely let you know as soon as we have some updates in this regard.

We apologize for the inconvenience.

Do you have any update on this item opened in Feb? Please let us know if you need any help from our side. We will be happy to help as much as we can.


The ticket is currently under the investigation phase and we are afraid that it is not yet fixed. However, we will surely let you know in case we need some information from you side. As soon as the ticket is resolved, we will be updating you via this forum thread. We highly appreciate your patience and comprehension in this matter.

We apologize for the inconvenience.

Thanks for update, just to remark how critical is this topic to our company. Please keep us posted with any change, if we have not found the solution, we will need to check other solutions to fit our needs. Thanks for understanding.


We have recorded your concerns and will surely consider them during ticket investigation and resolution process. We will notify you via this forum thread once an update is available regarding ticket fix.

We apologize for the inconvenience.