Free Support Forum - aspose.com

Mhtml to pdf failing

Using C# to convert MHTML file to pdf gives error : Value cannot be null.Parameter name: value.
Error is thrown in third line of code where it tries to instatiate the Document. Input fileData is byte array of mhtml file.

public byte[] Convert(byte[] fileData)
{
using (var ms = new MemoryStream(fileData))
{
var document = new Document(ms, new MhtLoadOptions());
using (MemoryStream outputStream = new MemoryStream())
{
document.Save(outputStream);
return outputStream.ToArray();
}
}

    }

@rima999

Thank you for contacting support.

Would you please share zipped MHTML file so that we may try to reproduce and investigate it on your side. Before sharing requested data, please ensure using Aspose.PDF for .NET 18.11 in your environment.

Hi Farhan,

Thank you for the response.
I upgraded aspose.pdf to 18.11 from 17.8 and I still see the issue.
Please find a sample mhtml file in the attachment where the error is reproducible.whateverTest.zip (246.8 KB)

@rima999

Thank you for sharing requested data.

We have been able to reproduce the issue in our environment. A ticket with ID PDFNET-45698 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.