Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
2

Dynamic stamp with author of pdf and date and time

Community Beginner ,
Mar 09, 2023 Mar 09, 2023

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());

}

TOPICS
Acrobat SDK and JavaScript , Windows
5.4K
Translate
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

correct answers 2 Correct answers

Community Expert , Mar 10, 2023 Mar 10, 2023

...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.

Capture_d’écran_2023-03-10_à_11_45_39.pngexpand imageCapture_d’écran_2023-03-10_à_11_45_52.pngexpand image

@+

Translate
Community Expert , Mar 10, 2023 Mar 10, 2023

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

...
Translate
Community Expert ,
Mar 09, 2023 Mar 09, 2023

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

 

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

Translate
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 ,
Mar 10, 2023 Mar 10, 2023

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.

Translate
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 Expert ,
Mar 10, 2023 Mar 10, 2023

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

 

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

Translate
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 ,
Mar 10, 2023 Mar 10, 2023

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!

Translate
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 Expert ,
Mar 09, 2023 Mar 09, 2023

Hi,

What is the name of the template?

@+

Translate
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 ,
Mar 10, 2023 Mar 10, 2023

contact review stamp.pdf

Translate
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 Expert ,
Mar 10, 2023 Mar 10, 2023

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.

@+

Translate
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 ,
Mar 10, 2023 Mar 10, 2023

Contract Review Stamp is the name of the template.  Refer to reply I gave to Thom.  Thank you for your help!

Translate
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 Expert ,
Mar 10, 2023 Mar 10, 2023

How did you find the value for the stampName property?

Translate
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 ,
Mar 10, 2023 Mar 10, 2023

control j

this.templates 

and it gave me the #customerservice

Translate
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 Expert ,
Mar 12, 2023 Mar 12, 2023

 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).

Translate
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 Expert ,
Mar 10, 2023 Mar 10, 2023

...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.

Capture_d’écran_2023-03-10_à_11_45_39.pngexpand imageCapture_d’écran_2023-03-10_à_11_45_52.pngexpand image

@+

Translate
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 ,
Mar 14, 2023 Mar 14, 2023

Thank you very much!

Translate
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
Explorer ,
Feb 19, 2024 Feb 19, 2024

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!

Translate
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
Explorer ,
Feb 19, 2024 Feb 19, 2024

@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!

Translate
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 Expert ,
Feb 19, 2024 Feb 19, 2024

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.

Translate
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
Explorer ,
Feb 19, 2024 Feb 19, 2024

@try67 sorry, im a beginner, I'm not sure I quite understand

Translate
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 Expert ,
Feb 19, 2024 Feb 19, 2024

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.

@+

Translate
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
Explorer ,
Feb 20, 2024 Feb 20, 2024

@bebarth Ahh I beleive I got it! The time is usually off about 2 to 20 minutes. Is that normal? 

Translate
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 Expert ,
Feb 20, 2024 Feb 20, 2024
LATEST

??? I guess it's the same time as your computer!

@+

Translate
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