even though my example here is for annotations ... it would be cool to do the same based on base content as well! Maybe it would have to be two separate scripts? Or there could be a way to toggle between the two, or both, with checkboxes in the GUI
Let's say you have a very specific type of typewriter/textbox font type.
e.g. Arial, pt 14, #0078D7
Would it be possible to have a JavaScript script / tool, which would create bookmarks, with the text being the destination, of ONLY annotations with these SPECIFIC annotation text format/font combination?
Meaning that other annotations which in this case would have another size, or be of another color or font, wouldn't be converted into bookmarks?
Any ideas?
Something like this?
Code: Select all
var annotations = this.getAnnots();
if (annotations) {
for (var i = 0; i < annotations.length; i++) {
var annot = annotations[i];
// Check specific properties
if (annot.font === "Arial" && annot.fontSize === 14 && annot.color === color.blue) {
// Create a bookmark for the annotation
var bkmk = this.bookmarkRoot.createChild(annot.contents);
bkmk.setAction("this.pageNum = " + annot.page + ";");
}
}
}
Font type
Font size
Color
extra: bold/italic/underscore checkboxes?
maybe with some ability to save presets as well, or to copy over the format from highlighted text if the text you have selected has only 1 type of the aforementioned formatting.
Thus, if you were lucky enough to have a document where headings are formatted differently from the default body text... you would be able to create bookmarks only for the headings...