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

Free Support Forum - aspose.com

Convert MHTML to PDF in C# - Fails with System.ArgumentException nondescript error

I was able to convert email messages from a .msg (or straight out of other forms) to an mht stream (or even file) then was able to convert from mht stream (or file) into a PDF using below code. Now that the business has provided a new html formatting template for emails it fails when creating a Document object from the mht file. It fails with the following error. What is causing this error and are there other ways to convert to a PDF without loosing any formatting? I am using c# with Aspose.PDF v19.9.0.0

Email Conversion Error: System.ArgumentException: max (150000) < opt (414999)
at #=zz1OBRIAyepAEydrAfUhXpoogxauMiIFwPJK6nG8=.#=zt3YkpBg=(Int32 #=zXEzFeYE=, Int32…

code is as below formed generically.

Snippet

var mHtmlLoadOptions = new MhtLoadOptions();
Document doc = new Document(@“C:\EmailConversion\TestEmail.mhtml”, mHtmlLoadOptions);
Snippet

TestEmail.zip (8.1 KB)

@Dominic.Melia

Thanks for contacting support.

We have been able to reproduce the issue in our environment while testing the scenario with Aspose.PDF for .NET 20.1. We have logged it as PDFNET-47521 in our issue tracking system. We will further look into details of it and keep you posted with the status of its rectification. Please be patient and spare us little time.

We are sorry for the inconvenience.