Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save conholdate-docs-gists/8d35af233888670be397eb4f95964c7a to your computer and use it in GitHub Desktop.
Save conholdate-docs-gists/8d35af233888670be397eb4f95964c7a to your computer and use it in GitHub Desktop.
TextWatermark watermark = new TextWatermark("Test watermark", new Font("Arial", 19));
EmailLoadOptions loadOptions = new EmailLoadOptions();
// Constants.InMessageMsg is an absolute or relative path to your document. Ex: @"C:\Docs\message.msg"
using (Watermarker watermarker = new Watermarker(Constants.InMessageMsg, loadOptions))
{
EmailContent content = watermarker.GetContent<EmailContent>();
foreach (EmailAttachment attachment in content.Attachments)
{
// Check if the attached file is supported by GroupDocs.Watermark
IDocumentInfo info = attachment.GetDocumentInfo();
if (info.FileType != FileType.Unknown && !info.IsEncrypted)
{
// Load the attached document
using (Watermarker attachedWatermarker = attachment.CreateWatermarker())
{
// Add wateramrk
attachedWatermarker.Add(watermark);
// Save changes in the attached file
attachedWatermarker.Save();
}
}
}
// Save changes
watermarker.Save(Constants.OutMessageMsg);
}
@conholdate-docs-gists
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment