Answered
I just found out how to add a watermark to a document (addWatermarkFromText method) and it works great. But what if I want to remove the watermark at a later date. I don't seem to be able to remove the watermark I added via JavaScript by going to Document > Watermark > Remove. The only way I can see to remove it is by selecting the Touchup Object tool and manualy deleteing the watermark from each page.
Is there a way to get rid of them with JavaScript like you can add them with JavaScript.
function SetWatermarkState(doc, bState) {
/* set the "Watermark" to bState for doc
doc - doc objet to process
bState - value for logical state
true = show
false = hide
*/
var ocgArray = doc.getOCGs();
for (var i=0; i < ocgArray.length; i++) {
if (ocgArray[i].name == "Watermark") {
ocgArray[i].state = bState;
} // end if Watermark
} // end loop through the OCG object
return;
} // end SetWatermarkState function
SetWatermarkState(this, false);
George Kaiser