Aspose-html - Error: An element with the same key already exists in the dictionary-> mhtml to jpg conversion

i have Aspose.Total.Java.lic license.

i’m trying to convert mhtml files to jpg using aspose-html

when i execute below code for mht files < 200kb, the output generates fine.

if i input file >200kb then i receive below error. i’m not able to figure out how can i fix this. Please help

<dependency>
            <groupId>com.aspose</groupId>
            <artifactId>aspose-html</artifactId>
            <version>24.11</version>
        </dependency>
String outputFile=fileName+"_Output.jpg";
        String fulloutputFilePath=outputDirpath+"/"+outputFile;
        FileInputStream inputstream = new FileInputStream(fullfilePath);


        ImageSaveOptions options = new ImageSaveOptions(ImageFormat.Jpeg);
        options.setVerticalResolution(Resolution.to_Resolution(2000));
        options.setHorizontalResolution(Resolution.to_Resolution(2000));
com.aspose.html.converters.Converter.convertMHTML(inputstream, options, fulloutputFilePath);

Exception in thread "main" class com.aspose.html.utils.ms.System.ArgumentException: An element with the same key already exists in the dictionary.
com.aspose.html.utils.ms.System.Collections.Generic.Dictionary.addItem(Unknown Source)
com.aspose.html.utils.Sd.<init>(Unknown Source)
com.aspose.html.utils.Sb.<init>(Unknown Source)
com.aspose.html.utils.Sc.<init>(Unknown Source)
com.aspose.html.utils.Sd.<init>(Unknown Source)
com.aspose.html.utils.Sb.<init>(Unknown Source)
com.aspose.html.utils.Sc.<init>(Unknown Source)
com.aspose.html.rendering.MhtmlRenderer.a(Unknown Source)
com.aspose.html.rendering.MhtmlRenderer.render(Unknown Source)
com.aspose.html.rendering.MhtmlRenderer.render(Unknown Source)
com.aspose.html.utils.hK.a(Unknown Source)
com.aspose.html.utils.hK.b(Unknown Source)
com.aspose.html.utils.hK.b(Unknown Source)
com.aspose.html.converters.Converter.convertMHTML(Unknown Source)


@divine1

If possible, could you please share the HTML in .zip format with us by uploading it to Google Drive or Dropbox? We will test the scenario in our environment and address it accordingly.

1 Like

testdata-4mht-files.7z (328.6 KB)

@asad.ali i have added 4 mht files in the attached 7z file. Please review . Looking forward for the response

@divine1

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): HTMLJAVA-1896

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

1 Like

@asad.ali , Can you help us with the targeted release in which this issue will be fixed?
For Issue ID(s): HTMLJAVA-1896

@Ghani0303

The issue has just been logged in our issue management system and it will be prioritized on a first come first serve basis. As soon as we make some progress towards its resolution, we will inform you via this forum thread. Please be patient and spare us some time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as HTMLJAVA-1896) have been fixed in this update. This message was posted using Bugs notification tool by pavel.terechshenkov

@divine1 @asad.ali @aspose.notifier Even with the latest Aspose-html- Version 24.12.2 the image conversion is not happening correctly, Conversion of the files ran infinetely (did not seem to end even after 30 minutes).

@Ghani0303

Can you please share the sample file and the code snippet for our reference? We will test the scenario in our environment and address it accordingly.

These are the sample files which are already uploaded here.

@Ghani0303

Are you saying that you are facing the issue with the same files @divine1 uploaded here? If you are using different files and facing same exception, we request you please share them as we will investigate against specific problematic files.

The same sample files shared by @divine1
@asad.ali

@Ghani0303

We have re-opened the ticket for further analysis and will inform you as soon as we have some updates. We apologize for the inconvenience.

1 Like

Any update on this, also can you help us with the targeted release in which this issue will be fixed?

@Ghani0303

We are afraid that we do not have any update about the issue investigation yet. However, we will surely inform you once we have some news about it. Please spare us some time.

We are sorry for the inconvenience.

this ticket is not relevant for now, as we are looking into mht to pdf conversion.
the reported issue is reported on mht to jpg conversion, we are not interested in this conversion anymore.

This ticket can be closed.

@divine1

Sure, we will analyze and close the ticket accordingly.

1 Like