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.