I’ve tested this with the tag set to value = 6. (which equals “Rotate 90 CW”)
https://www.exiftool.org/
I’ve used the exiftool to change the Orientation tag of an image like this:
"& '.\exiftool(-k).exe' -Orientation=6 -n exiftest.jpg"
After having done this the image is rotated (90 degres related to original image). And then i insert this (newly rotated) image into a new email using Outlook. (selecting the file from disk)
I then send this e-mail to myself. Save the e-mail received in my inbox as .msg and I get an msg-file where the image is incorrecly rotated back when converted to pdf.
It looks like the image is rotated back 90 deg again, but it seems like something goes wrong with the aspect as well. Keep in mind that it should not be rotated at all by Aspose.
And the weird thing is that this does NOT happen when using the online tool you provide: https://products.aspose.app/email/conversion/msg
Then it is converted flawlessly.
It DOES happen when converting the MSG to JPG using the same online tool, but selecting .jpg as output.
It also happens when using code like this:
// Converting using Aspose.Mail and Aspose.Words
using MailMessage mail = MailMessage.Load("inputFile.msg");
using var ms = new MemoryStream();
mail.Save(ms, SaveOptions.DefaultMhtml);
var loadOptions = new Aspose.Words.Loading.LoadOptions() { LoadFormat = Aspose.Words.LoadFormat.Mhtml };
var document = new Aspose.Words.Document(ms, loadOptions);
document.Save("outputFile.pdf", new Aspose.Words.Saving.PdfSaveOptions());
//or like this using Aspose.Mail and Aspose.PDF (This is a direct copy from your documentation: https://products.aspose.com/total/net/conversion/msg-to-pdf/)
MailMessage message = MailMessage.Load("sourceFile.msg");
// save MSG as a HTML
message.Save("HtmlOutput.html", SaveOptions.DefaultHtml);
// load HTML with an instance of Document
Document document = new Document("HtmlOutput.html");
// call save method while passing SaveFormat.Pdf
document.Save("output.pdf", SaveFormat.Pdf);
We obviously need to use code similar to the above so the fact that it works int the online tool does not help us.
PS: This does not happen with .PNG images containing the same “Orientation” exif tag/value.
See attached ZIP for .msg and .pdf
test06.zip (262.6 . KB)
@Christian_Bakke Could you please attach your input MSG and output PDF files here for testing? We will check the issue and provide you more information.
I’ve added a zip archive to original post. It contains .msg and .pdf
@Christian_Bakke
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-26158
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Ok, thanks but this issue exists in both Aspose.Words and Aspose.PDF. The same problem occurs in both of them. We (Acos As) have a license for Aspose.Total, does that not give us access to paid support?
@Christian_Bakke
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PDFNET-55777
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@Christian_Bakke We have completed analyzing WORDSNET-26158 and concluded the issue is not a bug. Image is rotated because customer used MHTML as intermediate format.
Aspose.Words uses IE as reference for MHTML and it doesn’t support EXIF metadata. We are forced to follow this behavior in the implementation of MHTML. The image after import is displayed without rotation - as is. We advise to avoid using EXIF in this case.
So why does this work as (we) expect it when using you online conversion tool? Could you please explain what you are doing differently there?
We need it to work like you online tools does…
@Christian_Bakke The online application you are referencing to was development by Aspose.Email team. My colleagues from Aspose.Email team will help you shortly.
Thank you Alexey, but could you please give me a time estimate for “shortly” ? It took almost 3 months getting the issue analyzed so hopefully this will take a bit less time?
Hello @Christian_Bakke,
I’m from Aspose.Email support.
I have checked the conversion (to html, png, jpeg, pdf) both with Online MSG Converter and the code sample you provided.
I did not find any difference in the behavior of Online MSG Converter.
Only when converted to HTML the image is displayed correctly. In other cases (png, jpeg, pdf), we observe image rotation.
It should be noted that Aspose.Email does not change the HTML during conversion, but only extracts it from the message body.
The issues you have found earlier (filed as WORDSNET-26158) have been fixed in this Aspose.Words for .NET 24.3 update also available on NuGet.