[PDF2PDFA] DEFECT QC2981 - Exception on pdfFile


We have an exception when make a conversion PDF to PDFA 1B with file Polices_21.4.pdf.

Could you give me an advice for make transformation?

My code is :

Document inputfile = new Document(@"D:\POC\Polices_21.4.pdf");
bool result = inputfile.Convert(new MemoryStream(), PdfFormat.PDF_A_1B, Aspose.Pdf.ConvertErrorAction.Delete);

Aspose.Pdf.Document.OptimizationOptions opt = new Aspose.Pdf.Document.OptimizationOptions();
opt.RemoveUnusedObjects = true;
opt.RemoveUnusedStreams = true;
opt.LinkDuplcateStreams = true;

catch(Exception ex)



Hi Maxime,

Thank you for posting the input PDF and code. We have tested your scenario in our environment using the latest version 17.5 of Aspose.Pdf for .NET API and found an error on calling a Save method of the Document class. It shows an error as: “Cannot access a closed Stream.”. It has been logged under the ticket ID PDFNET-42788 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates. We are sorry for the inconvenience caused.

Furthermore, if the error details are different in your environment, then please share error details and the version of Aspose.Pdf for .NET API. We will further investigate and share our findings with you.

The issues you have found earlier (filed as PDFNET-42788) have been fixed in Aspose.PDF for .NET 23.9.