Solved

Custom Acrobat Stamp

Posted on 2014-11-18
4
329 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Update 21-May-2015: I temporarily removed the source code to make major changes to the program. Regards, Joe In a previous Experts Exchange article, How To Rename-Move a Batch of PDF Files Based on Contents of the Files (http://www.experts-exchan…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

790 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