Converting a rectangle annotation to a redaction
Hi. I have a simple javascript that will convert highlight annotations to redactions. That works well. However it would be better if I could also use the rectangle (or other shape) annotation. But i cant get the script to work. It just deletes the annotion, I am assuming because I need to somehow specify that the redaction box be the same size / location as the rectangle. Is anyone able to help?
Here is what i have so far:
var annots = this.getAnnots();
for (var i=annots.length-1; i>=0; i--) {
if (annots[i].type == "Rectangle") {
this.addAnnot( {
page: annots[i].page,
type: "Redact",
rect: annots[i].rect,
overlayText: "REDACTED",
alignment: 1,
alignment: true,
fillColor: color.black,
textColor: color.white,
textSize: 0,
});
}
annots[i].destroy();
}
this.applyRedactions ({
bKeepMarks: false,
bShowConfirmation: false,
})
P.S. the reason for this is that not all people in my office have Adobe Pro. This means that the solicitors with Reader can mark what they want me to redact and I can redact it faster than manually going through.
