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

Free Support Forum - aspose.com

[PDF2PDFA] DEFECT QC2981 - Exception on pdfFile

Hello,

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 :

try
{
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;
inputfile.OptimizeResources(opt);

inputfile.Save(@"D:\POC\OutputFile_Police_PDF2PDFA.pdf");
}
catch(Exception ex)
{


}


regards
Maxime

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.