HTML/MHTML conversion is not correct (As per Aspose email)

Hi

I have raised an issue regarding image that gets chopped while viewing email file in Aspose.
https://forum.aspose.com/t/embedded-image-in-msg-file-is-chopped/279652
Please refer above link for conversation that happened with Aspose Email.

I was expecting resolution from Aspose Email as my end document is .MSG file. I have been asked to contact Aspose words by stating html - image conversion is not correct.

In the link mentioned you can find test file. Please suggest.

@ask4dhananjay The problem occurs because the image is too wide and does not fit the default page size. You can adjust page size to avoid image cropping. For example see the following code:

com.aspose.email.MailMessage msg = com.aspose.email.MailMessage.load("C:\\Temp\\in.msg");
msg.save("C:\\Temp\\tmp.mhtml", com.aspose.email.SaveOptions.getDefaultMhtml());

Document doc = new Document("C:\\Temp\\tmp.mhtml");

// Calculate maximum image width.
double maxShapeWidth = 0;
Iterable<Shape> shapes = doc.getChildNodes(NodeType.SHAPE, true);
for (Shape s : shapes)
{
    if (s.isTopLevel())
        maxShapeWidth = Math.max(maxShapeWidth, s.getWidth());
}

PageSetup ps = doc.getFirstSection().getPageSetup();
double pageWidth = ps.getPageWidth() - ps.getLeftMargin() - ps.getRightMargin();

if (pageWidth < maxShapeWidth)
    ps.setPageWidth(maxShapeWidth + ps.getLeftMargin() + ps.getRightMargin());

doc.save("C:\\Temp\\out.png");