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

Free Support Forum - aspose.com

Exception when converting mht into pdf

Hi,
I have trouble converting some emails into pdf see attached sample file. Have tried this with v17.1.0 and v17.2.0

Code snippet reproducing the issue:
MhtLoadOptions options = new MhtLoadOptions();
File file = new File("301116031114286.mhtml");
try {
Document pdf = new Document(file.getAbsolutePath(), options);
FilenameUtils.getBaseName(file.getName());
File dst = new File(file.getParent(), FilenameUtils.getBaseName(file.getName()) + ".pdf");
pdf.save(dst.getAbsolutePath());
} catch (Exception e) {
e.printStackTrace();
}


This throws following exception:
class com.aspose.pdf.internal.ms.System.z10: Value cannot be null.
Parameter name: s
com.aspose.pdf.internal.p677.z18.m3(Unknown Source)
com.aspose.pdf.internal.p19.z3.(Unknown Source)
com.aspose.pdf.internal.p19.z1.(Unknown Source)
com.aspose.pdf.internal.p19.z2.(Unknown Source)
com.aspose.pdf.internal.p19.z5.m1(Unknown Source)
com.aspose.pdf.z136.m1(Unknown Source)
com.aspose.pdf.ADocument.m1(Unknown Source)
com.aspose.pdf.ADocument.(Unknown Source)
com.aspose.pdf.Document.(Unknown Source)
com.chitasys.EmlConvert.main(EmlConvert.java:56)
at com.aspose.pdf.internal.p677.z18.m3(Unknown Source)
at com.aspose.pdf.internal.p19.z3.(Unknown Source)
at com.aspose.pdf.internal.p19.z1.(Unknown Source)
at com.aspose.pdf.internal.p19.z2.(Unknown Source)
at com.aspose.pdf.internal.p19.z5.m1(Unknown Source)
at com.aspose.pdf.z136.m1(Unknown Source)
at com.aspose.pdf.ADocument.m1(Unknown Source)
at com.aspose.pdf.ADocument.(Unknown Source)
at com.aspose.pdf.Document.(Unknown Source)
at com.chitasys.EmlConvert.main(EmlConvert.java:56)

Thanks.

Hi There,


Thanks for contacting support.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial; -webkit-text-stroke: #000000} span.s1 {font-kerning: none}

I have tested the scenario and have managed to reproduce the problem that conversion from MHT to PDF for your provided mhtml files thorws an exception. For the sake of correction, I have logged it as PDFJAVA-36623 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time.


We are sorry for this inconvenience.


Best Regards,