Wednesday, February 15, 2012

Acrobat X -- Return Stamp Name to Stamps Menu

There is an unfortunate change made to the way the stamps menu works in Acrobat X.
While in previous versions the name of the stamp appeared in the Stamps menu underneath the stamp image, in Acrobat X it is gone. If you have multiple stamps with similar looks it is now very difficult to distinguish between them because of this new behavior (bug?).




First of all, I would like to stress that for this to work the stamp must be defined as a dynamic stamp, even if previously it was static.
For an excellent introduction on how to create dynamic stamps, I recommend these tutorials by Lori DeFurio and Thom Parker:
Creating a Custom Dynamic Stamp
Dynamic Stamp Secrets

Here's how the current stamps menu looks like with a custom stamp. You can't really make out which stamp this is...
(click to enlarge)

I have discovered a way around this problem, and I'm happy to share it with the readers of my website. Here's how you do it:

- Find the PDF file that is used for your stamp and open it in Acrobat.
If you're not sure where to look, execute this code from the JS console, and it will show you the path to that folder:
app.getPath("user","stamps")

- Go to the stamp page of the file (typically the second page) and add a new text field to it. Try to make it as large as possible, possibly with a solid white background, although that's not necessary. Name this field "StampName".
Then enter into this field the name of your stamp as you want it to appear in the menu.

- Here's the crucial part: Go to the Properties window of the StampName field we just created, and enter this code as the custom calculation script:
event.target.display = (event.source && event.source.forReal) ? display.hidden : display.visible;

This will cause the field with the stamp name to become hidden when the stamp is actually applied.

How the stamp file looks like with the new StampName field on top of it:
(click to enlarge)

You can now save the stamp file, restart Acrobat and then go to the Stamps menu.
If you've followed the instructions, you should see your stamp, with the field name clearly visible in it.

The new stamps menu, with the same stamp now containing the stamp name:

If you select it, you will also see the name across the "ghost" of the stamp while you're moving it around, BUT in the moment you apply it, that text will be gone!

The stamp "ghost", with the stamp name still visible:

The stamp after it was actually applied to the file. The stamp name is now gone:


If you wish to download the stamp file shown here, and see for yourself how it works, you can do so from this link.


For expert advice on how to work with PDF files, stamps, forms, custom-made scripts, etc., you can always contact me directly.

No comments: