Skip to main content
May 5, 2016
Question

Need script code for user and date only for custom dynamic stamp

  • May 5, 2016
  • 2 replies
  • 1565 views

Hello,

I am new to dynamic stamps and script writing. I just need a good tutorial on creating a dynamic stamp and I only what the user ID and Date to be generated, not the time. Any help? I am good up until I add the text form and then I get lost.

Thanks

This topic has been closed for replies.

2 replies

Karl Heinz  Kremer
Community Expert
Community Expert
May 5, 2016

Take a look at what the dynamic stamps that come with Adobe Acrobat do to display the user name and date/time information. You'll find something like this:

event.value = (new Date()).toString();

AFDate_FormatEx("h:MM tt, mmm dd, yyyy");

event.value = "By " + ((!identity.name || identity.loginName != (event.source.source || this).Collab.user) ? (event.source.source || this).Collab.user : identity.name)

+ " at " + event.value;

As you can probably guess, the date/time information is formatted in line #2, so when you change that to just "mmm dd, yyyy", you will get something like "May 5, 2016". You can find all the formatting codes  you can use here: Acrobat DC SDK Documentation

May 5, 2016

Thank you!

When I remove "h:MM tt," so that the time is removed it doesnt work. I will look at the code again and the page you posted to try to figure it out further.

Karl Heinz  Kremer
Community Expert
Community Expert
May 5, 2016

What exactly happens when you remove that part of the string? Let's talk a step back: Do you have a functioning dynamic stamp? If so, what is the code that you currently use? When you remove part of the formatting string, make sure that you keep the quotes where they belong:

AFDate_FormatEx("mmm dd, yyyy");

Are you getting any errors on the JavaScript console after you make the change?

May 5, 2016

For example, I would like the form text to display "By User Name on May 5, 2016"