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

Free Support Forum - aspose.com

How to automatically recognize text/image watermark and delete them?

Hi,support,

Is there any way to automatically recognize text/image watermark and delete them?
I try it, but fail. It cannot automatically recognize text/image watermark and delete them, also cannot delete a given known text watermark.

Please help me for it. Thanks!
Ducaisoft

@ducaisoft

Would you kindly share your sample PDF document with us along with the code snippet that you are trying at your side. We will test the scenario in our environment and address it accordingly.

    Dim editor As PdfContentEditor = New PdfContentEditor()
    editor.BindPdf("Test.pdf")
    Dim pgs As Integer = editor.Document.Pages.Count
    For pi As Integer = 1 To pgs
        Dim StampInfo() As StampInfo = editor.GetStamps(pi)
        Dim Stn As Integer = StampInfo.Length
        Dim Index(Stn - 1) As Integer
        For Each Stamp In StampInfo
            editor.DeleteStampById(Stamp.StampId)
        Next
    Next

    editor.ReplaceText("中指数据", "")
    editor.ReplaceText("中", "")
    editor.ReplaceText("指", "")
    editor.ReplaceText("数", "")
    editor.ReplaceText("据", "")
    editor.ReplaceText("2020年1月沧州市土地报告", "")
    editor.Save("Test2.pdf")

Test.pdf (1.2 MB)

@ducaisoft

We were able to notice the issue in our environment and logged an issue as PDFNET-47867 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.