Skip to main content
kama999
Participant
Mar 22, 2016 5:36 AM UTC
Question

dynamic stamp with an incremental number

How to create a dynamic stamp with an incremental number every time I stamp in the PDF. This will be used by only one person and installed on a single computer. Thanks for your help in advance.

This topic is closed to new replies. Start a new post to keep the conversation going.

22 replies

Thom Parker
Community Expert
Community Expert
Dec 21, 2017 8:55 PM UTC

A global variable works, but I think a better option is to store the number value in "doc.info", so that last increment is persistent with the document. Meaning the stamp will always start off at the last increment, even when Acrobat is closed and reopened. It also makes it easy for you to set/change the increment by simply editing the values on the "Custom" tab of the Document Properties dialog.

The stamp script should be something like this:

event.value = ++event.source.source.info.myInc;

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
Jan 21, 2021 3:51 PM UTC

That seems to almost work. My problem is,that the stamp increases its value not only when stamping, but every time I even just hover the mouse over the stamp tool. Any way to prevent that? I need to only increment when actually stamping.

Translate
Bernd Alheit
Community Expert
Community Expert
Jan 21, 2021 5:08 PM UTC

What script does you use? Where does you use the script?

Translate
Participant
Dec 21, 2017 7:35 PM UTC

I just made a github of an auto-incrementing stamp set that should work:

GitHub - q335r49/AcrobatIncrementStamp: Auto-incrementing stamp for Acrobat

Translate
Participant
Jun 13, 2022 3:45 PM UTC

That works perfect if I use always the sane pdf file.
Is it possible that the stamp keeps in mind the last Number and when I open another pdf file it counts the "reminded" number and increments 1.
Thanks
Gerhard

Translate
Bernd Alheit
Community Expert
Community Expert
Jun 13, 2022 3:57 PM UTC

Use a global variable for the number.

Translate
Karl Heinz  Kremer
Community Expert
Community Expert
Mar 22, 2016 1:51 PM UTC

Take a look here for some more information about this subject: Auto Increment Exhibit Stamps - saving metadata to Stamp file (JavaScript)

Translate
try67
Community Expert
Community Expert
Mar 22, 2016 8:35 AM UTC

You would need to set up a persistent global variable that keeps track of how many times the stamp was applied and increments its value after each time.

Translate