Help with Javascript for Adobe Acrobat
Hi
I have no JS knowledge but tried this out by reading examples online + using chatgpt
i have a very crude JS. It is doing what i was trying to achieve, that is, to redact header and footer of all PDF i have selected.
In acrobat, i created an Action, select all the files i want to redact. But when i run this script, it keeps showing this JS script and i have to keep clicking ok to run it + it keeps prompting me to "Save as" the file as PDFname_redacted.pdf. Can i seek some pointer how can i tune the script such that when i run it, i just redact the PDF i have selected without the need to keep clicking anything ? Thank you
/* My Script */
var qd = [[39, 813, 557, 813, 39, 757, 557, 757]]; // Quad coordinates
var qd1 = [[38,88,559,88,38,42,559,42]]; // Quad coordinates
var numPages = this.numPages; // Total number of pages in the PDF
for (var pgNum = 0; pgNum < numPages; pgNum++) {
this.addAnnot({
type: "Redact",
page: pgNum,
quads: qd,
overlayText: "Deleted",
alignment: 1, // Center alignment
repeat: true
});
this.addAnnot({
type: "Redact",
page: pgNum,
quads: qd1,
overlayText: "Deleted",
alignment: 1, // Center alignment
repeat: true
});
}
this.applyRedactions({ bKeepMarks: false, bShowConfirmation: false, cProgText: "Deleted" });
