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

Dropdown Menu for Dynamic Stamps

New Here ,
Aug 31, 2016 Aug 31, 2016

Copy link to clipboard

Copied

Hello, I've been experimenting with dynamic stamps on Adobe Acrobat Pro recently and I've been able to figure out how to make a few things work but I'm stuck with Drop-Down lists. I want a stamp that when applied, gives the user a drop-down list of 4 items (5200250, 5200254, 5212254, or 5221254). I'm not sure what Javascript codes I must enter under "calculations" to get this to work.

Any help would be greatly appreciated.

Thank you,

TOPICS
Acrobat SDK and JavaScript

Views

3.6K

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
Engaged ,
Aug 31, 2016 Aug 31, 2016

Copy link to clipboard

Copied

Stamps aren't interactive. Once applied, they are what they are until you reset their appearance. Assuming you want all or part of the stamp appearance to be the value of the drop down, you'll want to create a dialog box that has a drop down and then set the value of the field on the stamp to the value of the dropdown. When the user selects the stamp and clicks on the page, the dialog will appear where they can select from the dropdown, once they click OK, the stamp gets applied with the value they selected.

Google "Thom Parker Dynamic Stamps" and you should see a book and a few articles that will get you started.

J-

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
Explorer ,
Sep 01, 2016 Sep 01, 2016

Copy link to clipboard

Copied

Hi All,

If i create stamp Id --- TEST123 can the same word would be replicated in the stamp comments. Is this is possible.

Regards,

Vinoth

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 ,
Sep 01, 2016 Sep 01, 2016

Copy link to clipboard

Copied

I don't believe that's possible because at the moment you can run the script to do it the new annotation doesn't exist yet.

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
Explorer ,
Sep 01, 2016 Sep 01, 2016

Copy link to clipboard

Copied

Thanks for replying.

Any other method !!!!

I checked with exhibit stamps where we could give inputs as numbers, is there is any possible where we could give standard text.

My requirement is in the dialog box i should have standard text for example "TEST123" my user who uses the stamp while clicking he should get the same text as input and if needed he could change the text as "TEST1234" which would be stamped in the pdf.

var dialog = {

  retString: "",

  commit:function (dialog) { // called when OK pressed

    var results = dialog.store();

    this.retString = results["stxt"];

  },

  description:

  {

    name: "Stamp Information",    // Dialog box title

    elements:

    [

      {

        type: "view",

        elements:

        [

          {

            name: "Enter Multi-line Information: ",

            type: "static_text",

          },

          {

            item_id: "stxt",

            type: "edit_text",

            multiline: true,

            width: 300,

            height: 80

          },

          {

            type: "ok_cancel",

            ok_name: "Ok",

            cancel_name: "Cancel"

          },

        ]

      },

    ]

  }

};

{

  if ("ok" == app.execDialog(dialog))

  {

    var cMsg = dialog.retString;

    event.value = cMsg;

    event.source.source.info.exhibit = cMsg;

  }

}

At this dialog i need "TEST123"  to be appear?

Regards,

Vinoth

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 ,
Sep 01, 2016 Sep 01, 2016

Copy link to clipboard

Copied

Yes, that's possible.

Add this function inside your dialog's definition:

initialize: function (dialog) {

    dialog.load({

        "stxt": "TEST123"

    });

},

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 ,
Sep 01, 2016 Sep 01, 2016

Copy link to clipboard

Copied

By the way, if you only need to get one text value from the user you can simply use a simple app.response command instead of the dialog... That entire code can be replaced by this:

var cMsg = app.response("Enter Exhibit Number:", "", "TEST123");

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 ,
Jul 17, 2020 Jul 17, 2020

Copy link to clipboard

Copied

Hi All,

 

For the above example, is it possible to display in the dialog window the value which we enter, instead of default value 'TEST123'?

Example: If I fill the Exhibit Number : 123456 and click OK button and save the PDF form .. again if I open the PDF and open the above dialog box the previous value 123456 should apper. 

 

Regards,

Suneel

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
Explorer ,
Jul 17, 2020 Jul 17, 2020

Copy link to clipboard

Copied

LATEST

Hi All,

 

For the above example, is it possible to display in the dialog window the value which we enter earlier, instead of default value 'TEST123' ever time?

Example: If I fill the Exhibit Number : 123456 and click OK button and save the PDF form .. again if I open the PDF and open the above dialog box the previous value 123456 should appear. 

 

Regards,

Suneel

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
Engaged ,
Sep 01, 2016 Sep 01, 2016

Copy link to clipboard

Copied

It's possible. What you need to do is define a function that gets all the comments and sorts them by creation date, grab the newest one and populate it's content property with the value you want. Then in the stamp script, use that function as the function in app.setTimeOut and set the time period to something like 1/4 or 1/2 second. The stamp will have time to get added but the user won't have enough time to add another stamp.

It's not pretty but it works.

J-

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
Participant ,
Sep 01, 2016 Sep 01, 2016

Copy link to clipboard

Copied

If this works you don't need to get all of the comments and sort them by creation date, you just need to get the last annotation:

getAnnots()[getAnnots().length-1]

and write to that annotation.

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
Explorer ,
Sep 02, 2016 Sep 02, 2016

Copy link to clipboard

Copied

Hi try 67,

  1. initialize: function (dialog) { 
  2.     dialog.load({ 
  3.         "stxt": "TEST123" 
  4.     }); 
  5. }, 

This works well for me.

I need to attach few pages in the pdf would it be possible in the Exibit stamps, i have tried and created new stamps,

Its not working for me.

Shared Files - Acrobat.com

Regards,

Vinoth

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 ,
Sep 02, 2016 Sep 02, 2016

Copy link to clipboard

Copied

Sorry, I don't quite understand what you mean...

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
Explorer ,
Sep 02, 2016 Sep 02, 2016

Copy link to clipboard

Copied

I am trying to add some more pages in existing exhibit stamp. but its not working.

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 ,
Sep 02, 2016 Sep 02, 2016

Copy link to clipboard

Copied

You can't more pages directly (unless you copy them from another stamp).

You need to use the Create Stamp command under the Stamp tool and the pages will be added for you.

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
Explorer ,
Sep 02, 2016 Sep 02, 2016

Copy link to clipboard

Copied

Thanks,

By using page template i have added the pages.

Thanks for script it was really useful for me to research.

Regards,

Vinoth

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
Participant ,
Sep 01, 2016 Sep 01, 2016

Copy link to clipboard

Copied

Stamp scripts run in a narrow time frame between when you click to apply the stamp and when the application is completed.  During this time you can read from the source document and write to the source document using event.source.source.  The script can't continue after the stamp is applied to the source document, and if it did it is no longer event.source.source but "this".  If you use "this" to identify the doc in a stamp calculation it is referring to the stamp file PDF and not the source document.  You would need write a script to the source document when the stamp is applied but since applied stamps don't have interactive properties like form fields you can't use 'mouseup' or 'onblur' or anything like that.  You can add a document level script using addScript but this script will run in the source document before the stamp application is finished, so (as stated by another commentator) the annotation does not yet exist in the source document, so it wouldn't work.  One thing you can do is have the stamp script create a transparent button field on the source document that covers the entire page and has a mouseup action that will:

1)  Enter the contents of the stamp.

2)  Remove the button field.

This will work as long as the use knows to click anywhere on the page after the stamp is applied.

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