I managed to solve this by my own. For anyone in need of a starting point for such a script topic here's my solution:
/**
* @description Convert all non-empty StrikeOut (cross-out) annotations into StrikeOutTextEdit (true replace) annotations for Adobe Acrobat
* Tobias Wantzen
* .0
*/
try {
this.syncAnnotScan();
for (var nPage = 0; nPage < this.numPages; nPage++) {
/* get all annotations on the page */
var Annots = this.getAnnots({
nPage: nPage
});
/* process each annotation */
if (Annots != null) {
for (var i = 0; i < Annots.length; i++) {
if (Annots[i].type == "StrikeOut" && Annots[i].contents != "") {
/* get position of strikethrough annotation */
var AnnotsRect = Annots[i].rect;
/* create caret annotation */
var newAnnot = this.addAnnot({
page: nPage,
type: "Caret",
author: Annots[i].author,
intent: "Replace",
refType: "R",
rect: [ AnnotsRect[2], AnnotsRect[1], AnnotsRect[2] - 10, AnnotsRect[1] + 10 ],
richContents: Annots[i].richContents
});
/* group with strikethrough annotation */
Annots[i].richContents = "";
Annots[i].intent = "StrikeOutTextEdit";
Annots[i].inReplyTo = newAnnot.name;
Annots[i].refType = "Group";
}
}
}
}
} catch (e) {
app.alert(e);
}
I'm not quite sure about the caret annotation's rect definition I found by try & error. Will this still work on very small or very big font sizes of the text in the PDF? I don't know ... If there is a better solution for positioning the caret annotation please let me know.
Thanks, Tobias