We’re developing an application that pulls emails from Exchange and converts the message body to PDF. When calling the Save() method we’re getting a “Media type is not correct” error message which I’ve been able to track down to CSS selectors in the html email. Once I remove these selectors the PDF is generated successfully.
@font-face {font-family:“Cambria Math”; panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;}
@page WordSection1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in;}
I’ve attached a stripped down html and our code to generate the PDF.
Mike
Hello Mike,
Thanks for using our products.
Currently Aspose.Pdf for .NET supports particular CSS tags while converting HTML files into PDF format. Please visit the following link for information on supported CSS tags and how to convert HTML to PDF using InLineHTML
However, we have a product named Aspose.Network for .NET which offers the capability to work with emails and email servers. You may also visit the following link to check out the video tutorial on how to Convert Outlook MSG File to Adobe PDF Document. For more information on Aspose.Network for .NET, please visit Product Overview
In case it does not resolve your problem or you have any further query, please feel free to contact. We apologize for your inconvenience.
Hi,
Hello Kamil,
Thanks for using our products.
Can you please share the source HTML for which you are facing problem, so that we can test the scenario at our end. We apologize for your inconvenience.
FYI, We have a product named Aspose.Network which offers the capability to work with emails and outlook. It also provides the feature to convert outlook emails into TIFF format. Once the message is converted into TIFF format, you can use Aspose.Pdf to convert the TIFF image into PDF format. Please visit the following links for more information on
- Convert Outlook Message File (msg) to Tiff Image
- Parse Microsoft Outlook Message files programmatically
- Aspose.Network Getting Started
- How to convert an Image to PDF (Aspose.Pdf)
In case you have any further query, please feel free to contact. We apologize for your inconvenience.,
Hi,
Hello Kamil,
Thanks for sharing the resource files.
I have tested the scenario and I am able to notice that the source HTML file contains very complex Tags. However, we are looking into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.
Hi,
Hello Kamil,
Thanks for your patience.
Our development team is working hard to support the additional CSS tags and I am afraid the problem is not yet resolved. Besides this, your requirement on "is there any way to ignore unrecognized css tags so the content of htm file is converted without exception?" has already been logged in our issue tracking system with an ID PDFNET-25519. As soon as both the issues are resolved, we would be more than happy to share the information with you.
Your patience and comprehension is greatly appreciated in this regard. We apologize for this delay and inconvenience.
The issues you have found earlier (filed as 25519) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
Hello Kamil,
Thanks for your patience.
We have further analyzed the issue PDFNET-24526 (Convert emails exported from outlook into PDF) and have observed that attached html files contains non HTML compliant tags. There is string like <html xmlns:v="urn:</SPAN>schemas-microsoft-com:vml<SPAN>", which indicates that its schemas-microsoft-com:vml document.