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

Free Support Forum - aspose.com

Convert msg to pdf error

        License asposeLic = new License();

        FileInputStream fstream = null;
        fstream = new FileInputStream(mFilePath);
        MailMessage eml = MailMessage.load(fstream);

        //Save the Message to output stream in MHTML format
        ByteArrayOutputStream emlStream = new ByteArrayOutputStream();
        eml.save(emlStream, SaveOptions.getDefaultMhtml());

        com.aspose.words.License asposeLicw = new com.aspose.words.License();

        //Load the stream in Word document
        LoadOptions lo = new LoadOptions();
        Document doc = new Document(new ByteArrayInputStream(emlStream.toByteArray()), lo);

        doc.save(mTargetPath, SaveFormat.PDF);

on the second use ’ asposeLicw.setLicense(LICENSE);’ throw error

1 Like


Did you mean the error arises when you set the license for Aspose.Words API? Also, could you please confirm to us if you are using Aspose.Total license at your end, as setting a single API license for any other API will raise error. Also, please share your environment details and detailed exception report with us for further consideration at our end.

license define:

public final InputStream LICENSE = this.getClass().getResourceAsStream("/Aspose.Total.Java.lic");

on the second setLicense(LICENSE) throw error:

objc[1567]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java (0x10f84c4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10f9284e0). One of the two will be used. Which one is undefined.
[Fatal Error] :1:1: ζ–‡δ»Άζε‰η»“ζŸγ€‚

Process finished with exit code 0


I have tried to re-produce this issue by adding my sample license file as resource in the project by following instructions here.

A class is added in the project as follows:
package com.company;

import java.io.InputStream;

public class test
    public InputStream LICENSE = null;
    public test()
        LICENSE = this.getClass().getResourceAsStream("/Aspose.Total.Java.lic");
        try {
            System.out.println("Before loading license");
            new com.aspose.tasks.License().setLicense(LICENSE);
            System.out.println("After loading license");

        } catch (Exception e) {

In the main function I just called the following line of code:

    com.company.test tst = new com.company.test();

This code works fine and no issue is observed. Could you please test this scenario in a simple console application and share the feedback?