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

Dynamic stamp not populating with the information

New Here ,
May 19, 2022 May 19, 2022

Copy link to clipboard

Copied

I'm creating my very first custom dynammic stamp to apply to exhibits used in court. 

I want the file name to automatically appear on the stamp. 

I've created the tesx field and added the following custom calculation script:

event.value = event.source.source.documentFileName.replace(".pdf", "");

Nothing happens when I apply the stamp to a document. The stamp appears, but no file name appears on the stamp.

Any suggestions as to what I've done wrong?

TOPICS
Acrobat SDK and JavaScript

Views

1.4K

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 Expert ,
May 19, 2022 May 19, 2022

Copy link to clipboard

Copied

Remove one source. What does you get?

Votes

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
New Here ,
May 20, 2022 May 20, 2022

Copy link to clipboard

Copied

If I remove one "source", I still get nothing.

Votes

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 Expert ,
May 20, 2022 May 20, 2022

Copy link to clipboard

Copied

Hi,

Your script seems correct. If you remove one "source" you should get the name of the stamp file.

To get the name of the stamp file, just type event.value=this.documentFileName;

Do you only have this script in your stamp? It's maybe an other one which stops this one.

...and just a suggestion, if you want to remove the .pdf extension you shoud write:

 

event.value = event.source.source.documentFileName.replace(/.pdf$/i, "");

 

This will remove only the extension and is case-insensitive.
Try my attached stamps...

@+

Votes

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
New Here ,
May 20, 2022 May 20, 2022

Copy link to clipboard

Copied

So good and bad news.

1st - this is the only script in my stamp;

2nd - if I replace what I had with: 

event.value = event.source.source.documentFileName.replace(/.pdf$/i, "");

I still get nothing. I was beginning to suspect that my stamps was just badly designed and not working, but I used:

event.value=this.documentFileName;

and the stamp populated with the name of the stamp file, which isn't my goal. However, I know the stamp is able to populate information, just not the information I'm looking for.

Votes

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 Expert ,
May 20, 2022 May 20, 2022

Copy link to clipboard

Copied

The code you're using is fine, so maybe the issue is with the stamp itself, or maybe you're not placing it in the correct place. Could you share your stamp file with us?

Votes

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
New Here ,
May 20, 2022 May 20, 2022

Copy link to clipboard

Copied

its undoubtedly my own fault, but its confusing because the script for the stamp filename worked, but not the others...

 

Here is the file.  Thanks

Votes

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 Expert ,
May 20, 2022 May 20, 2022

Copy link to clipboard

Copied

This is not what a stamp that was created in Acrobat looks like. Did you create it elsewhere, by any chance?

Votes

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 Expert ,
May 20, 2022 May 20, 2022

Copy link to clipboard

Copied

Sure, that should work!
Did you try my stamps file I shared, it's exactly the same script and it's working fine...

Capture_d’écran_2022-05-20_à_22_23_13.pngCapture d’écran 2022-05-20 à 22.23.35.png

Is it possible you share your stamp file? I will have a look...

@+

Votes

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 Expert ,
May 20, 2022 May 20, 2022

Copy link to clipboard

Copied

I think the stamp was not generated correctly.

Place this file in the stamps folder, it's working fine...

Capture_d’écran_2022-05-20_à_22_37_33.pngCapture d’écran 2022-05-20 à 22.37.56.png

@+

Votes

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
New Here ,
May 20, 2022 May 20, 2022

Copy link to clipboard

Copied

LATEST

Thank you soo much for your time. It was created using Adobe, but I can't even begin to describe why its messed up.

 

Your version works great!

Votes

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