Copy link to clipboard
Copied
Want to add a stamp and a certification to documents (have to repeat this task often)
I would like to use the Action Wizard, but I don't see where adding a stamp (regular stamp not dynamic) can be done.
It looks like javascript may be the way to go, but don't know how to get started with javascript. Can someone give me a direction to start learning javascript for Acrobat?
Better yet an example of adding a stamp and certification would be a big help.
Thanks,
Billt
Thanks try67 and Bernd. Got the stamps working.
this.addAnnot({
page: 1,
type: "Stamp",
AP: "#Zd5nkwcd2aDSRZVdzEaoFC",
rect: [300, 100, 400, 150]
});
(I am now going to try the digital certification.)
Copy link to clipboard
Copied
Here is (almost) everything you need to know about placing a stamp:
PDF Page Coordinates (page size, field placement, etc.)
and all about stamps themselves here:
You can lean all about JavaScript in Acrobat here:
Be sure to check out the free video tutorials on how JavaScript is used in Acrobat:
Free Video Content & Full Listing of Available Videos
Copy link to clipboard
Copied
Thom,
Thanks for the reply. Seems this is an old topic as I see a lot of closed discussions and broken links about it. Also many links are for previous versions. (I could do this in Acrobat 9 using macromaker pro)
The link you provided above PDF Stamp Annotations is for members only. Cost $149 to read it. May sign up later.
To add a stamp I want to use this javascript method:
this.addAnnot({
page: 0,
type: "Stamp",
author: "Should I use the Category?)
name: "How do I find this",
rect: [100, 100, 500, 500]
});
But I need to know the name of the stamp.
This is a stamp I imported from a jpg file.
I gave the stamp a name and a category when I imported , but I understand Acrobat gave it one that I should use with the javascript. How can I find that name?
Copy link to clipboard
Copied
Do you mean you want to secure a PDF with a digital certificate? or Sign a PDF with a digital certificate (this is usually referred to as certification?
You can read about security issues and scripting here:
Copy link to clipboard
Copied
I want to sign the document with a digital signature (certification). using javascript.
Copy link to clipboard
Copied
Stamps are not a digital certification. You would need to do the two things separately. First stamp the file and then digitally sign it.
To get the internal name of a stamp add it to a page, then click it with the mouse (so a blue dashed line appears around it), then press Ctrl+J to open the JS Console and run the following script in it:
this.selectedAnnots[0].AP
It will print out the internal name of the stamp that you need to use in your code.
Copy link to clipboard
Copied
Yes I understand I need to do stamp separately from the certification.
Thanks for the method for obtaining the internal stamp name
(highlight ; Ctrl+J; this.selectedAnnots[0].AP)
This got me a little further along. However I have two stamps that I need to use. I did the method above for both stamps and got the following names:
Stamp1
#Dt6yAundmKFuWt-c6mPXPA
Stamp2
#Zd5nkwcd2aDSRZVdzEaoFC
When I use the console to place both stamps with this command:
this.addAnnot({
page: 0,
type: "Stamp",
name: "#Dt6yAundmKFuWt-c6mPXPA",
rect: [250, 100, 350, 300]
});
this.addAnnot({
page: 1,
type: "Stamp",
name: " #Zd5nkwcd2aDSRZVdzEaoFC",
rect: [300, 100, 400, 150]
});
It places the same stamp both places. It appears to be using the last stamp used for this command. Is this the correct way to use the command to place the stamps?
Copy link to clipboard
Copied
No. You need to use that value as the AP property, not as the name property. That one is assigned automatically, there's no need to set it yourself.
Copy link to clipboard
Copied
I know I doing something wrong.
I've been referencing the manual:
JavaScript™ for Acrobat® API Reference
I don't see how to use the AP property when using the addAnnot method.
This does not work:
this.addAnnot({
page: 1,
type: "Stamp",
ap: " #Zd5nkwcd2aDSRZVdzEaoFC",
rect: [300, 100, 400, 150]
});
Copy link to clipboard
Copied
The property is AP, not ap.
Copy link to clipboard
Copied
It's important to remember that JavaScript is case-sensitive.
Copy link to clipboard
Copied
Thanks try67 and Bernd. Got the stamps working.
this.addAnnot({
page: 1,
type: "Stamp",
AP: "#Zd5nkwcd2aDSRZVdzEaoFC",
rect: [300, 100, 400, 150]
});
(I am now going to try the digital certification.)