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

Free Support Forum - groupdocs.com

.Net Core 5 TextWatermark ignoring colors on WORD

All watermarks appear gray in color, with opacity at 1. Foreground Color set to red, background black, no changes. I was able to add color in my evaluation but does not appear to work anymore. Any suggestions? This has happened on multiple word documents.

         string documentWatermark = "Effective Date: " + effectiveDate.Value.ToLocalTime().ToString();
         List<TextWatermark> returnValue = new List<TextWatermark>();            
         returnValue.Add(new TextWatermark(documentWatermark, new Font("Arial", 8));
        
        foreach (var wm in returnValue)
        {
            wm.Opacity = _config.Opacity;
            wm.ForegroundColor = Color.Black;
            wm.Margins = new Margins(MarginType.Absolute, 0, 0, .1, .1);
            wm.BackgroundColor = Color.Red;
            returnValue.Add(clearmarkWM);
      }
       using (Watermarker watermarker = new Watermarker(fileStream))
                                {
                                    
                                    foreach (var wm in returnValue)
                                    {
                                        watermarker.Add(wm);
                                    }
                                    watermarker.Save();
                                }

image.png (85.8 KB)

@abcmk

Could you please share the sample application and the source file? The code you shared has missing references (e.g. _config, effectiveDate).

Hi,
EffectiveDate = DateTime? a nullable datetime set to DateTime.UtcNow

_config.Opacity is just a double:

public double Opacity
    {
        get
        {
            if (_opacity <= 0)
            {
                return 1;
            }
            return _opacity;
        }
        set
        {
            _opacity = value;
        }

Instance is this:
public WatermarkerConfig GetTenantWatermarkerConfig(ApplicationUser currentUser)
{
//TODO DB Fetch
return new WatermarkerConfig()
{
EnableWatermarker = true,
EnableUserWatermarker = true,
EnableDocumentWatermarker = true,
FontName = “Arial”,
Location = WatermarkerLocationEnum.TopLeft,
Username = currentUser.NormalizedEmail,
Opacity = 1
};
}

@abcmk

We cannot reproduce this issue at our end. Please prepare a sample application and a screencast explaining the steps to reproduce the issue. Also, share the source/problematic file.

This can be closed