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

Free Support Forum - aspose.com

Aspose Mailprinter

Is the mail printer object available in the java version. I am looking to convert the message to PDFs.

Hi John,

Thank you for contacting Aspose support team.

MailPrinter provides facility to print messages in Tiff and XPS format only, however writing to PDF can be achieved using Aspose.Email and Aspose.Words together. Following is a sample code which saves a mail in PDF format.

String filename = “TestSender”;
String strEMLFile = filename + “.eml”;
String strMHTFile = filename +".mhtml";
String strPdfFile = filename +".pdf";
System.out.println(“Loading MSG file…”);

// Load message in MSG format
MailMessage message = MailMessage.load(strEMLFile);
System.out.println(“Saving message in MHTML format…”);

// Save the message in MHTML format
message.save(strMHTFile, MailMessageSaveType.getMHtmlFormat());

System.out.println(“Loading MHTML file in Aspose.Words for Java…”);

// Load the MHTML file in Aspose.Words for Java
Document document = new Document(strMHTFile);

System.out.println(“Saving the document in PDF format…”);
// Save in different supported formats
PdfSaveOptions options = new PdfSaveOptions();
document.save(strPdfFile, options);
System.out.println(“Documents saved successfully.”);
catch (Exception ex)
Could you please give it a try and let us know your feedback?