36 Replies Latest reply on May 11, 2017 10:33 AM by testt70366819

    Custom Text Field in a Dymanic Stamp

    brianvander Level 1

      Im creating a new dymanic custom stamp, but instead of the date/time, when inserted, I need to then manually enter text into the dymanic text field.

       

      How do I change the script in the dymanic feild of the stamp to do that?

       

      Thanks

      BrianV

      Acrobat 8.0 Pro

      Win XP Pro

        • 1. Re: Custom Text Field in a Dynamic Stamp
          gkaiseril MVP & Adobe Community Professional

          Have  you been able to create the dynamic stamp?

           

          If so use the 'app.response()' method in the stamps 'custom calculation script to prompt the input value.

          1 person found this helpful
          • 2. Re: Custom Text Field in a Dymanic Stamp
            try67 MVP & Adobe Community Professional

            You will have to prompt the user to enter the text just before the stamp is

            applied, because once it is, it can't be changed anymore.

            1 person found this helpful
            • 3. Re: Custom Text Field in a Dymanic Stamp
              brianvander Level 1

              Thanks, yes I understand that I need to prompt the user,but in the text field properties, I see that option, so how do I make that happen.

               

              Then for the script, where do insert that script?  In the custom calculation script on the Calcualte Tab?

               

              Thanks for the assistance, I have never done anything like this before.

               

              Thanks

              BrianV

              • 4. Re: Custom Text Field in a Dynamic Stamp
                brianvander Level 1

                Yes, I created the image in Word, then created the pdf.   Then in Acrobat,I created a Custom Stamp, retrieved the pdf image that I created from Word, and saved it as a customn stamp.  I then opened that file (C:\<USER FOLDER>\application data\adobe\acrobat\8.0\Stamps...) and also opened a Dymanic stamp as well.  I then copied the Dymanic Date/Time field and inserted it into my stamp (Submittal) and tested on a pdf doc.  My Submittal Stamp w/ the Date/Time feild worked.

                 

                I then reopened my Submittal Stamp and edited the Text Feild Properties and changed the Custom Calculation Script to 'app.response()' (and to be clear yes I do use the quotation markers) saved the script and tried it, to which it did not prompt me to enter data.

                 

                I then edited the script by removing the quotation markers, which I got a "Warning: JavaScript Window - ECMAScript" Dialog box.

                 

                So thats where Im at....

                 

                A sample of what I need.   The section I want the stamp to prompt the user to input is the boxed area (but not outline)Complies_w_Submittal-temp.jpg

                Thanks

                BrianV

                • 5. Re: Custom Text Field in a Dynamic Stamp
                  gkaiseril MVP & Adobe Community Professional

                  If you want to get rid of the waring, you are going to have to write a differnt script.

                   

                  The 'app.repsonse()' method has a number of parameters to enter so one can have a question, a title, a default value, be treat as a password field, or have a label appear befor the response line.

                   

                  Have you looked at the Acrobat JavaScirpt API Reference?

                   

                  var cResponse = app.response({
                  cQuestion: "Enter the section number to appear in the stamp.",
                  cTitle: "Section Number",
                  cLabel: "Section Number:"
                  });
                  if (cResponse == null)
                  app.alert("Thanks for trying anyway.");
                  else
                  app.alert("You responded, \""+cResponse+"\", to the section number "
                  + "question.",3);
                  • 6. Re: Custom Text Field in a Dynamic Stamp
                    brianvander Level 1

                    thanks for the assistance... I think were close...

                     

                    I downloaded the API referecence, but to tell ya, it quickly overwhelmed me.   I also then inputed your code, which brought up the dialog box, but after I entered in the data into the dialog box and it placed the stamp, the dymanic text did not appear, it was a blank stamp (excluding the stamps text "This Product Submittal...)

                     

                    Also question, the Dialog box that appeared was titled "Warning JavaScript Window - Section Number"  how do we get rid of the "Warning Java Script Window"?  or did i miss type something...

                     

                    and then when selecting OK, do we have to have another dialog box appear, or can we just have the stamp inserted then after this Section Number Dialog Box?.

                     

                    Warning.jpg

                    Again thanks for the assistance, I really appreciate it.

                     

                    BrianV

                    • 7. Re: Custom Text Field in a Dynamic Stamp
                      gkaiseril MVP & Adobe Community Professional

                      You need to adjust the script to handle a null entry (nothing) or cancel and setting the value.

                       

                      var cResponse = app.response({
                      cQuestion: "Enter the section number to appear in the stamp.",
                      cTitle: "Section Number",
                      cLabel: "Section Number:"
                      });
                      if (cResponse == null) {
                      event.value = "*NVALID*";

                      }

                      else
                      event.value = cResponse;

                       

                      You can only remove the 'Warning JavaScirpt" is by creating a special application folder script for the 'app.response' method that uses the 'trustedFuncton' to suppress this security warning. Then in you form, you will need to test for this function and either issue a warning about the missing function or run the 'app.response' code and live with the warning. Each system will need the special application folder script installed on it.

                      1 person found this helpful
                      • 8. Re: Custom Text Field in a Dynamic Stamp
                        lorne17 Level 1

                        Hello there,

                         

                        I am trying to create a similar stamp.  It's a simple circle with a custom number in it as the user places it.  I have used the code above and when I am editing the Custom Calculation Script it prompts me for the number to appear in the stamp.

                         

                        However when I place that stamp into a PDF it doesn't ask me for the number input?  Can someone help me figure out what is wrong?

                         

                        This is my script:

                         

                        var cResponse = app.response({

                        cQuestion: "Enter the number to appear in the stamp.",

                        cTitle: "Number",

                        cLabel: "Number:"

                        });

                        if (cResponse == null) {

                        event.value = "*NVALID*";

                        }

                        else

                        event.value = cResponse;

                         

                        Thank,

                        Lorne

                        • 9. Re: Custom Text Field in a Dynamic Stamp
                          try67 MVP & Adobe Community Professional

                          Did you create the stamp, and then edited the stamp PDF file and added the field to it with this script, or did you first create a PDF with the field, and then created a stamp from that?

                          • 10. Re: Custom Text Field in a Dynamic Stamp
                            lorne17 Level 1

                            The latter.  I created the PDF first.  Do I need to create the stamp then add this field?

                            • 12. Re: Custom Text Field in a Dymanic Stamp
                              bennaudio Level 1

                              FROM DebRif: in Help with Dynamic Stamp

                               

                              After a few deep breathes and a little more research, I finally got it to work! AHHHH SUCCESS!!!!

                              Just in case any other newbie like me ever needs it....

                               

                              var cAsk = "Enter Bulletin Number" ;

                              var cTitle = "Bulletin Number:  ";

                              if(event.source.forReal && (event.source.stampName == "#4-T8yKAAEuISpm9hHP0NdD"))

                              {

                                var cMsg = app.response(cAsk, cTitle);

                                event.value = cMsg;

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

                              }

                               

                              Thank for all the help!!!!!

                              Im sure i will be back

                              -

                              My additional Notes:

                              To add more clarification to this super fun stamps game I've been trying to play for the better part of 2 or 3 days now, going to try to blurt this out quickly so I can get dinner.

                              Here is a solution to adding all the stamps you used to have into new Acrobat (as the whole "just copy the file into the Roaming Acrobat Stamps folder" didn't do anything for me)

                              in Acrobat, create a new custom stamp, with whatever, this results in the crazy file name in the user stamp folder.

                              Take your old stamps file, rename it to this file name, (and put into the Title field of that acrobat properties the Name of the Stamps you'd like them to be contained under, this will be what shows up when you bring up the stamp tool.

                              And the whole dynamic stamp gobblygook above with the #crapblahsputting name, do away with that to make java and forms easier by opening page templates and just going through and making sure the pages in your file are accounted for and if you have the #crazyname then change it to something like #KISS=Keep it Simple Stupid (the Keep it Simple Stupid, will be what shows up if you were to show Stamp Names in Acrobat) and now when you try to do other Forms Java scripting you can just say event.source.stampName == "#KISS" and life will be easier

                              Also in the organize page menu drag the files around so they can be in a better order than just how you added them into Stamp originally.

                              You can drag in new files to this stamp file as well in the future too, just be sure to go to the page templates and get that page a name, #KISS2=Keep it Simple Squared

                              I hope this also saves someone the frustration of this Stamp world, I'm sure that now that I've FINALLY figured it out, Adobe will remove the feature.

                              • 13. Re: Custom Text Field in a Dymanic Stamp
                                sunshinevaughn2011 Level 1

                                Could someone help this newbie to code writing (aka me...lol) with a code to use in my dynamic stamp?  Below is what my stamp looks like and I need to be able to fill in each field with text when I go to stamp it.  So I know I need a fillable stamp but cant seem to find the code I need to put into my properties box.

                                Thanks everyone!!

                                Sunshine

                                • 14. Re: Custom Text Field in a Dymanic Stamp
                                  Karl Heinz Kremer Adobe Community Professional

                                  Have you looked at the tutorial link posted earlier? If you are just starting with JavaScript in general and Acrobat's implementation, you have a steep learning curve to climb. I would not recommend creating custom dynamic stamps as a good first task for somebody just starting out. If you really want to dive into this, do yourself a favor and get Thom Parker's book about custom dynamic stamps (see the link for more information). Also, you may want to get an introduction into Acrobat's JavaScript (the book here is a good start: Beginning JavaScript for Adobe Acrobat - make sure you get the PDF and not the Kindle book, they are different).

                                   

                                  The biggest problem you will have is to create a dialog in JavaScript that asks your users for the information that goes on the stamp. All this is documented in the Acrobat Javascript API documentation (which is part of the SDK), but again, this is not something I would think a beginner should tackle. You may be better off paying somebody to create this stamp for you.

                                  • 15. Re: Custom Text Field in a Dymanic Stamp
                                    gkaiseril MVP & Adobe Community Professional

                                    If the data being asked for is in fields on the stamp, one can use JavaScript to get the values of the form data into the stamp.

                                     

                                    Thom Parker has All About Stamps in Acrobat as an eBook available on Amazon the covers stamps and dynamic stamps.

                                     

                                    PDF Scripting Videos has "Stamps Gone Wild" which demonstrates how powerful dynamic stamps can be when done by an expert.

                                    • 16. Re: Custom Text Field in a Dymanic Stamp
                                      katieq87842273 Level 1

                                      I tried this script, tailored to what I need, but when I go to use it there is a pop up window that states: bad parameter. Then another pop up: An internal error occurred and the stamp does not work.

                                       

                                      Just trying to have stamp ask for the permit # in which I would enter manually.

                                       

                                      I've tried several different javascripts and I get an error every time.

                                      var cAsk = "Enter Permit Number" ;

                                      var cTitle = "Permit Number:" ;

                                      if(event.source.forReal && (event.source.stampName == "#S66odgkjrJZVKXipDUzNND"))

                                      {

                                        var cMsg = app.response(cAsk, cTitle);

                                        event.value = cMsg;

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

                                      }

                                      • 17. Re: Custom Text Field in a Dymanic Stamp
                                        smitha15 Level 1

                                        So, I do not know how to do Java anything. I cheated. I was trying to make a stamp that I could enter multiple lines of information for a submittal stamp. Check marks, text, date, initials, et cetera. This is how I got around this:

                                         

                                        I followed all of the steps, created my dynamic stamp and then went in and edited it into a form. Once I got to the java part I just couldn't figure it out. What I ended up doing is going in and editing the stamp file each time I need to use it. Basically, I go in and add the appropriate date and check marks then save the stamp and place it onto my pdf. Once I save the pdf the stamp wont update, which is fine because I want each file to have its own date and check mark info, obviously.

                                         

                                        Other than this being a complete cop out, anyone see how this could become a problem later on?

                                        • 18. Re: Custom Text Field in a Dymanic Stamp
                                          Karl Heinz Kremer Adobe Community Professional

                                          The problem is that it takes you longer to place your stamp when you need to edit the information manually. If you can live with that, you can continue to do this. If you want a more straight forward workflow, you may want to consider fixing your problem. Cheating never pays - but we can very likely help you to get your stamp working. BTW: This is about JavaScript, not Java - even though the two names sound very similar, you are dealing with two completely different technologies. This is important when you search for information. By just searching for Java solutions, you will invite even more problems and frustration.

                                           

                                          Please show the JavaScript code you are using, and we will try to point you in the right direction.

                                          • 19. Re: Custom Text Field in a Dymanic Stamp
                                            smitha15 Level 1

                                            Fair enough. Cheating never pays and efficient is better. But at a certain point the amount of time it would take to figure it out for me out weighs the time it would take to just edit the stamp.

                                             

                                            I don't have JavaScript to show, I was just trying to copy and paste different examples from above to see if I could get any of them to work. When I said I don't know anything about Java - that's a good indicator that I don't even know the difference between Java and Javascript or even the basics of what any of the scripts are doing.

                                             

                                            I don't know where to begin: How do I make the stamp prompt me to enter text? Check boxes? How would I differentiate between which information it is prompting me for? How would I tell it no check, or check? Where do I put the script? Do I place the script in each form field? Is it as simple as copy and paste?

                                             

                                            Also, how do I make my stamp have a white background, or is that just a setting in my original pdf?  I drew the stamp in autocad, so I could just put a solid white hatch in it but I would prefer to not start over. 

                                            • 20. Re: Custom Text Field in a Dymanic Stamp
                                              antoinem69963430 Level 1

                                              Hello all,

                                              I'm also trying to create a custom stamp wich will be really simple, same king of stamp as lorne17 wanted.

                                               

                                              basicly a square in which i want to insert a number in a text field.

                                              the number will have to be chosen by the user through a pop up.

                                               

                                              I've read all your posts by i could'nt manage to do it.

                                               

                                              I must say i'm a very begginer in scripts and java (it's the first time i use the langage.)

                                               

                                              I just managed to get the title of my stamp, and i don't understand anything at codes, I can only manage to copy and paste and see if it works.

                                               

                                              Could you please give me a hand.

                                               

                                              thanks very much for your help and sorry for my english with is as poor as my knowledge in java.

                                               

                                              regards

                                               

                                              Antoine

                                              • 21. Re: Custom Text Field in a Dymanic Stamp
                                                Karl Heinz Kremer Adobe Community Professional

                                                You are dealing with "JavaScript" not "Java" - similar name, but very different programming language. This is important when you look for help online.

                                                 

                                                Have you looked at Thom Parker's excellent introduction on AcrobatUsers.com? The link was posted previously in this thread, but here it is again: https://acrobatusers.com/tutorials/dynamic_stamp_secrets

                                                 

                                                This should explain the process you need to follow to create your stamp. The Acrobat SDK function "app.response()" is what you would need to get one user provided string into your stamp. If you want to ask for multiple pieces of information, it's usually better to create a custom dialog, but for your purposes, what this tutorial shows should be sufficient.

                                                 

                                                Once you are through the tutorial, and you still have questions, please post them here.

                                                • 22. Re: Custom Text Field in a Dymanic Stamp
                                                  antoinem69963430 Level 1

                                                  Thanks for your answer

                                                   

                                                  I'm trying to use the only part of the following stamp wich creates the pop up :

                                                   

                                                   

                                                  in the textfield in my stam, I replaced the bold fields of the following code  by my documents propertys or text i wanted to insert and I erased the strickout text as follow, but nothing works when i put my stamp.

                                                   

                                                  var cAsk = "Enter One of: Approved, Rejected, or In Process";

                                                  var cTitle = "Document State For Stamp";

                                                   

                                                  if(event.source.forReal &&

                                                    (event.source.stampName == "#UdzyXagRctZoS5p43TZ43C"))

                                                  {

                                                    var cMsg = app.response(cAsk, cTitle);

                                                    cMsg += " : " + util.printd("mm/dd/yyyy", new Date());

                                                    event.value = cMsg;

                                                    event.source.source.info.DocumentState = cMsg;

                                                   

                                                  }

                                                   

                                                  I'm not so sure if i need to set metadata, i don't really understant what it means and what's the aim of that function.

                                                   

                                                  I just want the user to be abble to indicate a number every time he put the stamp. the number would change dependinf on the document.

                                                   

                                                  Thans in advance for your help

                                                  • 23. Re: Custom Text Field in a Dymanic Stamp
                                                    try67 MVP & Adobe Community Professional

                                                    You removed the wrong lines inside the curly brackets. Use just this code:

                                                    var cMsg = app.response(cAsk);

                                                    event.value = cMsg;

                                                     

                                                    Also, you will need to update the value of the stampName to match that of your file.

                                                    1 person found this helpful
                                                    • 24. Re: Custom Text Field in a Dymanic Stamp
                                                      antoinem69963430 Level 1

                                                      Thanks very much it works perfectly.

                                                      • 25. Re: Custom Text Field in a Dymanic Stamp
                                                        mitchh58794677 Level 1

                                                        I am running the below code but nothing happens when I place the stamp? any thoughts why?

                                                         

                                                        var cAsk = "Enter Order Number" ;

                                                         

                                                        if(event.source.forReal && (event.source.stampName == "13SSPjT6lc3sg3x84aYTvD"))

                                                        {

                                                          var cMsg = app.response(cAsk);

                                                          event.value = cMsg;

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

                                                        }

                                                        • 26. Re: Custom Text Field in a Dymanic Stamp
                                                          George_Johnson MVP & Adobe Community Professional

                                                          In order for that to work, the actual stamp name has to match what the script is expecting (13SSPjT6lc3sg3x84aYTvD). Have you confirmed that it's correct?

                                                          • 27. Re: Custom Text Field in a Dymanic Stamp
                                                            mitchh58794677 Level 1

                                                            No sorry I am learning that this number is very difficult to find with adobe DC standard. Any suggestions?

                                                            • 28. Re: Custom Text Field in a Dymanic Stamp
                                                              George_Johnson MVP & Adobe Community Professional

                                                              One thing you can do is add a temporary button to one of the pages of the stamp file and add the following script to the Mouse Up event of the button:

                                                               

                                                              var aTemplates = this.templates;

                                                              if (aTemplates) app.alert(aTemplates.join("\r"));

                                                               

                                                              WHen you click the button, you should see at least one template name displayed, which will include the stamp name (the portion before the = character.) If more than one is shown you will have to figure out which one to use.

                                                              • 29. Re: Custom Text Field in a Dymanic Stamp
                                                                Karl Heinz Kremer Adobe Community Professional

                                                                This article presents a different method to get the stamp name (and there is never any question about which one is the correct one if you have multiple stamps): https://acrobatusers.com/tutorials/print/dynamic_stamp_secrets - scroll down to the section titled "The Stamp Name"

                                                                 

                                                                Just in case you are not aware of this, what you are tying to do will not work with the free Adobe Reader: You can only create/update custom properties in the "info" object with Adobe Acrobat Standard or Pro.

                                                                • 30. Re: Custom Text Field in a Dymanic Stamp
                                                                  mitchh58794677 Level 1

                                                                  That worked great. Thanks.

                                                                   

                                                                  Mitch Hansen

                                                                   

                                                                  [ Moderator: Personal information removed ]

                                                                  • 31. Re: Custom Text Field in a Dymanic Stamp
                                                                    johnc3927701 Level 1

                                                                    Hi all,

                                                                     

                                                                    I've been reading through this thread and all of this information has been very helpful. I've been able to add fields to my stamp, and even add hidden fields which will allow users to answer "Yes" to a question which will then automatically check a check box on the the stamp.

                                                                     

                                                                    The problem is, when I try and add a stamp to an existing document, these dialog boxes will come up when I hover over "Dynamic" and won't allow me to select a stamp. I've tried adding this following code, but when I do the dialog boxes never appear:

                                                                     

                                                                     

                                                                    if(event.source.forReal &&

                                                                      (event.source.stampName == "# _j0JCYhcAFQeflSUnRhoPA"))

                                                                     

                                                                    I've verified that the stamp name is correct. This is my current code (modified slightly for different boxes):

                                                                     

                                                                    var cAsk = "Enter the Submission#:";

                                                                    {

                                                                    var cMsg = app.response(cAsk);

                                                                    event.value = cMsg;

                                                                    }

                                                                     

                                                                    Since it looks like this thread is relatively active, I wanted to know if anyone had a suggestion. I'm using Acrobat X Standard v 10 if that matters.

                                                                     

                                                                    Thanks,

                                                                     

                                                                    John

                                                                    • 32. Re: Custom Text Field in a Dymanic Stamp
                                                                      try67 MVP & Adobe Community Professional

                                                                      How did you verify the stamp name?

                                                                       

                                                                      On Mon, Mar 13, 2017 at 6:15 PM, johnc3927701 <forums_noreply@adobe.com>

                                                                      • 33. Re: Custom Text Field in a Dymanic Stamp
                                                                        johnc3927701 Level 1

                                                                        Originally I went by the file name, but some more googling has revealed the stamp file name and the stamp name the script is looking for will not be the same.

                                                                         

                                                                        What is the best way to check the stamp name?

                                                                        • 34. Re: Custom Text Field in a Dymanic Stamp
                                                                          Karl Heinz Kremer Adobe Community Professional

                                                                          One thing you can do is output the stamp name to the console just before you test for the stamp name:

                                                                           

                                                                          console.println("Stamp name is " + event.source.stampName);
                                                                          

                                                                           

                                                                          Alternatively, you can select the stamp, and then execute the following code in the console

                                                                          this.selectedAnnots[0].AP

                                                                           

                                                                          You will find the last method here as well (plus a ton of other valuable information): https://acrobatusers.com/tutorials/print/dynamic_stamp_secrets

                                                                          • 35. Re: Custom Text Field in a Dymanic Stamp
                                                                            johnc3927701 Level 1

                                                                            Perfect, thanks for your help I'm all set.

                                                                            • 36. Re: Custom Text Field in a Dymanic Stamp
                                                                              testt70366819 Level 1

                                                                              Hello Karl,

                                                                               

                                                                              I've a question.

                                                                               

                                                                              I've created a dynamic stamp where the user has to fill in some information.
                                                                              Information like invoice number, Cost Center, filename, supplier, company....

                                                                               

                                                                              The first question is : I want to save the document with the filename the user has filled in.

                                                                              How can I do that ?

                                                                               

                                                                              The second question is : I want to save the document in the "company" directory.

                                                                              He has to choose the company from dropdown (in the stamp). So, I want to save the document in the "company" directory.

                                                                              The user has 3 "company's" possibilities A, B or C. When he choose for ex B then the document has to be saved in the B map.

                                                                               

                                                                              And the last question is : He also has to choose if the document is invoice or document. If it's a document then under the company (choose by stamp) under documents map. Else under company invoice map.

                                                                               

                                                                               

                                                                              mySaveAs.js file (located in the map program files"

                                                                               

                                                                              var mySaveAs = app.trustedFunction(

                                                                              function(oDoc,cPath,cFlName)

                                                                              {

                                                                              app.beginPriv();

                                                                              // Ensure path has trailing "/"

                                                                              //cPath = cPath.replace(/([^\/])$/, "$1/");

                                                                              cPath = "/c/temp/";

                                                                              try{

                                                                              oDoc.saveAs(cPath + cFlName);

                                                                              }catch(e){

                                                                              app.alert("Error During Save  " +e);

                                                                              }

                                                                              app.endPriv();

                                                                              });

                                                                               

                                                                              Is this file correct ?

                                                                               

                                                                              What and where do I have to fill in the code in the stamp under the "save" text field - calculate - custom calculation script.

                                                                              (because when I put a button I don't see that button.

                                                                               

                                                                              Using Adobe XI

                                                                               

                                                                              Thanks