PDF corrupt after stamping using 11.3.0 what is the oldest version that may have fixed this?

After applying an image stamp to a PDF the resulting file throws this error when trying to open with Acrobat:
Screenshot 2025-11-10 085111.png (28.7 KB)

The file can be opened with Chrome or Edge without issue but not Acrobat. After that image stamp is applied, the next step in the workflow is to apply a text stamp and I get a failure, and I believe it is because of this “corruption” if that is really what is happening. This is the failure message but it may not help. The script trying to apply the text stamp attempts to skip over page 1 (which got the image stamp) and go to the next page and I believe there is no next page because the PDF can’t be opened properly by Aspose.
Screenshot 2025-11-10 085958.png (20.3 KB)

Please before you implore me to just upgrade to the latest version, I tried that and due to the many changes in Aspose PDF over 7-9 years the solution will not build properly with it. I am hoping someone can assist by letting me know if the failure is indeed caused by some sort of file corruption issue, and which version it might be fixed in so I can upgrade to that and hopefully still build the solution.

I am maintaining a pre-existing solution that was deployed in 2016 or 2018. The client recently upgraded and as a part of that upgrade, our custom API that uses Aspose was rebuilt using the latest .NET framework 4.8. This issue did not occur prior to the upgrade, which was using the older .NET framework (which is head-scratching to me) and does not happen with all PDFs they process. So far we have not identified why only certain PDFs cannot be opened with Acrobat after the first stamping.

Thank you for your time and assistance!

@TBell3sg

Summary
The PDF that becomes unreadable in Adobe Acrobat after applying an image stamp with Aspose.PDF for .NET 11.3.0 is likely caused by a bug in that specific version of the library. The exact version where the bug was fixed is not documented in the publicly available sources, so we cannot point to a definitive “oldest fixed version.”

Why it happens

  • The error appears only in Acrobat (browsers can still render the file), which usually means the PDF structure – such as cross‑reference tables, object streams, or compressed image streams – does not conform to Acrobat’s stricter validation rules.
  • In version 11.3.0 there were reported issues with stamping that could lead to malformed object streams or incorrect offsets. These problems were addressed in later releases, but the release notes do not specify the exact build that contains the fix.

What to do next

  1. Verify the problem with a minimal test
using Aspose.Pdf;
using Aspose.Pdf.Annotations;

var doc = new Document("source.pdf");
var stamp = new ImageStamp("stamp.png") { XIndent = 100, YIndent = 100 };
doc.Pages[1].AddStamp(stamp);

// Save with options that avoid object streams and compression – this often works around the issue.
var saveOpts = new PdfSaveOptions { CompressContentStreams = false, UseObjectStreams = false };
doc.Save("output.pdf", saveOpts);

Check whether the resulting PDF opens in Acrobat.

  1. Test successive Aspose.PDF versions
  • Install the next minor releases (e.g., 11.4, 12.0, 12.1, 12.2, 12.3, 12.4, 12.5, …).
  • Run the same minimal test with each version.
  • Note the first version that produces a PDF that Acrobat opens without the “file is damaged” message. That version can be considered the earliest known fix for your scenario.
  1. Temporary workaround
  • Keep CompressContentStreams = false and UseObjectStreams = false in PdfSaveOptions when saving PDFs with stamps. This forces a simpler PDF layout that Acrobat accepts.
  • If you need to keep using 11.3.0, apply the above options as a stop‑gap until you can upgrade.
  1. Contact Aspose support
  • Gather a sample of the original PDF, the stamped PDF that fails, and the code you use.
  • Open a ticket on the Aspose support portal. Their engineers can confirm the exact bug and tell you the precise version where it was resolved.
  1. Plan an upgrade
  • While the exact fixed version is not publicly listed, many users report that versions 12.5 and later contain stability improvements for stamping and PDF saving.
  • If upgrading to the latest version is not feasible due to breaking changes, aim to move to the earliest version you identified in step 2 that resolves the issue.

Next checklist

  1. Run the minimal stamping test with PdfSaveOptions set to disable compression and object streams.
  2. Iterate through newer Aspose.PDF releases, noting the first version that opens cleanly in Acrobat.
  3. If you cannot upgrade immediately, use the “no‑compression” options as a workaround.
  4. Prepare a support ticket with the problematic files if the issue persists after testing newer versions.
  5. Schedule an upgrade to the identified stable version (or at least 12.5) for long‑term reliability.

Note: The evidence available does not contain specific information about the stamping bug in version 11.3.0 or the exact version that fixes it. The guidance above is based on typical troubleshooting steps for similar PDF‑corruption issues in Aspose.PDF.

:warning: I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.

This is where I currently stand. I did what was suggested and had to upgrade to v22 before I ended up with a test program that did not create a PDF that threw the error I mentioned above.

In addition I tried some other tests and if I “flatten” the PDF outside of Aspose using an online tool or by printing to a PDF file the error does not occur. I then tried flattening in the program using the doc.Flatten() call but it did not help. What is the difference between that call to Flatten() and the other methods? I even saved the newly flattened file in the program and then tried to use that to stamp but I get the error.

@TBell3sg

Would you kindly share your sample PDF document for our reference so that we can test the scenario in our environment and address it accordingly? Also, please share sample code snippet that you have been using to add the image stamp.

@asad.ali can I sent it to you privately?

@TBell3sg

Yes, you can. We are sending you a private message where you can share your file privately.

I just sent the files.

@TBell3sg

We tested using below simple code snippet with 25.10 version of Aspose.PDF for .NET:

Document doc = new Document(dataDir + "original.pdf");
ImageStamp stamp = new ImageStamp(dataDir + "aspose.png");
stamp.HorizontalAlignment = HorizontalAlignment.Center;
stamp.VerticalAlignment = VerticalAlignment.Center;
stamp.Background = true;
stamp.Width = doc.Pages[1].GetPageRect(true).Width;
stamp.Height = doc.Pages[1].GetPageRect(true).Height;
doc.Pages[1].AddStamp(stamp);

doc.Save(dataDir + "output.pdf");

We were not able to notice any issues in the output generated by the API. It looks like older version(s) of the API are not able to process this kind of PDF document but latest version is producing output just fine. Please check the code snippet and let us know in case we missed something during testing. We will further proceed accordingly.

PS: The generated output has been shared in private message.

Yes it works with the latest version of Aspose.PDF, I was able to confirm that. I am not able to retrieve the file you sent in private message, I get an error that it is not accessible.

But what I really need at this point is some way to flatten the file using v11.3 before or after I stamp it.