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

Dynamic Stamp Editable Text field

New Here ,
May 19, 2021 May 19, 2021

Good Morning, 

 

I do have the feeling that I am not very intelligent as I read through nearly every post that covers the topic of Dynamic Stamps and scripting.

 

In front of me I do have the book from Thom Parker - BUT I am not able to create the probably easiest stamp fild on earth. Fun fact, I managed to do a couple of years ago, but missed to save the script and the files.

 

So what have I done so far: 

 

Created the stamp I would like to have from an .eps (attached as .png)

2021_05_18_Stempel_Buchhaltung_PDF.png

Made a new Stamp from this file => this one is automatically entered in my Stamps folder (Mac). Than I gave it a new name "Buchhaltung.pdf". (and in Acrobat it has the same name and the same category name)

 

If I try to stamp with it, it works.

 

Now I would like to simple have the chance to enter values (as text) next to each field.

 

Therefore I open the PDF from the stamps folder and started to prepare a form.

 

Works great. The form fields are added automatically and I can enter the properies.

 

BUT whatever script I use (from all posts here), nothing happens? nothing. Acrobat is crashing, yes. And the file needs to be saved again asking for another location. But it does not work.

 

Shouldn't it be something like for the first field and respectively changed according the next field names:

 

if ((event.source.forReal)&&(event.source.stampName == "Buchhaltung")) { var cAsk = "Enter ER-NUMMER"; var cER-NUMMER = ""; event.value = app.response(cAsk, cER-NUMMER); }  

 

Maybe someone could help me please....I don't get it...

 

thx!

TOPICS
Acrobat SDK and JavaScript , Mac
1.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 1 Correct answer

Community Expert , May 19, 2021 May 19, 2021

The variable name with the hyphen in it, as I wrote before... In fact, you don't need variables at all for this.

Try this:

 

if (event.source && event.source.forReal && event.source.stampName == "#eYsqfchUk24Dutki_-O4SC") { 
	event.value = app.response("Enter ER-NUMMER:", "");
}
Translate
Community Expert ,
May 19, 2021 May 19, 2021

This is a common mistake. People think that the stampName property is the name of the file, or how it is called in the Stamp tool. It's not. It's an arbitrary string of characters that you can find out by applying the stamp to a page, then selecting it with the mouse and running this code from the JS console:

 

this.selectedAnnots[0].AP

 

Input the text that is printed to the console into your script and try again.

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
New Here ,
May 19, 2021 May 19, 2021

thanks try67!

 

so I found out the name - great!

 

and the script is at least giving a Syntax Error back?

 

Screenshot 2021-05-19 at 14.06.37.png

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 ,
May 19, 2021 May 19, 2021

You can't use a hyphen in the name of a variable.

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
New Here ,
May 19, 2021 May 19, 2021

ah okay, and what do I have to enter telling the script that it should open a box in which I can enter a text?

 

 

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
New Here ,
May 19, 2021 May 19, 2021

just ()?

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 ,
May 19, 2021 May 19, 2021

Use app.response(), like you're already doing...

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
New Here ,
May 19, 2021 May 19, 2021

ok, I think I will give up... would you mind to help me out and let me know the script?

 

if ((event.source.forReal)&&(event.source.stampName == "#eYsqfchUk24Dutki_-O4SC"))

 

{ var cAsk = "Enter ER-NUMMER"; var cER-NUMMER = ""; event.value = app.response(cAsk, cER-NUMMER); }

 

what should be deleted or changed? 

 

 

 

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 ,
May 19, 2021 May 19, 2021

The variable name with the hyphen in it, as I wrote before... In fact, you don't need variables at all for this.

Try this:

 

if (event.source && event.source.forReal && event.source.stampName == "#eYsqfchUk24Dutki_-O4SC") { 
	event.value = app.response("Enter ER-NUMMER:", "");
}
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
New Here ,
May 19, 2021 May 19, 2021
LATEST

ok, now that...uff....many many 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