Possible to convert MHTML to PDF with Aspose.Total

Hi Aspose Team !

We’re having trouble converting a specific mhtml to PDF. Please unpack .zip to see mhtml source:
22_03261-14 22_00800.zip (64.7 KB)

Is it possible to use Aspose.Total to convert this to a PDF ?
Thanks in advance

@andersalvsaker You can use Aspose.Words to convert MHTML documents to PDF. Here is a simple code:

Document doc = new Document(@"C:\Temp\in.mhtml");
doc.Save(@"C:\temp\out.pdf");

However, the attached MHTML document seems to be damaged. When open it in MS Word, it shows an error and the document contains only one word.

1 Like

Thank you got it. We have tried Aspose.Words for this document so It makes sense that its corrupt. All though Microsoft Edge displays it properly.

@andersalvsaker Aspose.Words mimics MS Word behavior when work with documents. You can also try using Aspose.HTML to convert MHTML documents to PDF:
https://docs.aspose.com/html/net/getting-started/supported-file-formats/

Thank you for the feedback.

We have tried Aspose.HTML with the same false result.

Our customer expects us to handle the files since edge is handling them correctly.
Is it possible for the Aspose Team to look into if we can “handle” the falses in the MHTML files to be able to convert these files correctly?

@andersalvsaker

Would you please share the complete code snippet that you used to convert the MHTML to PDF using Aspose.HTML along with the generated PDF at your end? We will further proceed to assist you accordingly.

Here is two other MHTML files used in this test:
Testfiles.zip (132.1 KB)

This is the essence of our code:

Here is a code for Testfile1.pdf:

Aspose.Html.Converters.Converter.ConvertMHTML(filename, new Aspose.Html.Saving.PdfSaveOptions(), dstFilename);
Result:Testfile1.pdf (22.5 KB)

Code for the Testfile2.pdf:

var document = new HTMLDocument(filename);
Aspose.Html.Converters.Converter.ConvertHTML(document, new Aspose.Html.Saving.PdfSaveOptions(), dstFilename);
Result:Testfile2.pdf (38.7 KB)

I hope this can be helpful in researching a possible fix or workaround

@andersalvsaker

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): HTMLNET-4644

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

Thanks.
Regrading this issue and free support. Aspose team will try to provide a fix for it a future release, right ?

@andersalvsaker,

Yes, your understanding is correct. We will publish a release (that includes the fix for your issue). You will be notified in this thread once the supported version is published.

Hello again.

Is it possible to get a status update on this case?
Thanks!

@andersalvsaker,

The ticket (logged earlier as “HTMLNET-4644”) has not yet been resolved. One of our colleagues from the Aspose.HTML team will give you the latest updates on it soon.

@andersalvsaker

The investigation against the ticket is sadly not completed yet. We will prioritize it on first come first serve basis and as soon as some updates are available regarding its resolution, we will share with you. Please spare us some time.

We are sorry for the inconvenience.

@andersalvsaker

We have resolved the issue. Please pay attention that the 2nd case you provided isn’t a bug, just wrong API usage. When a user tried to convert MHTML such way:

var document = new HTMLDocument(filename);
Aspose.Html.Converters.Converter.ConvertHTML(document, new Aspose.Html.Saving.PdfSaveOptions(), dstFilename);

naturally, it wouldn’t work because this method isn’t intended for MHTML.

To convert MHTML. please use Converter.ConvertMHTML call (as it is done in 1st code snippet).

1 Like

Hi, Is this fix released in the latest version of Aspose?

@andersalvsaker

Aspose.HTML for .NET 24.8 is not yet released. We will inform you once it is available for use.

1 Like

The issues you have found earlier (filed as HTMLNET-4644) have been fixed in this update. This message was posted using Bugs notification tool by avpavlysh