Skip to main content
Participant
January 29, 2021
Question

addWatermarkFromFile no longer working

  • January 29, 2021
  • 1 reply
  • 1144 views

We are running Adobe Acrobat DC (20.013.20074). We have a javascript function that inserts a signature into a PDF which was working fine until the latest update that was installed. The javascript function is as follows:

var addSignatureToCheck = app.trustedFunction(function(){
app.beginPriv();
this.addWatermarkFromFile({
cDIPath: "/E/Printing Support/Images/Signature.jpg",
nHorizAlign: app.constants.align.bottom,
nVertAlign: app.constants.align.bottom,
nHorizValue: 175.0, nVertValue: 25.0,
nRotation: 0,
nScale: .80
});

app.endPriv() ;
});

 

The error message from the javascript console is:

Exception in line 8 of function addSignatureToCheck<, script Folder-Level:App:AddSignatureToCheck.js
Exception in line 1 of function top_level, script Batch:Exec

GeneralError: Operation failed.
Doc.addWatermarkFromFile:8:Batch undefined:Exec

Any thoughts as to why we might be getting this error.

Thanks,

Richard

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
January 29, 2021

Try repairing the installation of Acrobat.

Also, make sure that Protected View is disabled (under Edit - Preferences - Security (Enhanced)).

I would also recommend passing a reference to the document as a parameter, instead of using the "this" keyword.

Participant
January 29, 2021

I ran the repair and made sure Protected View is disabled. I changed the function to:

var addSignatureToCheck = app.trustedFunction(function(doc){
app.beginPriv();
doc.addWatermarkFromFile({
cDIPath: "/E/Printing Support/Images/Signature.jpg",
nHorizAlign: app.constants.align.bottom,
nVertAlign: app.constants.align.bottom,
nHorizValue: 175.0, nVertValue: 25.0,
nRotation: 0, nScale: .80
});

app.endPriv();
});

 

I call the function as in the following:  addSignatureToCheck(this);

 

I am still getting the following error in the console:

Exception in line 8 of function addSignatureToCheck<, script Folder-Level:App:AddSignatureToCheck.js
Exception in line 1 of function top_level, script Batch:Exec

GeneralError: Operation failed.
Doc.addWatermarkFromFile:8:Batch undefined:Exec

 

Thanks,Richard