javascriptannotationsadobeacrobatstamp

How can I check if user has a specific custom stamp installed?


I have a document where I want to have multiple users approve various steps with a custom stamp I've developed. I've done this with buttons coded to insert the stamps in specific locations. What I need is a way to check if the user does not currently have this stamp installed, so that instead of a blank square, it will simply insert the standard "Approved" Dynamic stamp. Something like the below...

if (*AP "customDynStamp" exists in user folder*) {
useThisAP = "customDynStamp"
} else {
useThisAP = "#DApproved";
}

var annot = this.addAnnot({
page: 0, type: "Stamp", name: "FinApproval",  rect: [356, 200, 453, 245],
AP: useThisAP });
var f = getField("Approval button")
f.display = display.hidden

I've tried using the app.openDoc method to check if the file exists, but I can't use the "app.getPath('app','stamps')" code to find the user's stamp file path within a button. If I create a stamp with the AP and check it afterwards, I see no difference within the properties to determine whether or not it found the image or if it's just blank.


Solution

  • For anyone who's having a similar issue, Try67 on the adobe forums was able to find a method to check. "If you only specify a point (as opposed to a rect) the stamp is applied in its original dimensions. If no stamp exists that matches the AP you provide, the size will be 100x100 points. So unless your original stamp is exactly that size you can use that to find out it's missing."