Simple JavaScript for Custom stamp issue

New Here ,
Mar 26, 2021 Mar 26, 2021

Copy link to clipboard

Copied

Good day.

 

I have a custom stamp and I am just trying to get Adobe Acrobat to ask the user to enter characters (a string) then it display in the stamp. We call it  a GL code (finance term in company)

 

I am very close but the only issue is Adobe Acrobat prompts the user to enter the info twice - once when selecting the stamp in the menu and again while actually using the stamp.

This is the current custom script code:

var cAsk = "Enter the GL Account (i.e. HEN.60201)";
var cMsg = app.response(cAsk);
{

event.value = cMsg;
event.value = event.value.toString().toUpperCase();
event.source.source.info.DocumentState = cMsg;

}

Anyone know what I need to add or change so it only ask the user when placing the stamp in the PDF and NOT when choosing it from the stamp menu?

TOPICS
General troubleshooting, JavaScript

Views

70

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

correct answers 1 Correct Answer

Most Valuable Participant , Mar 26, 2021 Mar 26, 2021
Place this around your current code:   if (event.source && event.source.forReal && event.source.stampName == "STAMP_AP_VALUE") { // rest of code goes here }   To find out the AP value of your stamp apply it to a page, then select it and run this command from the JS Console: this.selectedAnnots[0].AP Copy the outputted value into the code provided above, instead of STAMP_AP_VALUE.

Likes

translate

Translate

Translate
Most Valuable Participant ,
Mar 26, 2021 Mar 26, 2021

Copy link to clipboard

Copied

Place this around your current code:

 

if (event.source && event.source.forReal && event.source.stampName == "STAMP_AP_VALUE") {

// rest of code goes here

}

 

To find out the AP value of your stamp apply it to a page, then select it and run this command from the JS Console:

this.selectedAnnots[0].AP

Copy the outputted value into the code provided above, instead of STAMP_AP_VALUE.

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