How to remove a Page.Watermark

Hello,
If there is a Watermark available in a page (Page.Watermark.Available) how can that Watermark be removed?
The properties are read only and I can’t find any method to do it.

Thank you.
Best regards.

@ndias

Removing of watermark may depend upon how watermark was added in the PDF document e.g. as an image, as a text, as an annotation, etc. Would you please share your sample PDF document with us. We will test the scenario in our environment and address it accordingly.

@asad.ali
I have no example, I have a requirement to remove watermarks from pdfs and am looking into removing all that are possible. I have made for annotations for type stamp and watermark and now I specifically mean the object Page.Watermark. I assume if this is set as available, it is some type of watermark and I want to remove that object.
Does this clarify?

Thank you.

Best regards,
Nuno Dias

@ndias

If Watermark is added using Stamp, you can remove it using following code snippet:

// Create PDF content editor.
Facades.PdfContentEditor contentEditor = new Facades.PdfContentEditor();
// Open the temp file.
contentEditor.BindPdf(dataDir + "input.pdf");

// Process all pages.
foreach (Page page in contentEditor.Document.Pages)
{
 // Get the stamp infos.
 Facades.StampInfo[] stampInfos = contentEditor.GetStamps(page.Number);

 // Process all stamp infos
 foreach (Facades.StampInfo stampInfo in stampInfos)
 {
  try
  {
   contentEditor.DeleteStamp(page.Number, new int[] { stampInfo.IndexOnPage });//.DeleteStampById(stampInfo.StampId);
   }
   catch (Exception e)
   {
     Console.WriteLine(e);
   }
  }
}

// Save changes to a file.
contentEditor.Save(dataDir + "output.pdf");

Annotation can be removed as following:

Document doc = new Document(dataDir + "Original PDF From Client.pdf");
foreach(Page page in doc.Pages)
{
 foreach(Annotation annot in page.Annotations)
 {
  page.Annotations.Remove(annot);
 }
}

As far as Page.Watermark is concerned, there is no such method which can be used to remove it. However, we will definitely check this if you could provide us a sample PDF document where watermark is present and is not getting removed.