Hi
Hi Aravind,
Thank you for considering Aspose line of products.
1. For converting EML or MSG to PDF, please have a look at our documentation article Saving a MSG as PDF which uses Aspose.Email in combination with Aspose.Words to achieve this goal.
2. For other conversions, please visit the following pages:
- Xls/Xlsx to PDF
- Doc/Docx to PDF,
- Aspose.Pdf supports various conversions as you can look from the list available at the Working with Document Conversion link
Hi
Hi Arvind,
If you want to convert email message to PDF with attachments, you will have to first extract attachments from email messages using Aspose.Email and then add attachments to PDF using Aspose.Pdf after converting email message to PDF.
Best Regards,
Hi
Hi Arvind,
Hi Arvind,
Dim attFileName As New List(Of String)()<o:p></o:p>
'Convert MSG to MHTML
Dim mailMsg As Aspose.Email.Mail.MailMessage = Aspose.Email.Mail.MailMessage.Load(myDir + "Untitled.msg")
Dim ms As New MemoryStream()
'Save as MHTML
mailMsg.Save(ms, MailMessageSaveType.MHtmlFromat)
'Convert MHTML to PDF
'create an instance of LoadOptions and set the LoadFormat to Mhtml
Dim loadOptions = New Aspose.Words.LoadOptions()
loadOptions.LoadFormat = Aspose.Words.LoadFormat.Mhtml
'create an instance of Document and load the MTHML from MemoryStream
Dim document = New Aspose.Words.Document(ms, loadOptions)
'create an instance of HtmlSaveOptions and set the SaveFormat to Html
Dim saveOptions = New Aspose.Words.Saving.PdfSaveOptions()
'save the document to Html file
document.Save(myDir + "Untitled.pdf", saveOptions)
'Extract attachments from MSG
Dim mailMsg1 As Aspose.Email.Mail.MailMessage = Aspose.Email.Mail.MailMessage.Load(myDir + "Untitled.msg", Aspose.Email.Mail.MessageFormat.Msg)
Dim attachment As Aspose.Email.Mail.Attachment
For Each attachment In mailMsg1.Attachments
'To display the the attachment file name
attachment.Save(myDir + attachment.Name)
attFileName.Add(myDir + attachment.Name)
Next
'Add Attachments to final PDF
'open document
Dim pdfDocument As New Aspose.Pdf.Document(myDir + "Untitled.pdf")
For Each fileName As String In attFileName
'setup new file to be added as attachment
Dim fileSpecification As New FileSpecification(fileName, "Sample text file")
'add attachment to document's attachment collection
pdfDocument.EmbeddedFiles.Add(fileSpecification)
Next
'save new output
pdfDocument.Save(myDir + "FW.pdf")
We are sorry for the inconvenience caused.
Best Regards,
Hi
’open document<o:p></o:p>
Dim pdfDocument As New Aspose.Pdf.Document(myDir + “Untitled.pdf”)<o:p></o:p>
For Each fileName As String In attFileName<o:p></o:p>
'setup new file to be added as attachment<o:p></o:p>
Dim fileSpecification As New FileSpecification(fileName, “Sample text file”)<o:p></o:p>
'add attachment to document’s attachment collection<o:p></o:p>
pdfDocument.EmbeddedFiles.Add(fileSpecification)<o:p></o:p>
Next<o:p></o:p>
'save new output<o:p></o:p>
pdfDocument.Save(myDir + “FW.pdf”)
Here Untitled.pdf is main msg content(like subject,attachment,Best Regards ect) and fileName is attachment(bookmarkoutput and Bike pdf) and u embedded with Untitled.pdf file and finally u get FW.pdf.But if open FW.pdf only can see msg content,cant see bookmarkoutput and Bike content.
Why after embedded attachment file with msg file cant view the all content.
Hi Aravind,
Hi
Hi Aravind,
I can see that I can use Aspose to convert .msg. can it also convert .eml to PDF through a VB.net API?
Hi Steven,
Dim mailMsg As MailMessage = MailMessage.Load(“About Aspose-1.eml”, New EmlLoadOptions())
Dim ms As New MemoryStream()
'Save as MHTML
mailMsg.Save(ms, Aspose.Email.Mail.SaveOptions.DefaultMhtml)
'create an instance of LoadOptions and set the LoadFormat to Mhtml
Dim loadOptions = New Aspose.Words.LoadOptions()
loadOptions.LoadFormat = Aspose.Words.LoadFormat.Mhtml
’create an instance of Document and load the MTHML from MemoryStream
Dim document = New Aspose.Words.Document(ms, loadOptions)
'create an instance of HtmlSaveOptions and set the SaveFormat to Html
Dim saveOptions = New Aspose.Words.Saving.PdfSaveOptions()
'save the document to Html file
document.Save(“About Aspose.pdf”, saveOptions)