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

Free Support Forum - aspose.com

Aspose.PDF throw an exception when accepting the text absorber for all the pdf pages

Hi team,

I have an issue with Aspose PDF (version 21.9) .NET Core version under Windows when accepting the absorber for all the pdf pages, it throws exceptions:

An item with the same key has already been added. Key: […]

My sample code:

       try
       {
           using(var pdfDocument = new Aspose.Pdf.Document(inputFile))
           {
               var textAbsorber = new Aspose.Pdf.Text.TextAbsorber();
               foreach(Page pdfPage in pdfDocument.Pages)
               {
                   pdfPage.Accept(textAbsorber); // throw exception
               }
               string text = textAbsorber.Text;
           }
       }
       catch(Exception e)
       {
       }

Here are the sample files sample.zip (7.5 MB)

Please help investigate and fix the issue.
Thanks.

@dunghnguyen

I can not reproduce it in .NET Core 2.0 so I request you to share a sample application so that we may try to reproduce the same on our end.

@mudassir.fayyaz
Sorry for the lack of information, I use .NET Core 5.0. Please try to reproduce again. Thanks.

@dunghnguyen

We are checking it and will get back to you shortly.

1 Like

@dunghnguyen

We are unable to reproduce the issue as we tested on Windows 10 EN x64. I request you to share a sample application for our investigations.

@mudassir.fayyaz
I send you the sample application. Note: please set license for Aspose PDF. SampleApplication.zip (1.8 KB)

@dunghnguyen

A ticket with ID PDFNET-50791 has been created in our issue tracking system to further investigate the issue on our end. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

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