Redaction annotations are added to the page as it haven’t been rotated.
public void addRedactionAnnotation(Page page, Rectangle rectangle, String overlayText, String colorHex) {
var annotation = new RedactionAnnotation(page, rectangle);
var color = hexToColor(colorHex);
annotation.setFillColor(color);
annotation.setColor(Color.getBlack());
annotation.setModified(new Date());
annotation.setOverlayText(overlayText);
annotation.setTextAlignment(HorizontalAlignment.Left);
annotation.setRepeat(false);
annotation.redact();
page.getAnnotations().add(annotation);
}
Original document: CAT-354-0401 Clinical Trial Report.pdf (618.6 KB)
Processed document: Redacted CAT-354-0401 Clinical Trial Report.pdf (644.0 KB)
When trying to use page.getAnnotations().add(annotation, true), then annotations are added twice. Once as before and once in correct place, but with overlay text rotated as before.
Redacted twice example: redacted_twice.jpg (86.6 KB)