Hello,
“An error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to correct the problem.“
Here the code:
import com.aspose.email.MailMessage;
import com.aspose.email.MailMessageSaveType;
import com.aspose.email.MessageFormat;
import com.aspose.words.Document;
import com.aspose.words.SaveFormat;
MailMessage message = MailMessage.load(“test.eml”,
MessageFormat.getEml());
System.out.println(“Saving message in MHTML format…”);
File file = File.createTempFile(String.valueOf(new Date().getTime()),
”.mhtml”);
// Save the message in MHTML format
message.save(file.getAbsolutePath(), MailMessageSaveType
.getMHtmlFromat());
System.out.println(“Loading MHTML file in Aspose.Words for Java…”);
Document document = new Document(file.getAbsolutePath());
for (Section section : document.getSections())
{
section.getPageSetup().setOrientation(Orientation.LANDSCAPE);
}
System.out.println("Saving the document in Pdf format....");
// Save in different supported formats
document
.save("./output/message_"
+ String.valueOf(new Date().getTime()) + ".pdf",
SaveFormat.PDF);
System.out.println("Documents saved successfully.");
In attachment you'll find:
- test.eml.zip: EML File used for transformation (zipped)
- screenshot.png: Screenshot of the acrobat reader error
- message_output.pdf: Generated pdf