These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

How can I delete a watermark when I print my document

ayim
Registered: Jul 25 2007
Posts: 4

Hello,

I create this function for clean a watermark, but when I print my document this watermark it's present

function clean()
{
var ocgArray = this.getOCGs(this.pageNum);
for (var i=0; i < ocgArray.length; i++)
{
if (ocgArray[i].name == "Watermark")
{
ocgArray[i].state = false;
}
}
}

I created my watermark with "addWatermarkFromText" when I was opening my pdf

function init()
{
if(bOpened == "true")
{
// document already been opened
}
else
{
this.addWatermarkFromText({
cText: "C O P Y",
nFontSize: 70,
nRotation: 45,
bOnScreen: true,
nOpacity: .5 });
bOpened = "true";
}
}
// call init
init();

thanks
ayim

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
Are you sure your water mark layer is actually named "Watermark"?

To see the names of the layers in your PDF, run the following script from your JavaScript debugger console:

console.show();
console.clear();
console.println("OCG Layer names:");
var ocgArray = this.getOCGs();
for (var i=0; i < ocgArray.length; i++)
console.println("Layer " + i + " is named: " + ocgArray[i].name);

George Kaiser

ayim
Registered: Jul 25 2007
Posts: 4
Hi,

the name it's correct but it's posible to modify the option print of "Always" to "Prints When Visible" in the layer properties with javascript.

thanks
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
Just make the state for the "Watermark" layer "false".

var ocgArray = this.getOCGs();
for (var i=0; i < ocgArray.length; i++) {
if (ocgArray[i].name == "Watermark") {
ocgArray[i].state = false;
}
}

With Acrobat 8 you might be able to run the menu item to remove the watermark, but it would have had to been created by Acrobat 8.

Reruninig your code just makes another layer and it appears that all Background and Watermark layers are not visible in on the layer navigation tab.

George Kaiser