How to Remove watermark from PDF Document

Hi Team,

The docx is converted to pdf and after converting i am going to add watermark text in it. Once the watermark text got added into the pdf document how can i remove the watermark text. I have gone through this link Watermark PDF File in C# | C# Add Remove PDF Watermark where they are removing the watermark using stamp id. Can you suggest me another approach how i remove the watermark text from pdf document using stamps?

I have used below code by using TextStamp to add watermark mark in PDF:
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(dataDir + “Aspose.pdf”);

TextStamp stamp = new TextStamp(“WATERMARK”);
stamp.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center;
stamp.VerticalAlignment = Aspose.Pdf.VerticalAlignment.Center;
stamp.RotateAngle = 45;
stamp.Opacity = 0.5;
stamp.Background = true;
stamp.TextState.FontSize = 72;
stamp.TextState.ForegroundColor = Color.Blue;
stamp.TextState.Font = FontRepository.FindFont(“Courier”);

foreach (Aspose.Pdf.Page pdfPage in pdfDocument.Pages)
{
pdfPage.AddStamp(stamp);
}

pdfDocument.Save(dataDir + “Aspose_watermark.pdf”);

@Sandhya_Rani

If you have not specified the stamp ID while adding it. You can use GetStamps(int) method of PdfContentEditor Class and use the obtained stamp IDs to remove the watermarks from a PDF document using DeleteStampById(int) method of the same class.

Thanks @asad.ali

Can you tell me the constant values need to take for x and y indents to print the exact watermark text on a pdf document.

@Sandhya_Rani

The XIndent and YIndent properties should be set as per your requirements i.e. where you want to render the watermark. These properties expect value in points where 72 points = 1 inch. In case you want to render the watermark at top, bottom or center locations, you can use HorizontalAlignment and VerticalAlignment properties.

Thanks @asad.ali