Skip to main content
March 15, 2021
Question

My Incremental Dynamic Stamp would lose the trace if I use Ctrl + Z or delete a previous stamp.

  • March 15, 2021
  • 1 reply
  • 1212 views

I am using a JavaScript Code in order to have a let’s say incremental stamp in my adobe acrobat pro dc, it works well and the stamp counts from a desired start number.

The problem with the code is- whenever I delete a previous stamp, the one that comes after, does not see this deletion and counts like no stamps have been deleted. Just to make sure that I have explained the problem correctly, let me give an example here; assume I have stamped three times in a row: stamp #1, Stamp #2, Stamp #3. And at the end, when I delete the Stamp #3, continuation of the stamping process would leave me with something like this: Stamp #1, Stamp #2, Stamp #4! Something that I do not want at all.

I know I should be able to save the incremented values somewhere to make the acrobat able to read it before trying to determine the stamp number, but I do know how.

I would be thankful if you guys help me with this problem? By the way, I am not un-familiar with the JavaScript.

Best,

This topic has been closed for replies.

1 reply

Bernd Alheit
Community Expert
Community Expert
March 15, 2021

What should happen when you delete stamp #2 ?

March 15, 2021

Thank you very much for your quick and helful response;

The question that you have asked, made me think more about the task the I expect this stamp to perform for me. I am kind of feeling some sort of logical issues with the thing that I want; I mean, what should really happen if someone delete a stamp from the completely sored stamp list. I think it should be possible for someone to develop a code that makes the number of stamps thoroughly sorted from the first stamp to the last one after deletion of a particular stamp, but I do not want to go that far (I think the code would be complecated in that case).

At the moment, you question has led to another question in my mind; would you please give me some hint to modify the code so that the new stamp deletes automatically the last stamp of the same kind so that, there would be just one stamp of that type in the entire document?

Best,

Thom Parker
Community Expert
Community Expert
March 15, 2021

Stamp scripts are very limited. A stamp script cannot get info on or affect any other stamps. So, a stamp script cannot delete another stamp. 

 

Now about your first question. What is the script used for the increment? The increment value has to be stored somewhere and then the stamp script increments the value. To decrement the count when a stamp is deleted would require a script that triggers when the stamp is deleted. There is no such script trigger.

 

However, there is a way to manage the stamps the way you want. It just can't be done from a stamp script. To do this you need an automation script. You'll need to learn much more about stamps, Acrobat, and JavaScript to do this.

https://www.pdfscripting.com/public/All_About_PDF_Stamps.cfm

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often