Adding object metadata to dynamic stamp
Hello all,
I am creating a custom dynamic stamp for a project.
The Support Community's archives have been of much help as I have been working. Thank you.
I have already worked out the main functionality (auto-increment, cf. https://community.adobe.com/t5/acrobat-sdk-discussions/dynamic-stamp-with-an-incremental-number/m-p/8223946) of the stamp.
The stamp is to be used several times in the same document, and its content is different every time it is stamped (the content of the stamp is based on the number of said stamps in the document).
For each occurrence of the stamp in a document, I would like to track its dynamic content and the page number on which the stamp occurs.
My first approach was to track these data in a JS Array and then save the ‘stringified’ array to the PDF's metadata.
The problem with this, however, is that if a stamp is deleted from the document, it does not delete the corresponding item in the JS Array. Because of this, the metadata in the PDF does not accurately track all the stamps present in the final saved document.
The ability to add metadata at the object, i.e. the stamp, level (https://helpx.adobe.com/acrobat/using/pdf-properties-metadata.html) would solve this problem. If I were to delete an object, the corresponding metadata would be deleted. The sum of all the object metadata would accurately track all the stamps present in the final saved document.
I am not sure whether it is possible to implement adding metadata to a stamp object, and, if it is, I do not know how it would be done. I tried event.source.info (on analogy with event.source.source.info), but the debugger console threw out an error.
If it is not possible, I would welcome other approaches, such as creating a script that would alter the JS Array upon the deletion (either outright or through Ctrl-Z) of a stamp.
[moderator corrected a typing mistake as of OPs follow-up post.]
