diff --git a/src/main/java/com/iqser/red/pdftronlogic/commons/ElementFeatures.java b/src/main/java/com/iqser/red/pdftronlogic/commons/ElementFeatures.java index 2107928..6681ac9 100644 --- a/src/main/java/com/iqser/red/pdftronlogic/commons/ElementFeatures.java +++ b/src/main/java/com/iqser/red/pdftronlogic/commons/ElementFeatures.java @@ -179,8 +179,8 @@ public class ElementFeatures { int distance = 0; int maxLength = Math.max(this.hashOfImage.length(), hash2.length()); for (int i = 0; i < maxLength; i++) { - char char1 = (i < this.hashOfImage.length()) ? this.hashOfImage.charAt(i) : '0'; - char char2 = (i < hash2.length()) ? hash2.charAt(i) : '0'; + char char1 = i < this.hashOfImage.length() ? this.hashOfImage.charAt(i) : '0'; + char char2 = i < hash2.length() ? hash2.charAt(i) : '0'; if (char1 != char2) { distance++; } diff --git a/src/main/java/com/iqser/red/pdftronlogic/commons/ImageHashFactory.java b/src/main/java/com/iqser/red/pdftronlogic/commons/ImageHashFactory.java index 9e8f701..14fb7f8 100644 --- a/src/main/java/com/iqser/red/pdftronlogic/commons/ImageHashFactory.java +++ b/src/main/java/com/iqser/red/pdftronlogic/commons/ImageHashFactory.java @@ -97,7 +97,7 @@ public class ImageHashFactory { int leftPixel = resizedImage.getRGB(x, y); int rightPixel = resizedImage.getRGB(x + 1, y); hash <<= 1; - hash |= (leftPixel < rightPixel) ? 1 : 0; + hash |= leftPixel < rightPixel ? 1 : 0; } } diff --git a/src/main/java/com/iqser/red/pdftronlogic/commons/WatermarkRemovalService.java b/src/main/java/com/iqser/red/pdftronlogic/commons/WatermarkRemovalService.java index 33435fe..f436047 100644 --- a/src/main/java/com/iqser/red/pdftronlogic/commons/WatermarkRemovalService.java +++ b/src/main/java/com/iqser/red/pdftronlogic/commons/WatermarkRemovalService.java @@ -47,6 +47,12 @@ public class WatermarkRemovalService { List watermarkElementFeatures = filterSameFormObjectsOccuringOnMostPages(formObjectsForPages); + if(watermarkElementFeatures.size() > 0){ + log.info("Watermark found and will be removed!"); + } else { + log.info("No watermark found!"); + } + removeAllWatermarks(pdfDoc, watermarkElementFeatures); try {