Solved

Custom Acrobat Stamp

Posted on 2014-11-18
4
306 Views
Last Modified: 2014-11-19
Hello,  

I built a custom stamp that prompts me for a number.  Here is the code:

 

So when I go to select the custom stamp, the prompt box appears, but it never allows me to select the actual stamp.  Now here's how I can get it to work.  If I open the stamp pdf file and leave it in Forms Editing mode, then go back to my other PDF, it allows me to choose the stamp, drop it into workspace, then it prompts me for a number.  This works, however, I can't just leave the other PDF stamp file open all the time.

Thanks,
Joel
var cResponse = app.response({
cQuestion: "Enter Revision Number",
cTitle: "Revision Number",
cLabel: "Revision Number:"
});
if (cResponse == null) {
event.value = "*NVALID*";
}
else
event.value = cResponse;

Open in new window

0
Comment
Question by:Genius123
  • 2
  • 2
4 Comments
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 40452365
Can you please share your complete stamp file. Did you define the stamp as a page template? You will have to use the stamp's internal name in your calculation script, otherwise the popup will be shown at different times, even when you are not trying to place your stamp.

The correct way of doing this is by using code like this:

if (event.source.forReal && (event.source.stampName == "#MyTestStampABC")) {
	var cResponse = app.response({
		cQuestion: "Enter Revision Number",
		cTitle: "Revision Number",
		cLabel: "Revision Number:"
	});
	if (cResponse == null) {
		event.value = "*NVALID*";
	} else
		event.value = cResponse;
}

Open in new window


You have to make sure that the stamp name is the same that you use for the page template name. Just in case you don't know, the stamp template name needs to something like this:

#InternalStampName=The user facing name

Open in new window


Here is a tutorial for creating custom stamps: http://acrobatusers.com/tutorials/dynamic_stamp_secrets
0
 

Author Comment

by:Genius123
ID: 40452604
Hi,

I'm not sure how to get the name of my stamp.  Can you please help?  I've attached the file.

Thanks for your help.
0FF9-OlEfUEO3Rowo8V4kC.pdf
0
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 500 total points
ID: 40452635
To get the name of the stamp, bring up the page template dialog (Tools>Document Processing>Page Templates):

Page Templates Screenshot
As you can see, the template name is in the format I've indicated earlier: The part on the left is the stamp name (you can also rename it in the Page Templates dialog). In your case, this would be #JvnMllljsbC...psA

You can also get the name of a stamp by applying the stamp, then selecting it and running the following code in the JavaScript console:

this.selectedAnnots[0].AP;

Open in new window

0
 

Author Closing Comment

by:Genius123
ID: 40452701
Thank you.  That worked perfectly!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this first video of the three-part Xpdf series, we introduce and describe Xpdf, a library containing nine command line utilities that perform various functions on PDF files. We show where the library is located and how to download it, discuss its…
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now