14 Replies Latest reply on Sep 2, 2016 2:13 AM by Vinothmannu

    Dropdown Menu for Dynamic Stamps

    hayko1993

      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,

        • 1. Re: Dropdown Menu for Dynamic Stamps
          JoelGeraci_Datalogics Level 3

          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-

          • 2. Re: Dropdown Menu for Dynamic Stamps
            Vinothmannu Level 1

            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

            • 3. Re: Dropdown Menu for Dynamic Stamps
              try67 MVP & Adobe Community Professional

              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.

              • 4. Re: Dropdown Menu for Dynamic Stamps
                Vinothmannu Level 1

                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

                • 5. Re: Dropdown Menu for Dynamic Stamps
                  try67 MVP & Adobe Community Professional

                  Yes, that's possible.

                   

                  Add this function inside your dialog's definition:

                   

                  initialize: function (dialog) {
                      dialog.load({
                          "stxt": "TEST123"
                      });
                  },
                  
                  • 6. Re: Dropdown Menu for Dynamic Stamps
                    try67 MVP & Adobe Community Professional

                    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");
                    
                    • 7. Re: Dropdown Menu for Dynamic Stamps
                      JoelGeraci_Datalogics Level 3

                      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-

                      • 8. Re: Dropdown Menu for Dynamic Stamps
                        formsdoctor Level 1

                        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.

                        • 9. Re: Dropdown Menu for Dynamic Stamps
                          formsdoctor Level 1

                          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.

                          • 10. Re: Dropdown Menu for Dynamic Stamps
                            Vinothmannu Level 1

                            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

                            1 person found this helpful
                            • 11. Re: Dropdown Menu for Dynamic Stamps
                              try67 MVP & Adobe Community Professional

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

                              • 12. Re: Dropdown Menu for Dynamic Stamps
                                Vinothmannu Level 1

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

                                • 13. Re: Dropdown Menu for Dynamic Stamps
                                  try67 MVP & Adobe Community Professional

                                  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.

                                  • 14. Re: Dropdown Menu for Dynamic Stamps
                                    Vinothmannu Level 1

                                    Thanks,

                                     

                                    By using page template i have added the pages.

                                     

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

                                     

                                    Regards,

                                    Vinoth

                                    1 person found this helpful