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

Custom Text Field in a Dymanic Stamp

New Here ,
Aug 26, 2010 Aug 26, 2010

Copy link to clipboard

Copied

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

Views

68.9K

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
LEGEND ,
Aug 26, 2010 Aug 26, 2010

Copy link to clipboard

Copied

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.

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 ,
Aug 26, 2010 Aug 26, 2010

Copy link to clipboard

Copied

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

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
LEGEND ,
Aug 26, 2010 Aug 26, 2010

Copy link to clipboard

Copied

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

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 ,
Aug 26, 2010 Aug 26, 2010

Copy link to clipboard

Copied

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

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
LEGEND ,
Sep 08, 2010 Sep 08, 2010

Copy link to clipboard

Copied

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.

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 Beginner ,
Feb 17, 2012 Feb 17, 2012

Copy link to clipboard

Copied

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

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 ,
Feb 17, 2012 Feb 17, 2012

Copy link to clipboard

Copied

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?

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 Beginner ,
Feb 17, 2012 Feb 17, 2012

Copy link to clipboard

Copied

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

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 ,
Feb 17, 2012 Feb 17, 2012

Copy link to clipboard

Copied

Yes. See here for some more info: http://acrobatusers.com/tutorials/custom_dynamic_stamp

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 Beginner ,
Apr 16, 2015 Apr 16, 2015

Copy link to clipboard

Copied

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.

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 ,
Mar 08, 2016 Mar 08, 2016

Copy link to clipboard

Copied

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;

}

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 ,
Aug 26, 2010 Aug 26, 2010

Copy link to clipboard

Copied

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.

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 ,
Aug 26, 2010 Aug 26, 2010

Copy link to clipboard

Copied

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

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 22, 2015 Jul 22, 2015

Copy link to clipboard

Copied

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

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 ,
Jul 23, 2015 Jul 23, 2015

Copy link to clipboard

Copied

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.

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 ,
May 10, 2017 May 10, 2017

Copy link to clipboard

Copied

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

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
LEGEND ,
Jul 23, 2015 Jul 23, 2015

Copy link to clipboard

Copied

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.

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 ,
Dec 08, 2016 Dec 08, 2016

Copy link to clipboard

Copied

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?

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 ,
Dec 08, 2016 Dec 08, 2016

Copy link to clipboard

Copied

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.

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 ,
Dec 08, 2016 Dec 08, 2016

Copy link to clipboard

Copied

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. 

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 ,
Dec 21, 2016 Dec 21, 2016

Copy link to clipboard

Copied

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

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 ,
Dec 21, 2016 Dec 21, 2016

Copy link to clipboard

Copied

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.

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 ,
Dec 22, 2016 Dec 22, 2016

Copy link to clipboard

Copied

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

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 ,
Dec 22, 2016 Dec 22, 2016

Copy link to clipboard

Copied

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.

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