I am working with iText to try and create a very basic, visual watermark detector.
The first part of the program adds a watermark image to the "UnderContent" of a pdf.
I then want to see if I can detect the watermark image at that location, or check to see if the pdf background contains the watermark.
It would look something like this:
public static boolean isWatermarked(PdfReader reader) throws DocumentException, IOException{
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("/Watermark_PDFs/results.pdf"));
boolean wm = false;
if(stamper.getUnderContent(1) != null) {
wm = true;
}
stamper.close();
return wm;
}
After reading up on getUnderContent from (http://api.itextpdf.com/itext/com/itextpdf/text/pdf/PdfStamper.html#getUnderContent%28int%29) I realize getUnderContent is not what I want to use to read the under content of a pdf.
Is there a method that I can use to read the data stored in the under content and then make a decision based on that data?
Thanks