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

Free Support Forum - aspose.com

Cannot convert outlook email to pdf - SaveToPdf-Error

Hi,
I am a developer and I am using Aspose to convert Outlook mails to pdf. Unfortunately the SaveToPdf()-method does not works for some mails; mostly for those mails containing (ms-office)-tables… I am using the following code to do the conversion:

MapiMessage mail = MapiMessage.FromFile(“OutlookMail.msg”);
string someExtraText = "\par " + “This is an outlook mail conversion. The sender is: " + mail.SenderName + " \line “;
using (System.IO.MemoryStream rtfStream = new System.IO.MemoryStream())
{
System.IO.StreamWriter tw = new System.IO.StreamWriter(rtfStream);

tw.Write(”{\rtf1 \ansi\ansicpg1252{\fonttbl{\f1001\fswiss\fcharset0 Arial;}} \f1001” + someExtraText + “\line \pard \brdrb \brdrs\brdrw10\brsp20 {\fs4\~}\par \pard \line”);
tw.Write(mail.BodyRtf);
tw.Flush();

Aspose.Words.Document doc = new Aspose.Words.Document(rtfStream);

try {
doc.SaveToPdf(“OutlookMail.pdf”);
}
catch (Exception exp) {
Console.WriteLine(exp.Message);
}
}

And Iam becoming the following error message:

===================================
Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. (Aspose.Words)

------------------------------
Program Location:

bei ?.?.?(Shape ?, SizeF ?, Matrix ?, Single ?, Single ?, Single ?)
bei ?.?.?(ShapeBase ?, SizeF ?)
bei ?.?.?(? ?)
bei ?.?.?(? ?)
bei ?.?.?(? ?, ? ?)
bei Aspose.Words.Document.?(Int32 ?)
bei Aspose.Words.Document.SaveToPdf(Int32 pageIndex, Int32 pageCount, Stream stream, PdfOptions pdfOptions)
bei Aspose.Words.Document.SaveToPdf(Int32 pageIndex, Int32 pageCount, String fileName, PdfOptions pdfOptions)
bei Aspose.Words.Document.SaveToPdf(String fileName)
===================================

Can you imagine why this is going wrong?

Iam using Aspose.Words 8.2.0.0 and Aspose.Pdf 4.1.0.0, Aspose.Pdf.Kit 3.4.0.0

For confidentiality purposes I can not share the mails. I have attached a screenshot of the mail to show you it’s structure


Many Thanks in Advance



Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Unfortunately, it is difficult to tell what the problem is without your input document. You can remove sensitive information from your document and attach it here for testing. It is safe to attach file in the forum, only you and Aspose staff can download the attached documents.

In addition, have you tried using the latest version of Aspose.Words? You can download it from here:

http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/category1188.aspx

Best regards.

you can use the attached msg-file (extract the zip file) to reproduce the issue (save the rtfstream of mail.bodyrtf to pdf using the saveToPdf()-method).

Thanks

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I managed to reproduce the problem on my side. The problem will be fixed in the next hotfix. Please expect a reply before next hotfix (within few days). You will be notified.

Best regards,

The issues you have found earlier (filed as 15673) have been fixed in this update.


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