iText 7 - Add and Remove Watermark on a PDF
I would like to add and remove a watermark to a PDF using iText 7. I was able to add the watermark, but unable to remove it again. I could only find relevant code/examples related to iText 5. Any pointers appreciated, thanks. This is how I added the Watermark (using Layers): pdfDoc = new PdfDocument(new PdfReader(sourceFile), new PdfWriter(destinationPath)); var numberOfPages = pdfDoc.GetNumberOfPages(); PageSize ps = pdfDoc.GetDefaultPageSize(); for (var i = 1; i <= numberOfPages; i++) { PdfPage page = pdfDoc.GetPage(i); PdfLayer layer = new PdfLayer("watermark", pdfDoc); var canvas = new