Hi, Support:
I use Pdf.pages(p).AddStamp(TextStamp) and Pdf.AddStamp(ImageStamp) to create watermarked pdf, and then, using the following code to remove them,but fail:
Dim Pdf As New Aspose.Pdf.Document(PdfFile)
Dim Pages As Integer = Pdf.Pages.Count
Dim PdfContentEditor As PdfContentEditor
For p As Integer = 1 To Pages
Dim TmpPdf As New Aspose.Pdf.Document()
TmpPdf.Pages.Add(Pdf.Pages(p))
Dim WatermarkAnnotations = TmpPdf.Pages(1).Annotations
For Each CA As WatermarkAnnotation In WatermarkAnnotations
If CA.AnnotationType = AnnotationType.Watermark Then
TmpPdf.Pages(1).Annotations.Delete(CA)
End If
Next
PdfContentEditor = New PdfContentEditor()
PdfContentEditor.BindPdf(TmpPdf)
For Each Stamp As StampInfo In PdfContentEditor.GetStamps(1)
PdfContentEditor.DeleteStampById(Stamp.StampId)
Next
PdfContentEditor.Save(AppPath & "\Tmp.pdf")
PdfContentEditor.Dispose()
PdfContentEditor = Nothing
TmpPdf = New Aspose.Pdf.Document(AppPath & "\Tmp.pdf")
Pdf.Pages.Delete(p)
Pdf.Pages.Insert(p, TmpPdf.Pages(1))
Next
Pdf.Save(PdfFile)
Also, the above codes can not remove text/image watermark added by Adobe.
Please tell me what’s wrong about this ,and what is the right one to reach it.
Three Sample Pdf Files:
图片水印.pdf (146.4 KB)
文字水印.pdf (185.5 KB)
文字水印+图片水印.pdf (270.1 KB)