Skip to main content
Participant
August 26, 2010
Question

Custom Text Field in a Dymanic Stamp

  • August 26, 2010
  • 9 replies
  • 72699 views

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

    This topic has been closed for replies.

    9 replies

    Participating Frequently
    June 26, 2018

    Hi,

    Is there anyone that has the same issue ?

    Thanks,

    Regards,


    Alex

    try67
    Community Expert
    Community Expert
    June 26, 2018

    Did you try the suggestions made above?

    Participating Frequently
    June 26, 2018

    Hi,


    Yes, it works fine.

    But, when I want to create another custom stamp and when I include this new stamp in the dynamic stamps category, it does not create a new pdf stamp file but it adds the new stamp to the first one. So, I cannot use them because they become one.

    Do you know why is it happening ?

    Thanks !

    Participating Frequently
    June 6, 2018

    Hi there,

    I allow myself to come back to this thread because I have an issue.


    I have managed to create the stamp and include the script and it works.

    But, whenever I open a new pdf and want to use a stamp, it does show the box, like if I had chosen the stamp but I did not : the stamp box is showing up as soon as I click on stamp without even selecting it.

    Did it happen to anyone ?

    Thanks for your help !

    Regards,

    try67
    Community Expert
    Community Expert
    June 6, 2018

    Post the full code you're using in the stamp, please.

    Participating Frequently
    June 6, 2018

    Hi,


    Thanks for your reply.

    Here it is:

    var cResponse = app.response({

    cQuestion: "Entrer la date à indiquer",

    cTitle: "Date",

    cLabel: "Date:"

    });

    if (cResponse == null) {

    event.value = "*NVALID*";

    }

    else

    event.value = cResponse;

    Thanks you,

    var cResponse = app.response({

    cQuestion: "Entrer la date à indiquer",

    cTitle: "Date",

    cLabel: "Date:"

    });

    if (cResponse == null) {

    event.value = "*NVALID*";

    }

    else

    event.value = cResponse;

    March 13, 2017

    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

    try67
    Community Expert
    Community Expert
    March 13, 2017

    How did you verify the stamp name?

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

    March 13, 2017

    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?

    mitchh58794677
    Participant
    January 3, 2017

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

    Inspiring
    January 3, 2017

    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.

    Karl Heinz  Kremer
    Community Expert
    Community Expert
    January 3, 2017

    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.

    mitchh58794677
    Participant
    January 3, 2017

    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;

    }

    Inspiring
    January 3, 2017

    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?

    Participant
    December 8, 2016

    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?

    Karl Heinz  Kremer
    Community Expert
    Community Expert
    December 8, 2016

    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.

    Participant
    December 8, 2016

    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. 

    Participant
    July 22, 2015

    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

    Karl Heinz  Kremer
    Community Expert
    Community Expert
    July 23, 2015

    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.

    Known Participant
    May 10, 2017

    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

    try67
    Community Expert
    Community Expert
    August 26, 2010

    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.

    Participant
    August 26, 2010

    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

    Inspiring
    August 26, 2010

    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.

    Participant
    August 26, 2010

    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)

    Thanks

    BrianV

    Inspiring
    August 26, 2010

    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);