Skip to main content
Participant
December 20, 2018
Question

Dynamic Stamp with Username

  • December 20, 2018
  • 2 replies
  • 16580 views

Hello,

i try to create a dynamic stamp which shows the Date and the Username of the Current User or the signature.

Acrobat does have a stamp like this in the examples, but i can't change them. I know that this is only possible with a calculated java-script.

The date i get with this code:

Event.value = util.printd("h:MM tt, MMM dd yyyy", New Date);

But i can't find any solution for a username (embedded in this and i don't know any java-script-specialist.

I hope you can help me.

Thanks and have  some nice christmas days!

    2 replies

    try67
    Community Expert
    Community Expert
    December 20, 2018

    You should copy the code from one of the built-in dynamic stamps. For example:

    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;

    Participant
    December 20, 2018

    Thanks - where did you get the "original Code" from the built-in stamps? I did not find them, although nothing with Google (maybe because i searched in german, because we are in Germany)

    But this code doesn't Show the Username:

    try67
    Community Expert
    Community Expert
    December 20, 2018

    I went to the Stamps folder of the application (the exact location depends on your OS and Acrobat version), then opened the Dynamic.pdf file and copied the calculation script from one of the stamps that has the user name in it.

    try67
    Community Expert
    Community Expert
    December 20, 2018

    First of all, your code for the date is not correct. You've added capital letters when you shouldn't have.

    Do you want to include the username in the same field as the date, or separately?