Copy link to clipboard
Copied
If you have your redactions already marked is there a way to loop through and gather the coordinates while applying another process using Acrobat Pro 9.5? I was looking at this, https://acrobatusers.com/tutorials/auto_redaction_with_javascript , and other examples but they all seem to be static numbers for the quads. I'd just like to apply a strikethrough on the redactions I have marked and if possible place a stamp based of the quads coordinates.
Copy link to clipboard
Copied
You can simply convert them from Redact annotations to StrikeOut ones by changing their type property. Adding a stamp next to them is also possible, but more complex to implement.
Copy link to clipboard
Copied
Am I headed the right direction?
syncAnnotScan();
annots = getAnnots();
if (annots)
for (var i = 0; i < annots.length; i += 1) {
var rec = getAnnots(this.pageNum)[0].rect;
var left = rec[0];
var right = rec[2];
var top = rec[3];
var bot = rec[1];
qd = [[left, top, right, top, left, bot, right, bot]];
if (annots.type === "Redact") {
annot = this.addAnnot({
type: "StrikeOut",
strokeColor: color.red,
quads:qd;
}
}
break;
}
Copy link to clipboard
Copied
This should be sufficient:
syncAnnotScan();
annots = getAnnots();
if (annots) {
for (var i = 0; i < annots.length; i += 1) {
if (annots.type === "Redact") {
annots.type = "StrikeOut";
}
}
}
Copy link to clipboard
Copied
So I don't need to gather the quad coordinates to pass along unless I were dealing with a static value or is it not necessary with this method?
This worked well for search and redact annots but not the annots I made manually with mark for redaction. What might be the difference?
I realized I would like a thicker line but I didn't see a point value for the line created with StrikeOut but I saw one for PolyLine. I swapped "StrikeOut" for "PolyLine" but I didn't get any results. Is there more information needed to create a PolyLine switching the property type?
Copy link to clipboard
Copied
I just get "undefined" in the console with the following but no reference to a line. Appreciate any help.
syncAnnotScan();
annots = getAnnots();
if (annots) {
for (var i = 0; i < annots.length; i += 1) {
if (annots.type === "Redact") {
var rec = annot.rect;
var left = rec[0];
var right = rec[2];
var top = rec[3];
var bot = rec[1];
var annot = this.addAnnot({type: "Line"})
annot.setProps({
points: [[left,bot],[right,top]]
strokeColor: color.red
});
}
}
}
Copy link to clipboard
Copied
"undefined" just means it ended running without errors. Did you make sure to select all of the code before running it (if you're doing it from the console)?
Beside that you're not using the addAnnot method correctly. You have to specify several more parameters than just the annot type...