We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to change the font of EML body when it is converted to PDF using .NET

Hi,

When we try to convert an eml to pdf we have a requirement to apply a particular font style to body of message and not for the header of the message.
We tried with the following code snippet but this applies the font style to the entire message.
foreach (Aspose.Words.Style style in document.Styles)
{
if (style.Font != null)
{
style.Font.ClearFormatting();
style.Font.Name = “Verdana”;
}
}

Is there any possibility to apply font style only to message body? Could you please suggest us on this?

Thanks,
Kavitha
(US 1466689)

@Kofax_Business_Communications

Please attach the following resources here for testing:

  • Your input EML.
  • Please attach the output file that shows the undesired behavior.
  • Please attach the expected output file that shows the desired behavior.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Hi,

Please find the requested information in attached file.

Thanks,
Kavitha
test.zip (33.9 KB)

@Kofax_Business_Communications

In your case, we suggest you please get the message body and header separately using Aspose.Email and insert them into document using DocumentBuilder.InsertHtml method.

After inserting the message’s body into document, change the font of document. In second step, please move the cursor to the start of document and insert the message’s header. Hope this helps you.