Hi Support Team,
Moreover, there is another convenient way to delete image/text watermark with Aspose.Pdf using DeleteStampById() method but in this case watermark must be added using Aspose.Pdf API with IDs.
//Open document
Document pdfDocument11 = new Document(myDir + "PageNumber.pdf");
//Create image stamp
ImageStamp imageStamp = new ImageStamp(myDir + "aspose_pdf.jpg");
imageStamp.Background = true;
imageStamp.XIndent = 100;
imageStamp.YIndent = 100;
imageStamp.Height = 300;
imageStamp.Width = 300;
imageStamp.Rotate = Rotation.on270;
imageStamp.Opacity = 0.5;
imageStamp.setStampId(111);
//Add stamp to particular page
pdfDocument11.Pages[1].AddStamp(imageStamp);
//Save output document
pdfDocument11.Save(myDir+"output_imageStamp.pdf");
//****Removing Stamp****//
PdfContentEditor contentEditor = new PdfContentEditor();
contentEditor.BindPdf(myDir + "output_imageStamp.pdf");
StampInfo[] stampInfo = contentEditor.GetStamps(1);
//contentEditor.DeleteStampById(111);
//Loop through each stamp
for (int i = 0; i < stampInfo.Length; i++)
{
//Check to see if the ID = 111, if so delete the stamp.
if (stampInfo[i].StampId == 111)
{ contentEditor.DeleteStampById(stampInfo[i].StampId); }
}
contentEditor.Save(myDir + "output_deletedstamp.pdf");
Please feel free to contact us for any further assistance.
Best Regards,