Hi,
I have a PDF document which I have converted to HTML using Aspose.PDF.
I have embedded everything into the html (see code below).
When using the "HtmlLoadOptions" of Aspose.Email and sending the email - the output in Microsoft Outlook looks strange. However, if I use the "view in webbrowser" in Outlook, the result is better.
I have used the following code:
Dim pdfDoc As New Aspose.Pdf.Document(pdfStream)
Dim newOptions = New Aspose.Pdf.HtmlSaveOptions()
newOptions.RasterImagesSavingMode = Aspose.Pdf.HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground
newOptions.FontSavingMode = Aspose.Pdf.HtmlSaveOptions.FontSavingModes.SaveInAllFormats
newOptions.PartsEmbeddingMode = Aspose.Pdf.HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml
newOptions.LettersPositioningMethod = Aspose.Pdf.HtmlSaveOptions.LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss
newOptions.SplitIntoPages = False
newOptions.CustomHtmlSavingStrategy = New Aspose.Pdf.HtmlSaveOptions.HtmlPageMarkupSavingStrategy(AddressOf SavingToStream)
pdfDoc.Save("C:\Test\DoesNotMatter.html", newOptions)
--
Private Shared Sub SavingToStream(ByVal htmlSavingInfo As Aspose.Pdf.HtmlSaveOptions.HtmlPageMarkupSavingInfo)
Dim loadOptions As New Aspose.Email.Mail.HtmlLoadOptions()
Dim message = Aspose.Email.Mail.MailMessage.Load(htmlSavingInfo.ContentStream, loadOptions)
message.From = "Something"
message.To = "Something"
message.Subject = "Something"
' Send the message using Aspose.Email
Dim client As New Aspose.Email.Mail.SmtpClient()
client.Host = "Something"
client.Port = 25
client.Send(message)
End Sub
--
Earlier I have used the "Save as MHTML" (in Aspose.Words), but this option is not available in Aspose.PDF
I have had a talk with people from Aspose.Email who says that this is caused by the "view engine" of Outlook, causing the html to be shown incorrecly.
When viewing the html in the browser, the result is fine.
My question:
I want to show the PDF inside the "mail body" of an email - how is this possible?
Is there some kind of "save as mhtml" in Aspose.PDF (like in Aspose.Words) - or is there a way to export the pdf to html, so it can be shown correcly in Outlook? (I guess Outlook view engine is not up to date with css etc)
Or do you have an idea how I can make this a better user experience than just showing "strange html", in outlook?
"Plan B" can be just to tell the users to view the email in a web-browser, but thats not really what I want to do :)
Hope you can help :)
I have a PDF document which I have converted to HTML using Aspose.PDF.
I have embedded everything into the html (see code below).
When using the "HtmlLoadOptions" of Aspose.Email and sending the email - the output in Microsoft Outlook looks strange. However, if I use the "view in webbrowser" in Outlook, the result is better.
I have used the following code:
Dim pdfDoc As New Aspose.Pdf.Document(pdfStream)
Dim newOptions = New Aspose.Pdf.HtmlSaveOptions()
newOptions.RasterImagesSavingMode = Aspose.Pdf.HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground
newOptions.FontSavingMode = Aspose.Pdf.HtmlSaveOptions.FontSavingModes.SaveInAllFormats
newOptions.PartsEmbeddingMode = Aspose.Pdf.HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml
newOptions.LettersPositioningMethod = Aspose.Pdf.HtmlSaveOptions.LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss
newOptions.SplitIntoPages = False
newOptions.CustomHtmlSavingStrategy = New Aspose.Pdf.HtmlSaveOptions.HtmlPageMarkupSavingStrategy(AddressOf SavingToStream)
pdfDoc.Save("C:\Test\DoesNotMatter.html", newOptions)
--
Private Shared Sub SavingToStream(ByVal htmlSavingInfo As Aspose.Pdf.HtmlSaveOptions.HtmlPageMarkupSavingInfo)
Dim loadOptions As New Aspose.Email.Mail.HtmlLoadOptions()
Dim message = Aspose.Email.Mail.MailMessage.Load(htmlSavingInfo.ContentStream, loadOptions)
message.From = "Something"
message.To = "Something"
message.Subject = "Something"
' Send the message using Aspose.Email
Dim client As New Aspose.Email.Mail.SmtpClient()
client.Host = "Something"
client.Port = 25
client.Send(message)
End Sub
--
Earlier I have used the "Save as MHTML" (in Aspose.Words), but this option is not available in Aspose.PDF
I have had a talk with people from Aspose.Email who says that this is caused by the "view engine" of Outlook, causing the html to be shown incorrecly.
When viewing the html in the browser, the result is fine.
My question:
I want to show the PDF inside the "mail body" of an email - how is this possible?
Is there some kind of "save as mhtml" in Aspose.PDF (like in Aspose.Words) - or is there a way to export the pdf to html, so it can be shown correcly in Outlook? (I guess Outlook view engine is not up to date with css etc)
Or do you have an idea how I can make this a better user experience than just showing "strange html", in outlook?
"Plan B" can be just to tell the users to view the email in a web-browser, but thats not really what I want to do :)
Hope you can help :)