Dynamica Counting Stamps

Good Mornign Mr. Parker,
I'm writing you because I'm stuck in creating my dynamic stamps.
I already read your message here http://answers.acrobatusers.com/dynam... and I use your Java Script string for my stamp, is what I need!

Unfortunately, when I use my stamp no text is printed, and I'm left with a empty red box!

Could you please help me to resolve my problem? I'm very very new to dynamic stamp and java scripting, and since I'm not english skilled (as you can read!) I have some problem with the guide around the site... I mean... I understand something right and something wrong!

Hope to receive your reply as soon as possible, thanks in advance, best regards,
Luca

PS: This is the JS I use:

var oDoc = event.source.source;
if(typeof(oDoc.stampCounter) == "#PtD9bgDlWH_nyWNeW8UJ7D")
oDoc.stampCounter = 0;

oDoc.stampCounter++;


Luca Carrer


4 Answers

There is one obvious problem here: You are comparing the typeof your counter variable with the name of your stamp - these two things have nothing to do with each other. In the original script, the line

if(typeof(oDoc.stampCounter) == "undefined")

is trying to determine if the variable has been created. If it does not exist yet, then the next line

oDoc.stampCounter = 0;

will initialize it to zero.

You need to go back to the dynamic stamp basics to get a better understanding of how dynamic stamps work. The best way to learn is Thom's book: http://www.pdfscripting.com/public/All-About-PDF-Stamps-in-Acrobat-and-Paperless-Workflows-The-Book.cfm

Is the JavaScript you've posted your whole script? If so, there is a lot missing that is necessary to create a dynamic stamp.

Karl Heinz Kremer
PDF Acrobatics Without a Net
PDF Software Development, Training and More...
http://www.khkonsulting.com


Karl Heinz Kremer   

Dear Mr Heinz Kremer,
thanks for your kindly reply, as you thought you are right, that's the only java code I put in the script. I already correct the "undefined" problem... stupid change made by myself! Thanks for notice it!

Anyway, the problem is that I'm not a programmer, and so I would like to know if there are some out of the box solutions for my case. Don't think I'm lazy, I just don't have the skill to understand programming languages... you know... it's not my business...

Therefore I'm asking to all of you if you have some code ready to work...
I just only need a stamp like the one in the link on my fist message! Hope to receive some positive feedbacks, thanks in advance for the support!

Best regards,
Luca


Luca Carrer   

You would need something like this as your calculation script for the calculated form field. You would have to change the stampName in the first line to match your stamp name:

if( event.source.forReal && (event.source.stampName == "#NumberStamp"))
{
    var oDoc = event.source.source;
    if(typeof(oDoc.stampCounter) == "undefined")
        oDoc.stampCounter = 0;

    oDoc.stampCounter++;
    event.value = oDoc.stampCounter;
}

Karl Heinz Kremer
PDF Acrobatics Without a Net
PDF Software Development, Training and More...
http://www.khkonsulting.com


Karl Heinz Kremer   

Thanks for you reply Mr. Heinz Kreme, I appreciate the effort you put in resolve my problem, but unfortunately it seems that I'm not able to make it working. Always a blank box (the box I draw for my stamp) and nothing else... I don't know what is missing... really... for sure I made some mistake... don't know what else to do thought. Is there a way to submit the file of the stamp?
Thanks for your help!


Luca Carrer   


Please specify a reason: