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

Free Support Forum - aspose.com

Convert PDF to PDF/A_2A using Aspose.PDF for.NET - Collection was modified; enumeration operation may not execute

Hello,

We’re getting the following error when converting a PDF document to PDF-2a:

Collection was modified; enumeration operation may not execute.

Below the code snippet. The conversion method does not return a log ( in this case C:\temp\conversion.log), so we don’t have a clue what is wrong.
The PDF opens correctly in Acrobat.

We use the latest version of Aspose.PDF (v19.12.0) NuGet package.
A sample PDF file is attached.

var inputFile = "sample.PDF";
var outputFile = "sample.out.PDF";

Document document;
using (var stream = File.Open(inputFile, FileMode.Open))
{
    document = new Document(stream);

var optimizeOptions = new Aspose.Pdf.Optimization.OptimizationOptions()
{
    RemoveUnusedObjects = true,
    RemoveUnusedStreams = true,
    AllowReusePageContent = true,
    LinkDuplcateStreams = true
};

optimizeOptions.ImageCompressionOptions.CompressImages = true;
optimizeOptions.ImageCompressionOptions.ResizeImages = true;
optimizeOptions.ImageCompressionOptions.Version = Aspose.Pdf.Optimization.ImageCompressionVersion.Standard;
optimizeOptions.ImageCompressionOptions.ImageQuality = 50;

document.OptimizeResources(optimizeOptions);

}

document.Convert(@"C:\\temp\\conversion.log", PdfFormat.PDF_A_2A, ConvertErrorAction.Delete);

document.Save(outputFile);

sample.PDF (691.9 KB)

@RaimonddeLange

Thank you for contacting support.

We have been able to reproduce the issue in our environment. A ticket with ID PDFNET-47443 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Any idea when this will be fixed? We facing a production issue we would like to resolve.

@RaimonddeLange

The issue was recently logged in our issue management system under free support model and is pending for analysis. Please note that issues are resolved on first come first serve basis under this model of support. We will surely inform you as soon as the issue is investigated and fixed.

In case this issue is a showstopper or blocker for you, we request you to check priority support model where issues have high priority and are resolved on urgent basis.

Any updates on this issue?

@RaimonddeLange

We are afraid that no updates are available at the moment regarding resolution of your issue. We will inform you as soon as we have some. Please spare us some time.

Still waiting.

@RaimonddeLange

Regretfully, the issue is still pending for resolution due to low priority. As shared earlier, we will surely inform you as soon as we make some significant progress towards its resolution. We highly appreciate your patience in this regard. Please spare us little time.

We are sorry for the inconvenience.

Since the issue is reproduceable, a fix shouldn’t be that hard. Another three weeks have passed without any updates.

@RaimonddeLange

We assure you that we will surely resolve the issue but, as shared earlier - it will be resolved on first come first serve basis. There are other high priority implementations and fixes which need to be done and will certainly work on resolution of your issue as per our schedule. We will inform you as soon as we have certain news in this regard. We greatly appreciate your patience and comprehension in this matter. Please spare us some time.

We are sorry for the inconvenience.

Hi, any progress on this issue?

@RaimonddeLange

Regretfully, the issue is not resolved. However, we have escalated the issue to next level of priority and will surely share updates with you as soon as we have some. Please spare us some time.

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