Aspose.Total for .NET is a comprehensive suite of file format manipulation APIs that can be used by .NET developers to add EMAIL to PDF conversion features to their applications. Aspose.Email for .NET is a powerful API that enables developers to convert EMAIL file format to HTML. Once the EMAIL file is converted to HTML, Aspose.Words for .NET can be used to render the HTML to PDF. This way, developers can easily add EMAIL to PDF conversion features to their applications.
The Aspose.Total for .NET suite offers a wide range of features that make it easy for developers to manipulate various file formats. It includes APIs for manipulating Word, Excel, PowerPoint, PDF, Outlook, and other file formats. Aspose.Email for .NET is a powerful API that enables developers to read, write, and convert EMAIL file formats. It supports a wide range of EMAIL file formats, including MSG, EML, EMLX, and MHT. It also provides features for managing attachments, managing message headers, and more.
Aspose.Words for .NET is a powerful API that enables developers to create, edit, and convert documents in various file formats. It supports a wide range of document formats, including DOC, DOCX, RTF, HTML, and PDF. It also provides features for manipulating document elements, such as text, images, tables, and more. With Aspose.Words for .NET, developers can easily render HTML to PDF.
C# API to Convert EMAIL to PDF
- Open EMAIL file using MailMessage class
- Convert EMAIL to HTML by using Save method
- Load HTML by using Document class
- Save the document to PDF format using Save method and set Pdf as SaveFormat
Conversion Requirements
Install from command line as nuget install Aspose.Total
or via Package Manager Console of Visual Studio with Install-Package Aspose.Total
.
Alternatively, get the offline MSI installer or DLLs in a ZIP file from downloads .
Parse EMAIL File via .NET
Before converting EMAIL to PDF, if you want to make sure that you are converting the correct email, you can load EMAIL document, parse it and have a look at your desired property. By using MapiMessage class of Aspose.Email for .NET API, you can get sender and recipients information. For example, you can check for a specific sender email for the conversion by using SenderName property.
Restrict PDF Document Editing via .NET
While saving the document from EMAIL to PDF, you might need to protect your output document. Sometimes you may need to limit the ability to edit a document and only allow certain actions with it. This can be useful to prevent other people from editing sensitive and confidential information in your document. Aspose.Words for .NET API, enables you to control the way you restrict the content using the ProtectionType enumeration parameter. You can set your document to read-only by using the following lines of code.
Document document = new Document("HtmlOutput.html");
// apply document protection and set protection password
doc.Protect(ProtectionType.ReadOnly, "password");
// call save method while passing SaveFormat.Pdf
document.Save("output.pdf", SaveFormat.Pdf);
Explore EMAIL Conversion Options with .NET
What is EMAIL File Format?
An email file adheres to a specific format that is recognized by email programs. It comprises a header section and a body section, separated by a blank line. The header contains essential information such as the sender’s email address, recipient’s email address, subject of the email, and the date and time it was sent. The body of the email contains the actual message being conveyed. Email files can exist in either plain text or HTML format. However, HTML emails have become more prevalent in recent times due to their ability to incorporate images and other formatting elements.
The header of an email file provides crucial metadata that aids in routing and organizing messages. It allows the email program to identify the sender, recipient, subject, and timestamp. The body section contains the content of the email, which may include text, images, hyperlinks, and other media elements. While plain text emails are simple and accessible across various devices and email clients, HTML emails offer more design flexibility and interactivity.
With the widespread usage of HTML emails, senders can create visually appealing and engaging messages. HTML emails allow for the inclusion of branding elements, formatting styles, and multimedia content, thereby enhancing the overall presentation and user experience.
What is PDF File Format?
PDF, or Portable Document Format, is a file format designed for presenting documents in a manner that remains consistent across various software applications, hardware devices, and operating systems. Each PDF file contains a comprehensive description of a fixed-layout document, encompassing text, fonts, graphics, and other necessary information for accurate display. Initially developed by Adobe Systems in the early 1990s, PDF served as a means to share computer documents while preserving text formatting and inline images.
PDF files are typically generated using software like Adobe Acrobat or similar PDF creation tools. Presently, PDF has become an open standard governed by the International Organization for Standardization (ISO). This standardization ensures compatibility and interoperability across different platforms and systems. To view PDF files, users can utilize free software such as Adobe Reader or other PDF viewers available.
One of the significant advantages of PDF is its platform independence, allowing seamless viewing and printing on a wide range of devices and operating systems. Regardless of the hardware or software used, the document’s layout and content will remain intact. This universal accessibility has contributed to the popularity of PDF as a preferred format for sharing and distributing documents across diverse platforms and systems.
PDF’s capability to encapsulate a complete document, including text, fonts, graphics, and formatting, makes it a reliable choice for various applications. Whether it’s sharing important reports, publishing e-books, distributing forms, or delivering professional presentations, PDF ensures consistent document rendering and reliable preservation of content across different environments.