Quality of document compromising while converting html file to png

I am converting Html file to png using groupdocs convert and below is my code for the same

var tempFile = Path.Combine(tempFilesPath, $"p{i}");
using (var converter = new Converter($"{tempFile}.html"))
{
    try
    {
        var options = new ImageConvertOptions { Format = GroupDocs.Conversion.FileTypes.ImageFileType.Png };
        converter.Convert($"{tempFile}.png", options);
        File.Delete($"{tempFile}.html");
    }
    catch (Exception)
    {
        throw;
    }
}

but the problem is quality of the document is getting compromised while converting the document.

sharing the files for the reference

please suggest a way to convert without affecting the quality of the document.

Version is 20.8

Please note text the is highlighted here and when converting to png the same file looks like This

I tried with Aspose.words too but it was more bad

var tempFile = Path.Combine(tempFilesPath, $"p{i}");
//using (var converter = new Converter($"{tempFile}.html"))
//{
//    try
//    {
//        var options = new ImageConvertOptions { Format = GroupDocs.Conversion.FileTypes.ImageFileType.Png };
//        converter.Convert($"{tempFile}.png", options);
//        File.Delete($"{tempFile}.html");
//    }
//    catch (Exception)
//    {
//        throw;
//    }
//}
Document doc = new Document($"{tempFile}.html");

// Set the options for saving the document as an image
Aspose.Words.Saving.ImageSaveOptions options = new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Png)
{
    //PageIndex = 0, // Save the first page only (0-based index)
    //PageCount = 1, // Number of pages to save
    Resolution = 300, // Set the resolution to 300 DPI
    //ImageBrightness = 0.5f, // Adjust the image brightness if needed
    //ImageContrast = 0.5f // Adjust the image contrast if needed
};

// Save the document as a PNG image
doc.Save($"{tempFile}.png", options);
File.Delete($"{tempFile}.html");

p1.png (119.5 KB)

1 Like

@Niteen_Jadhav

This issue is reproduced at our end. Therefore, 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): CONVERSIONNET-7040

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.

Hello, Do we have any updates?

@Niteen_Jadhav

This ticket is still under investigation.

Do We Have Any Updates?

@Niteen_Jadhav

This ticket is still under investigation.

Do we have any updates?

@Niteen_Jadhav

Please note that we are actively working on this issue and trying to fix it in API version 24.9. As there’s any further information, we’ll notify you.

The issues you have found earlier (filed as CONVERSIONNET-7040) have been fixed in this update. This message was posted using Bugs notification tool by nikola.yankov

Thank you for the update.

1 Like