Free Support Forum - groupdocs.com

How to remove watermark from a document using .NET

I have groupdocs license.
But when i try to remove watermark as per attached project it says cannot remove parts with this licence.
can you please help on this

here is the code I am using

public static void RemoveWaterMark(string FilePath, string password)
{
License lic = new License();
lic.SetLicense(@“C:\CFT1\Test\GroupDocs.Total.Product.Family.lic”);

        using (FileStream stream = File.Open(FilePath, FileMode.Open, FileAccess.ReadWrite))
        {
            GroupDocs.Watermark.Options.LoadOptions getLoadOptions = new GroupDocs.Watermark.Options.LoadOptions();
            getLoadOptions.Password = password;
            using (Watermarker watermarker = new Watermarker(stream, getLoadOptions))
            {
                PossibleWatermarkCollection possibleWatermarks = watermarker.Search();
                var VMtoDelete = possibleWatermarks.ToList<PossibleWatermark>();
                foreach (var item in VMtoDelete)
                {

                    // Remove watermark at the specified index from the document.

                    /*possibleWatermarks.RemoveAt(0)*/
                    ;

                    // Remove possible watermarks from the document.
                    possibleWatermarks.Remove(item);
                }

                watermarker.Save(stream);
            }
        }
    }

@tilankak,

Please share following details and we’ll look into this issue:

  • API version that you integrated in the project (e.g 19.10, 20.4)
  • Problematic file and password
  • Complete error/exception details