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);

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. (37.8 KB)


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.


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