addWatermarkFromFile no longer working

New Here ,
Jan 29, 2021 Jan 29, 2021

Copy link to clipboard

Copied

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

TOPICS
General troubleshooting, How to, JavaScript

Views

64

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Jan 29, 2021 Jan 29, 2021

Copy link to clipboard

Copied

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.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 29, 2021 Jan 29, 2021

Copy link to clipboard

Copied

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

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines