Hello,
i want to convert a Mail to PDF, but in the result PDF, the header information (to, from, …) are always in english.
Is there a way to change the language to german or any other language?
I check the issue Email headers in our own language when converting to PDF, but there is no MhtMessageFormatter in current (most recent) Aspose Version.
Kind Regards,m
Andy
@AStelzner
I suggest you to please visit the following thread link for MhtFormatter class usage.
Hi,
sorry, but i have now …Mail… Namespace, is something missing, any referenced assembly?
image.png (7.7 KB)
Kind Regards,
Andy
@AStelzner
Can you please try using following suggested as MHTFormatter has been moved to MHTSaveOptions.
public static void testFormatter()
{
string file = "Test email.msg";
MailMessage eml = MailMessage.Load(file, new MsgLoadOptions());
MhtSaveOptions mhtSaveOptions = new MhtSaveOptions();
CultureInfo culture = CultureInfo.CreateSpecificCulture("de-DE");
mhtSaveOptions.FormatTemplates[MhtTemplateName.DateTime] = String.Concat(culture.DateTimeFormat.LongDatePattern, " ", culture.DateTimeFormat.ShortTimePattern);
mhtSaveOptions.FormatTemplates[MhtTemplateName.From] = mhtSaveOptions.FormatTemplates[MhtTemplateName.From].Replace("From:", "De :");
mhtSaveOptions.FormatTemplates[MhtTemplateName.Sent] = mhtSaveOptions.FormatTemplates[MhtTemplateName.Sent].Replace("Sent:", "Envoyé :");
mhtSaveOptions.FormatTemplates[MhtTemplateName.To] = mhtSaveOptions.FormatTemplates[MhtTemplateName.To].Replace("To:", "À :");
mhtSaveOptions.FormatTemplates[MhtTemplateName.Cc] = mhtSaveOptions.FormatTemplates[MhtTemplateName.Cc].Replace("Cc:", "Copie :");
mhtSaveOptions.FormatTemplates[MhtTemplateName.Subject] = mhtSaveOptions.FormatTemplates[MhtTemplateName.Subject].Replace("Subject:", "Objet :");
eml.Save("test2.msg", mhtSaveOptions);
}
Hello,
this is the workaround i implemented as “workaround” and yes, this works
Kind regards,
Andy
@AStelzner
It’s good to know that suggested sample has provide to be working on your end.
Hello again
i have to change the “Sent” Date to a different format.
The current is:
“Mon, 14 Sep 2020 10:37:07 +0200”
and i need this:
“14.09.2020 10:37”
Is there a way to change the format in the generated PDF?
Kind Regards,
Andy
Sorry, its ok, i solved it with this:
Kind Regards,
Andy
@AStelzner
It’s good to know things are fine on your end.