This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/dotnet/conversion/email-to-pdf.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Convert emails (MSG / EML) to PDF in C# .NET | Nutrient .NET SDK

Nutrient .NET SDK converts MSG and EML email messages to PDF without requiring Microsoft Office interop. PDF output preserves message content for compliance, legal review, and business documentation workflows.

Download sample

Email attachments are added to the output document as PDF attachment annotations. If you run this workflow inside Docker on Linux, make sure the container includes Chrome and runs as a non-root user. Refer to the headless Chrome deployment guide.

Prepare the project

Register the SDK license before running conversion operations. For setup details, refer to the getting started with .NET SDK guide.

using GdPicture14;
LicenseManager license = new LicenseManager();
license.RegisterKEY("");

Convert an email to PDF

The following example loads an MSG file, configures the conversion, and saves the result as a PDF:

using GdPictureDocumentConverter converter = new GdPictureDocumentConverter();
GdPictureStatus status = converter.LoadFromFile(@"input.msg", GdPicture14.DocumentFormat.DocumentFormatMSG);
if (status != GdPictureStatus.OK)
{
throw new Exception(status.ToString());
}
converter.EmailPreferOnePage = true;
status = converter.SaveAsPDF("output.pdf");
if (status != GdPictureStatus.OK)
{
throw new Exception(status.ToString());
}
status = converter.CloseDocument();
if (status != GdPictureStatus.OK && status != GdPictureStatus.Aborted)
{
throw new Exception(status.ToString());
}

The same workflow applies to EML files. Change the input path and use the corresponding DocumentFormat value.

Optional configuration properties

You can configure email conversion with properties such as EmailCustomJavaScript, EmailPageHeight, EmailPageWidth, EmailPageMarginTop, EmailPageMarginBottom, EmailPageMarginLeft, EmailPageMarginRight, EmailPreferOnePage, and EnableICC. You can also set PdfEnableLinearization to enable Fast Web View output.