Hi,
I am having an issue placing HTML emails which come from Outlook into a PDF. It works with simple messages, but on placing more complex ones I either get most of the message that does not appear on the PDF, or a NotSupportedException thrown on the pdf.Save method call. I took a look at this link (http://www.aspose.com/documentation/.net-components/aspose.pdf-for-.net/html-tags-in-text.html) so it may be that when Outlook messages (which are created by MS Word) have HTML tags which may not be supported by Aspose.Pdf.Generator. In that case, would it be recommended to create a Word Document with these Outlook HTML email messages and append it to my PDF via this method (<A href="https://forum.aspose.com/t/74694</A>)? Can someone from Aspose support get back to me on this? I will be happy to send over the HTML and any other files you might need.</P> <P>Thanks,</P> <P>Herman</P> <P> </P> <P> </P> <P>Code that reads HTML and saves:</P><FONT size=2 face=Consolas><FONT size=2 face=Consolas> <P></FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>Section</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> secBody = pdf.Sections.Add();</P> <P></FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>using</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> (</FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>StreamReader</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> sr = </FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>File</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>.OpenText(</FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>@"F:\emailtest1.html"))
{
Text txt = new Text(secBody, sr.ReadToEnd());
txt.IsHtmlTagSupported = true;
secBody.Paragraphs.Add(txt);
}
pdf.Save("C:\\temp\\test.pdf");
NotSupportException details, this only occurs on some email HTML files:
System.NotSupportedException was unhandled
Message=The given path's format is not supported.
Source=mscorlib
StackTrace:
at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.Path.GetFullPath(String path)
at ..( , Image )
at ..( )
at ..( )
at ..( )
at ..( )
at ..( )
at ..( )
at ..( )
at ..(String )
at .e.(Pdf , Section , Cell , Text , HeaderFooter , , )
at .e.(Pdf , Section , Table , Cell , Text , HeaderFooter , , )
at ..(Pdf , Section , HeaderFooter , Table , Row , Cell , Text , , , Boolean )
at ..(Pdf , Section , )
at ..(Pdf )
at ..( , Pdf )
at Aspose.Pdf.Generator.Pdf.Save(String pdfFile)
at AsposeTestApp.Program.Main(String[] args) in C:\VSHome\VS2010\Projects\AsposeTestApp\AsposeTestApp\Program.cs:line 75
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: