Adobe Acrobat Pro DC Dynamic Stamp Javascript to display User ID

Community Beginner ,
May 06, 2019 May 06, 2019

Copy link to clipboard

Copied

[Moderator moved from Adobe Creative Cloud to JavaScript.]

I have watched more tutorials and read more articles than one should ever have to watch/read on this topic, and yet I still can't seem to find the answer for what Javascript to insert into the custom calculation script in order to display the User identity of the document. Please can somebody help, I'm a Javascript novice.

Using a mac. I've tried to look at the Javascript of the existing Dynamic Stamps that come preloaded with the program, but for some reason I can't seem to see the Annotations folder in the Plug-ins folder.

This Youtube video was the closest I got to coming right: Adobe Acrobat DC Dynamic Stamp Tutorial - YouTube

I inserted the following script, but it had issues with the first two lines of script and it didn't seem to like the hashtag either:

var cAsk = “Enter a name”;

var cTitle = “Document State for Stamp”;

if(event.source.forReal &&

  (event.source.stampName == “#templatename”))

{

  event.value = app.response(cAsk, cTitle);

}

Thanks in advance!

TOPICS
Acrobat SDK and JavaScript

Views

340

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
community guidelines
Most Valuable Participant ,
May 06, 2019 May 06, 2019

Copy link to clipboard

Copied

You must only use straight quotes in your code, not curly ones.

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
community guidelines
Adobe Community Professional ,
May 06, 2019 May 06, 2019

Copy link to clipboard

Copied

I would agree that the quotes do not look like ASCII quotes and should be changed.

What are the error messages?. Do you know for sure that "#templatename" is the name of your stamp?

You'll find explicit instructions here for finding the Stamp folders on both Mac and Windows. Mac does a good job of hiding them.

Installing a PDF Stamp (Macintosh and Windows)

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

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
community guidelines
Community Beginner ,
May 07, 2019 May 07, 2019

Copy link to clipboard

Copied

Thanks guys! I copied the straight codes from another piece of code and that seems to have fixed the error message that kept popping up.

This may seem like a silly question, but for future reference where do I find the straight ASCII quote marks on my keyboard? I typed the script directly into the Javascript panel and they came up as curly quotation marks, should I be using another program to type out the script?

With regards to the stamp name, I just inserted that name into my question so that people knew that that's what I was intending to insert into that space

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
community guidelines
Most Valuable Participant ,
May 07, 2019 May 07, 2019

Copy link to clipboard

Copied

What keyboard layout do you use? In the English ones it should come out as straight quotes when you use a plain-text editor.

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
community guidelines
Most Valuable Participant ,
May 07, 2019 May 07, 2019

Copy link to clipboard

Copied

LATEST

On a US keyboard the quote marks (single and double) are on a key next to Enter. On a UK keyboard, double quote is shift+2.

Curly quotes usually sneak in when a text has passed through a word processor (e.g. with copy & paste) but some web samples will also show them. Bear in mind that a funny thing could also have happened to your quotes on the way to the forum.

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
community guidelines