MSG to Tiff issue

Hi,

I am using Aspose.Email.dll for .Net version 1.2.0.0 to convert MSG file to Tif format. The output tiff file's 1st and last page is empty. Please let me know the reason for this empty pages and how to avoid this in C# application. I have attached the test MSg file and output tiff file for your reference.

Thanks,

Dhivya

Hi Dhivya,


Sorry for the delayed response on your inquiry.

We have just released a new version of Aspose.Email for .NET v1.3.0 with support for exporting email messages to XPS and TIFF file formats. Please check the below source for your reference, also attached is the image produced by your provided sample message.

C#
var message = Aspose.Email.Mail.MailMessage.Load(“FW Anubhava - Sathva_copy.msg”);
var printer = new Aspose.Email.Printing.MailPrinter();
printer.Print(message, “output.tiff”, Aspose.Email.Printing.PrintFormat.Tiff);

Please note that Aspose.Email.Printing namespace is available in all assemblies of Aspose.Email for .NET v1.3.0 with an exception of 2.0.

Hi,

The second page in output.tif file contains (3/4) th of the image. How can get full image, if the image is in landscape mode.

Thanks,

Dhivya

Hi Dhivya,


Please use the Printer settings like PageHeight, PageWidth and PageUnit to setup your canvas. Check the below source code for your reference,

C#
printer.PageUnit = Aspose.Email.Printing.PrinterUnit.Pixel; //Pixel,Inch,Cm,Millimeter,Point;
printer.PageHeight = //any value;
printer.PageWidth = //any value;

Hi,

The attached Output.tif file does not contains From, To, Date and subject informations. Please let me know how to include those details into tiff output.

Thanks

Dhivya

Hi Dhivya,


I am afraid, with current implementation of MailPrinter class you will not be able to include the email header information (From, To, CC and Subject fields) in your resultant Tiff image. We already have this enhancement on our roadmap and I have linked this thread to the appropriate issue (Id:33109) from our tracking system. You will be notified automatically once this feature is available. Thank you for your understanding in this regard.

Regarding the sample shared by you in your original post. I have converted the MSG file to MHTML and then TIFF (with latest version of Aspose.Email v1.3.0 and Aspose.Words v10.8.0). The MHTML does not have extra space in start or end but the TIFF file has extra page at the end. Attached is an archive containing my output for your reference.

I am going to move this thread to the appropriate forum (Aspose.Words) for further assistance.

Hi
Dhivya,


Thanks for your inquiry. I’m a representative from the Aspose.Words team. The problem occurs because the dimensions of some images are too big to fit inside a page upon converting to fixed page formats e.g: TIFF. Also, there are found some special characters, e.g. LineBreak, NonBreakingSpace, between images which are causing an extra page at the end. As a work around, I would suggest you please use the following code snippet:

LoadOptions
options = new LoadOptions();
options.LoadFormat
=
LoadFormat.Mhtml;

Document
doc = new Document(@“C:\test\in - Copy.mhtml”,
options);

PageSetup
ps = doc.FirstSection.PageSetup;
ps.Orientation
=
Orientation.Landscape;

NodeCollection paragraphs = doc.GetChildNodes(NodeType.Paragraph,
true);
doc.FirstSection.Body.Paragraphs[paragraphs.Count
  • 2].Runs.Clear();
doc.FirstSection.Body.Paragraphs[paragraphs.Count
  • 1].Remove();

  • NodeCollection shapes = doc.GetChildNodes(NodeType.Shape,
    true);
    for (int i = 1; i < shapes.Count; i++)
    {
    Shape
    shape = shapes[i]
    as Shape;

    shape.Width = ps.PageWidth - (ps.LeftMargin
    • ps.RightMargin);
    shape.Height = ps.PageHeight -
    (ps.TopMargin + ps.BottomMargin);
    }

    doc.Save(@“C:\test\out.tiff”);

    I hope, this will help.

    Best Regards,

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


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

    The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan