• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Adobe stamp Add-On Tool not working in Adobe Pro XI

Explorer ,
Aug 28, 2018 Aug 28, 2018

Copy link to clipboard

Copied

Good morning

I currently have Adobe Pro XI version Adobe 11.0.23 on a Windows 10 Computer

I have created several stamps in the past to place a signature at an indicated place on a document.  I first have the person sign a piece a paper, scan the document into adobe, save it as a .jpg image, then go into paint.net, make background transparent and save as a .gif image.  Then I go back into Adobe, click on the stamp tool, click on custom stamp, create custom stamp, browse for the image, etc.

Then I go find the stamp in adobe in the C drive stamp folder--and using the template feature change the name to a more manageable name with #NameOfStamp

After that, I make a java script file with the following script.

function NameOfFunction(oDoc)


{

var cStampName = "#NameOfStamp";
var oStamp = this.addAnnot ({page:this.pageNum, type:"Stamp",
   AP: cStampName,
  rect:[97.92,170.64,247.68,192.96]});


}
app.addToolButton({cName: "NameOfStamp",
                   cExec: "NameOfStamp(event.target)",
                   cLabel:"NameOfStamp",
 
  cTooltext:"NameOfStamp"});

I then close adobe, open back up--and the stamp is normally loaded under add on tools.

I have tried several times yesterday and today to make a new stamp--and it shows up in stamps--but it will not show up in the add on tools.

We have not yet purchased Adobe DC Pro--as I have a full version of Adobe XI Pro.  I am wondering if this problem is due to Adobe Pro XI not being updated any more?

My other stamps work--but this new one will not show up.  Any suggestions would be GREATLY appreciated!

I currently have version Adobe 11.0.23

Thank you so much in advance for your help!

TOPICS
Acrobat SDK and JavaScript , Windows

Views

1.5K

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
Community Expert ,
Aug 28, 2018 Aug 28, 2018

Copy link to clipboard

Copied

Did you duplicate the code for this new stamp? It won't just appear by itself...

If you did, make sure you give a unique value to the cName parameter, and check the JS Console for error messages.

Votes

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
Explorer ,
Aug 29, 2018 Aug 29, 2018

Copy link to clipboard

Copied

  

I edited the javascript code of a current stamp and changed the names to comply with the new stamp.  The code is saved in the JavaScript folder.  I ran the code in the JS Console, and it put the stamp in the appropriate place.

Votes

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
Community Expert ,
Aug 29, 2018 Aug 29, 2018

Copy link to clipboard

Copied

So it's working well?

Votes

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
Explorer ,
Sep 05, 2018 Sep 05, 2018

Copy link to clipboard

Copied

I think what happened is that it is not visible on MY computer.  I installed the stamps and the java script on another computer and they are visible--however when I try to utilize the stamps from the add-on tools on MY computer--they do not show up.

I was doing the process correctly--as I thought that I was-

I have just recently received a new computer with Windows 10--but still have Adobe XI Pro. 

All my other add-on tools are visible--just not the new ones that I create since I have received my new computer.

Votes

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
Community Expert ,
Sep 05, 2018 Sep 05, 2018

Copy link to clipboard

Copied

Ok, so your issue is that the "ToolButton" created by the script is not displayed in the "Add-On" tools panel?  

If this is the case then there are two main possibilities.

1. There is an error in the code that is throwing an exception.

2. The script is in the wrong location.

On #1, Have you looked in the console window to see if there are any reported exceptions? Also, the function named in the "addToolButton" arguments does not match the defined function name.

On #2. Post the JavaScript folder path you are using. Have you used the "app.getPath()" function to verify the stamp folder location?

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

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
Explorer ,
Sep 06, 2018 Sep 06, 2018

Copy link to clipboard

Copied

Thom

Thank you so much for your response.

In answer to your question #1--I did run the code in the java script window and the stamp is placed correctly on the page. I did add the # in front of the appToolButton--it still runs the code correctly, but the tool is not displayed along with my other tools.

On #2--I do not have access to the Program Files folder due to restrictions in place by our IT Department, so my javascripts are located in the following folder.

C:\Users\tjohnson\AppData\Roaming\Adobe\Acrobat\Privileged\11.0\JavaScripts

I have created several of these signature tools for our department heads--and all of the ones that I previously created show up in my add-on tools.  I even installed the tool in question on other computers and it works perfectly.  it will not display on my computer. 

The only thing that has changed since then is that I now have a Windows 10 computer. My previous computer was Windows 8. I really think it has something to do with the compatibility of Windows 10 with Adobe Pro XI.  Since Adobe Pro XI is no longer supported--that may be the issue as well.  I would prefer not having to purchase Adobe DC Pro at this time. 

Thank you for your assistance.

Votes

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
Community Expert ,
Sep 06, 2018 Sep 06, 2018

Copy link to clipboard

Copied

The version of Acrobat is not relevant in this case, but if the "NameOfStamp" toolbar button is not displayed on the Add-On tools panel, and there are no exceptions reported in the console window immediately after Acrobat is started, and the exact same script has been proven to work on another system. Then there are two possibilities other than the ones outlined in the previous post.  

1. There is already a toolbar button with the same name.

2. The script never ran.

For #1, change the name of the toolbar button to something you know is unique. Also, add this code code before the "app.addToolbarButton()" call.

app.removeToolButton("NameOfStamp");

Also look at your other installed scripts

For #2, Add a "console.println()" statement to both the top and bottom of the folder level script. Then, right after Acrobat starts up look at the console window so see if both messages were printed to the console.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

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
Explorer ,
Sep 06, 2018 Sep 06, 2018

Copy link to clipboard

Copied

Thom

Thank you again.

I changed the name of the button on the app.addToolbarButton(), then added the app.removeToolButton("NameOfStamp") where I put the name of the stamp for "NameOfStamp.

When I opened adobe--I received this error.

App.removeToolButton:13:Folder-Level:User:JavaScriptName.js

The toolbutton specified could not be found.

When I put the console.println() statement at the top and the bottom of the script, this is what appeared when I opened acrobat.

SyntaxError: unterminated string literal

13:Folder-Level:User:JavaScriptName.js

I am self-taught--so I am not sure what the last error means.

thank you so much for trying to assist me.

Votes

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
Community Expert ,
Sep 06, 2018 Sep 06, 2018

Copy link to clipboard

Copied

Post your code. There's something wrong with one of the strings in it...

Votes

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
Explorer ,
Sep 06, 2018 Sep 06, 2018

Copy link to clipboard

Copied

Below is original code.

function EricSignature (oDoc)

{

var cStampName = "#EricSignature";
var oStamp = this.addAnnot ({page:this.pageNum, type:"Stamp",
   AP: cStampName,
  rect:[90,140,200,160]});

}

app.addToolButton({cName: "EricSignatureButton",
                   cExec: "EricSignature(event.target)",
                   cLabel:"EricSignature",
  cTooltext:"EricSignature"
  });
                 

Votes

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
Community Expert ,
Sep 06, 2018 Sep 06, 2018

Copy link to clipboard

Copied

The exception for the "app.removeToolButton" call inidicates that there are no other buttons with this same name at the time the script is run. the fact that you are seeing these messages indicates that the code is in fact being run.

The code you've posted does not contain the "console.println()" statement, Was this statement on line #13 where the error is reported?

An unterminated string literal usually means that a quote is missing. Sometimes is caused by an escape sequence.

Can you post the exact code that resulted in the last error message?

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

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
Community Expert ,
Sep 06, 2018 Sep 06, 2018

Copy link to clipboard

Copied

And indicate the line that caused the error.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

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
Explorer ,
Sep 06, 2018 Sep 06, 2018

Copy link to clipboard

Copied

I put the console.println() back in.  Code is below.

function EricSignature (oDoc)
console.println()
{

var cStampName = "#EricSignature";
var oStamp = this.addAnnot ({page:this.pageNum, type:"Stamp",
   AP: cStampName,
  rect:[90,140,200,160]});

}

app.addToolButton({cName: "EricSignatureButton",
                   cExec: "EricSignature(event.target)",
                   cLabel:"EricSignature",
  cTooltext:"EricSignature"
  });
                 

console.println()

When I open Adobe, I receive the following error in the console.

TypeError: this.addAnnot is not a function

8:Folder-Level:User:EricSignature.js

Votes

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
Community Expert ,
Sep 06, 2018 Sep 06, 2018

Copy link to clipboard

Copied

1. console.println() is not a valid command. You must specify what to print. It can be an empty string, if you wish...

2. Replace all instances of "this" in the function with "oDoc", which is your reference to the current document.

Votes

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
Community Expert ,
Sep 06, 2018 Sep 06, 2018

Copy link to clipboard

Copied

3. You can't place a line of code between the function definition and the opening curly brackets.

Votes

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
Community Expert ,
Sep 06, 2018 Sep 06, 2018

Copy link to clipboard

Copied

This code works fine for me:

function EricSignature(oDoc) {

    var cStampName = "#EricSignature";

    var oStamp = oDoc.addAnnot ({page:oDoc.pageNum, type:"Stamp", AP: cStampName, rect:[90,140,200,160]});

}

app.addToolButton({cName: "EricSignatureButton",

    cExec: "EricSignature(event.target)",

    cLabel:"EricSignature",

    cTooltext:"EricSignature"

});

Votes

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
Community Expert ,
Sep 06, 2018 Sep 06, 2018

Copy link to clipboard

Copied

The first "console.println()" is messing up the function definition. It needs to be moved up above the function line.

Next, The "console.println()" calls must contain some kind of message. That's the point of having them. To indicate something about the script while it is running. Try this.

console.println("Start of Script");

function EricSignature (oDoc)

{

  ...... Rest of script ...

console.println("End of Script");

Now when the code is run, when Acrobat first starts, these messages will be printed to the console window. If there are error messages or they don't print, it tells you something is wrong.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

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
Explorer ,
Sep 07, 2018 Sep 07, 2018

Copy link to clipboard

Copied

Thom

I modified the script as you suggested, and when I opened Adobe and ran the java script console, this is what happened.

Acrobat EScript Built-in Functions Version 11.0

Acrobat SOAP 11.0

Start of Script

End of Script

In answer to Try67 regarding the unterminated string literal--I believe I had an error that I corrected from when I was copy pasting in modifying the code earlier.

As Try67 said--the script worked on his computer.  It also works when I install it on other computers here at work--It just won't show up on MY addon tools--All my other tools show up.

The only thing that has changed since I created my last stamp is the computer--I went from Windows 8 to a Windows 10.

I really appreciate both of you trying to assist me.  Any thoughts?

Thank you

Votes

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
Community Expert ,
Sep 07, 2018 Sep 07, 2018

Copy link to clipboard

Copied

Please post your full code, again.

Votes

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
Explorer ,
Sep 07, 2018 Sep 07, 2018

Copy link to clipboard

Copied

Try67

See below.

Thank you

console.println("Start of Script")
function EricSignature (oDoc)

{

var cStampName = "#EricSignature";
var oStamp = this.addAnnot ({page:this.pageNum, type:"Stamp",
   AP: cStampName,
  rect:[90,140,200,160]});

}

app.addToolButton({cName: "EricSignatureButton",
                   cExec: "EricSignature(event.target)",
                   cLabel:"EricSignature",
  cTooltext:"EricSignature"
  });
                 


console.println("End of Script")

Votes

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
Community Expert ,
Sep 07, 2018 Sep 07, 2018

Copy link to clipboard

Copied

And the "EricSignature" button doesn't appear under Tools - Add-On Tools?

Votes

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
Explorer ,
Sep 07, 2018 Sep 07, 2018

Copy link to clipboard

Copied

correct. 

But when I install it on other computers, it does appear.

Votes

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
Community Expert ,
Sep 07, 2018 Sep 07, 2018

Copy link to clipboard

Copied

Then there's probably something wrong with the installation. Try running a Repair Installation from the Help menu.

Votes

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
Explorer ,
Sep 07, 2018 Sep 07, 2018

Copy link to clipboard

Copied

Ok.  I will have to get with our IT Department to do this.  I will let you know if that helps.

Thank you very much for your help.

Votes

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