Acrobat Dynamic Stamp JavaScript not firing when stamp is first selected

New Here ,
Jan 25, 2018

Copy link to clipboard

Copied

I am trying to create a dynamic stamp in Adobe Acrobat XI Pro, that I can distribute to other users to use with minimal work on their end to use it. This stamp is an image that I've added a single text field to, and in this field I've inserted the following JavaScript code in Calculate > Custom calculation script:

console.println("Hello, World!");

event.value = "";

if (event) promptUser();

function promptUser()

{

var d = app.response();

event.value = util.printd("mmm dd yyyy", new Date(Date.parse(d))).toUpperCase();

}

When I am in editing mode with this form, and close the built-in JS editor window with this code, I see "Hello, World!" in the JavaScript Debugger window, and I get a prompt to input a date. However, whenever I save this stamp, then add it as a custom stamp, then try to use this, it remains whatever date it was saved as, without a prompt to input a date, and without outputting "Hello, World!" to the JavaScript Debugger window.

What am I missing to get this stamp to work, so that each time a user selects this stamp to insert it into a PDF, it will prompt them for the date they want to use on the stamp?

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

There are many parts to a dynamic stamp. They all have to be in place for it to work. The code you have here is insufficient by itself. Just as an example the stamp name has to be prepended with "#" in order for the script to be run when the stamp is selected, and there is much more.

Read the content on these pages and watch the linked videos

PDF Stamp Annotations

https://acrobatusers.com/tutorials/dynamic_stamp_secrets

TOPICS
Acrobat SDK and JavaScript, Windows

Views

743

Likes

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

Acrobat Dynamic Stamp JavaScript not firing when stamp is first selected

New Here ,
Jan 25, 2018

Copy link to clipboard

Copied

I am trying to create a dynamic stamp in Adobe Acrobat XI Pro, that I can distribute to other users to use with minimal work on their end to use it. This stamp is an image that I've added a single text field to, and in this field I've inserted the following JavaScript code in Calculate > Custom calculation script:

console.println("Hello, World!");

event.value = "";

if (event) promptUser();

function promptUser()

{

var d = app.response();

event.value = util.printd("mmm dd yyyy", new Date(Date.parse(d))).toUpperCase();

}

When I am in editing mode with this form, and close the built-in JS editor window with this code, I see "Hello, World!" in the JavaScript Debugger window, and I get a prompt to input a date. However, whenever I save this stamp, then add it as a custom stamp, then try to use this, it remains whatever date it was saved as, without a prompt to input a date, and without outputting "Hello, World!" to the JavaScript Debugger window.

What am I missing to get this stamp to work, so that each time a user selects this stamp to insert it into a PDF, it will prompt them for the date they want to use on the stamp?

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

There are many parts to a dynamic stamp. They all have to be in place for it to work. The code you have here is insufficient by itself. Just as an example the stamp name has to be prepended with "#" in order for the script to be run when the stamp is selected, and there is much more.

Read the content on these pages and watch the linked videos

PDF Stamp Annotations

https://acrobatusers.com/tutorials/dynamic_stamp_secrets

TOPICS
Acrobat SDK and JavaScript, Windows

Views

744

Likes

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
Jan 25, 2018 0
Adobe Community Professional ,
Jan 25, 2018

Copy link to clipboard

Copied

There are many parts to a dynamic stamp. They all have to be in place for it to work. The code you have here is insufficient by itself. Just as an example the stamp name has to be prepended with "#" in order for the script to be run when the stamp is selected, and there is much more.

Read the content on these pages and watch the linked videos

PDF Stamp Annotations

https://acrobatusers.com/tutorials/dynamic_stamp_secrets

Likes

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
Reply
Loading...
Jan 25, 2018 0
Adobe Community Professional ,
Jan 25, 2018

Copy link to clipboard

Copied

Please watch the video on installing a dynamic stamp in the first link. I'm quite sure your first main issue is that you are using either the Create Stamp or Import Stamp tool to import the stamp into Acrobat. This will completely destroy all dynamic features.

Likes

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
Reply
Loading...
Jan 25, 2018 0
New Here ,
Jan 25, 2018

Copy link to clipboard

Copied

The stamp needs to be distributed to other users who install it like a custom stamp. If this is impossible to do by installing it like a custom stamp, then it can't be done.

Likes

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
Reply
Loading...
Jan 25, 2018 0
Most Valuable Participant ,
Jan 25, 2018

Copy link to clipboard

Copied

It is possible, but not in the normal way of creating a custom stamp. You need to provide them the stamp file itself, and they need to place it in the user Stamps folder of Acrobat. This is probably all well explained in the tutorials linked to above.

Likes

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
Reply
Loading...
Jan 25, 2018 0
Adobe Community Professional ,
Jan 25, 2018

Copy link to clipboard

Copied

Acrobat doesn't have an Install Custom stamp feature. I know there is a button on the Stamp manager that says "Install" but this is a misnomer, it doesn't install a stamp, it creates a new one. And yes, this has been a problem for a very long time. Acrobat really aught to have tools for installing common resources like stamps, but it doesn't .

But this is only the first of your issues.  There is a specific methodology for creating a dynamic stamp, especially one that displays a popup response box.  You need to read the articles on how to create a dynamic stamp first.

Likes

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
Reply
Loading...
Jan 25, 2018 1