Copy link to clipboard
Copied
Created a dynamic stamp to pull the author name (identity name) and current date and time. When the stamp is placed nothing happens...took script from a youtube video and customized it. Nothing. Then canceled script and went into each field and put script...nothing. I am a beginner so I apologize for the childlike description.
if((event.source.forReal)&&(event.source.stampName == "#CustomerService"))
{
this.getField("Reviewer").value = identity.name;
this.getField("Datetime").value = util.printd("m/d/yyyy h:mm tt", new Date());
}
2 Correct answers
...in fact if you only need to fill both fields, you don't need all this script!
For the "Reviewer" field:
event.value=identity.name;
and for the "Datetime" field:
event.value=util.printd("m/d/yyyy h:mm tt", new Date());
Try my attached file to check.
@+
The "stamp manager" in Acrobat cannot be used with dynamic stamps, because it destroys all dynamic features.
Dynamic stamp files have to be managed manually.
Putting the code into the separate fields is the right way to go.
Also, as Bebarth suggested, the "if" statement is unnecessary. This "if" is only used when there is user interaction.
You can find more info at these links:
https://acrobatusers.com/tutorials/dynamic_stamp_secrets/
https://www.pdfscripting.com/public/All_About_PDF_Stamps.cfm
...Copy link to clipboard
Copied
There aren't any errors in your script, at least as long as the field names and the stamp name are correct.
When you edited the stamp to add the scripts,
1) did you add them to the custom calculation for each field?
2) Did you edit the dynamic stamp in the stamps folder? Or did you import the edited stamp into Acrobat using the stamp tools?
Take a look at the info here for more info on Acrobat Stamps.
https://www.pdfscripting.com/public/All_About_PDF_Stamps.cfm
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Thank you for your response!!!
1) I created a script field in the stamp itself. It didn't work
2) I then deleted the field and entered the code into each field's properties under calculate custom and the name still doesn't pull up and the datetime field shows the datetime when I inserted the original code
3)I saved it as a template and used the stamp manager to add the custom stamp to the stamps list. It appears but it isn't dynamic.
Copy link to clipboard
Copied
The "stamp manager" in Acrobat cannot be used with dynamic stamps, because it destroys all dynamic features.
Dynamic stamp files have to be managed manually.
Putting the code into the separate fields is the right way to go.
Also, as Bebarth suggested, the "if" statement is unnecessary. This "if" is only used when there is user interaction.
You can find more info at these links:
https://acrobatusers.com/tutorials/dynamic_stamp_secrets/
https://www.pdfscripting.com/public/All_About_PDF_Stamps.cfm
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Thank you! IT will have to place in the correct stamps folder for the user. I don't have access to customer service computers. I will let you know what happens!
Copy link to clipboard
Copied
Hi,
What is the name of the template?
@+
Copy link to clipboard
Copied
contact review stamp.pdf
Copy link to clipboard
Copied
I didn't mean the name of the file but the name of the template!
Following the answer you gave to Thom (3) it seems you don't get the right process...
Have a look on my previous answer and place the file into the "Stamps" folder of your Acrobat application.
@+
Copy link to clipboard
Copied
Contract Review Stamp is the name of the template. Refer to reply I gave to Thom. Thank you for your help!
Copy link to clipboard
Copied
How did you find the value for the stampName property?
Copy link to clipboard
Copied
control j
this.templates
and it gave me the #customerservice
Copy link to clipboard
Copied
Did you create the stamp file yourself, or did you create it via Acrobat's interface, and then edited it? Because that's not how Templates are named when you do it using the latter (which is the correct way of doing it).
Copy link to clipboard
Copied
...in fact if you only need to fill both fields, you don't need all this script!
For the "Reviewer" field:
event.value=identity.name;
and for the "Datetime" field:
event.value=util.printd("m/d/yyyy h:mm tt", new Date());
Try my attached file to check.
@+
Copy link to clipboard
Copied
Thank you very much!
Copy link to clipboard
Copied
The time stamp does not update for each new stamp I use. It stays at 2/19/2024 4:02pm eveytime. Is there a way to make the date/time update each stamp? Thanks!
Copy link to clipboard
Copied
@bebarth The time stamp does not update for each new stamp I use. It stays at 2/19/2024 4:02pm eveytime. Is there a way to make the date/time update each stamp? Thanks!
Copy link to clipboard
Copied
You must copy the file you download directly into the Stamps folder. Do NOT use the Stamp tool to create a new stamp from it.
Copy link to clipboard
Copied
@try67 sorry, im a beginner, I'm not sure I quite understand
Copy link to clipboard
Copied
Hi,
That means when you create a stamp with Acrobat, it is located in the Acrobat "Stamps" folder. And if you want to add a stamp you must to place the .pdf file of that stamp into that folder...
To find the path of that folder, you can run that script from the console window:
app.getPath("user", "stamps");
and if you want to try my stamp, place it into that folder.
@+
Copy link to clipboard
Copied
@bebarth Ahh I beleive I got it! The time is usually off about 2 to 20 minutes. Is that normal?
Copy link to clipboard
Copied
??? I guess it's the same time as your computer!
@+

