We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Conversion of MHTML to PDF causes stack overflow error

I have an MHTML file that is causing an error when I try to convert it to PDF. The error is:

“An unhandled exception of type ‘System.StackOverflowException’ occurred in Aspose.PDF.dll”

A snippet of the code I am using is:

            Aspose.Pdf.MhtLoadOptions options = new Aspose.Pdf.MhtLoadOptions();
            Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(filePathSource, options);
            pdfDocument.Save(filepathTarget);

The attached zip file contains a copy of the MHTML that triggers the error. It also includes a copy of the EML file from which the MHTML was derived.

Sample_MHTML_unable_to_convert_to_PDF.zip (37.8 KB)

@jburnett

We have tested the scenario using the latest version of Aspose.PDF for .NET 22.2 and have not found the shared issue. So, please use Aspose.PDF for .NET 22.2. We have attached the output PDF with this post for your kind reference.
22.2.pdf (8.4 MB)

Hi Tahir,
I will update the Aspose.PDF DLL to the latest version.
Thank you for your assistance.

@jburnett

Please feel free to ask if you have any question about Aspose.PDF, we will be happy to help you.