Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Adding Dynamic Stamp to an Action

New Here ,
Oct 23, 2017 Oct 23, 2017

I am trying to create an action that will place the standard Acrobat “Approved” dynamic stamp in the same place and same size every time the action is run. I am having a hard time finding the stamp. I have tried using the code below but I'm just not getting a return that gives me the right information to add to the script.

   

app.getPath("user", "stamps");  // Show location of custom stamps

app.getPath("app", "stamps"); // Show location of built-in stamps

This will need to be shared among several users, so the script needs to pull the stamp from each user’s computer. Is this possible and how can I achieve it.

Below is exactly what I need, except I need to replace the arrow button with the Approved stamp. It needs to be the dynamic name/date/time Approved stamp.

Thanks in advance.

Tina

   var inch = 72;

   for (var p = 0; p < this.numPages; p++) {

      // Position a rectangle (.5 inch, .5 inch)

      var aRect = this.getPageBox( {nPage: p} );

      aRect[0] += 1.5*inch;           

      aRect[2] = aRect[0]+1*inch;   

      aRect[1] -= .78*inch;

      aRect[3] = aRect[1] - 18;      

  

      // Now construct a button field with a right arrow from ZapfDingbats

      var f = this.addField("NextPage", "button", p, aRect )

f.setAction("MouseUp", "this.pageNum++");

      f.delay = true;

      f.borderStyle = border.s;

      f.highlight = "push";

      f.textSize = 0;                 // Auto-sized

      f.textColor = color.blue;

      f.fillColor = color.ltGray;

      f.textFont = font.ZapfD

f.buttonSetCaption("\341") // A right arrow

      f.delay = false;

   }

Screen Shot 2017-10-23 at 11.41.25 AM.png

TOPICS
Acrobat SDK and JavaScript
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 23, 2017 Oct 23, 2017

As far as the second part of your question goes, adding a stamp (or a different annotation) is very different from adding a form field. Take a look at the Doc.addAnnot() method: Acrobat DC SDK Documentation

This code will add the Approved annotation in a fixed location:

this.addAnnot({

    type: "Stamp",

    page: 0,

    rect: [36, 72, 288, 144],

    AP: "#DApproved"

});

Translate
Community Expert ,
Oct 23, 2017 Oct 23, 2017

You don't need to know where the stamp is located, all you need is the name of the stamp. You get that by placing the stamp in question on a page, then select that stamp and run a one-line JavaScript on the JavaScript console. See here for more information: https://acrobatusers.com/tutorials/dynamic_stamp_secrets​ - scroll down to the section titled "Stamp Name". 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 16, 2019 Jun 16, 2019

i am trying to create a new dynmaic stamp

called Denied

I need the date and time and my user name to appear

i got the date working just not the name

i need step by step i am new to this

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 16, 2019 Jun 16, 2019

i am trying to create a new dynmaic stamp

called Denied

I need the date and time and my user name to appear

i got the date working just not the name

i need step by step i am new to this

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 16, 2019 Jun 16, 2019
LATEST

The best way for you to do this is to copy stamp code from an existing Dynamic stamp.  First find one of the built-in stamps that has what you want.

Then read these:

There are several articals on this topic here:

https://acrobatusers.com/tutorials/filter/search&keywords=stamp&channel=tutorials&category=&tut_type...

And you'll find more info in this forum thread

How to change the name on a Dynamic Stamp copied from the defaults?

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 23, 2017 Oct 23, 2017

As far as the second part of your question goes, adding a stamp (or a different annotation) is very different from adding a form field. Take a look at the Doc.addAnnot() method: Acrobat DC SDK Documentation

This code will add the Approved annotation in a fixed location:

this.addAnnot({

    type: "Stamp",

    page: 0,

    rect: [36, 72, 288, 144],

    AP: "#DApproved"

});

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 23, 2017 Oct 23, 2017

Thank you Karl, this is exactly what I needed! It looks like I was making it more difficult than it needed to be.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines