Free Support Forum - aspose.com

Error message displays on PDF after MHtml to Pdf conversion using .NET

Hello,


we use Aspose to transform EML files to PDF. According to Aspose samples and documentation, tt requires to transform the EML file to MHTML first, then open it with Aspose.Words as a document and save to PDF then.

By doing that on the attached mail, the has been created, but Adobe PDF Reader (latest version) displays an error message and further conversions with tools such as pdf2swf failed:

“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

Best regards
Vitali

Hi Vitali,

Thanks for your query. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSJAVA-579 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSJAVA-579) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi,


thanks, issue can’t reproduced with a new version anymore.

Regards
Vitali
Hi Vitali,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.