Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Rotate a Stamp
  FAQ FAQ  Forum Search   Register Register  Login Login


Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Rotate a Stamp

 Post Reply Post Reply
Author
pmcnulty View Drop Down
New Member
New Member
Avatar

Joined: 24 May 2017
Points: 2
Post Options Post Options   Quote pmcnulty Quote  Post ReplyReply Direct Link To This Post Topic: Rotate a Stamp
    Posted: 24 May 2017 at 11:42pm
Hi I'm trying to create a stamp where when the user drags the stamp onto the document it runs JavaScript to create a popup dialog asking the user for an angle to rotate the stamp and the stamp is placed on the document with that rotation. I have created and can run the dialog but can't work out how to access the properties or get the stamp to rotate
the code I have is :

var Consentdialog = 
{
   degrees:"",
   //this function is fired on pressing ok
   commit: function(dialog)
   {
      var data = dialog.store();
      console.println("commit");
      
      this.degrees=data["stxt"];
   },


   description:
   {
      name:"Containment Diagram",
      elements:
      [
         {
            type: "static_text",
            bold: true,
            name: "Enter angle from north (degrees): "
         },
         {
            item_id: "stxt",
            width: 300,
                  type: "edit_text",
                 multiline: false,
         },
         {
            type: "gap",    //Add a small vertical gap between
            height: 10      //..radio fields and buttons
         },
         {
            type: "ok_cancel",
            ok_name: "Ok",
            cancel_Name: "Cancel"
         }
      ]
   }
}

if(event.source.forReal &&
   ((event.source.stampName == "h2yaK916D7gKH6wiDDHfe0")))
{
   app.execDialog(Consentdialog)

   if(Consentdialog.degrees !="")
   {
      console.println(Consentdialog.degrees);
//change stamp rotation
   }

}


Back to Top
Sponsored Links


Back to Top
try67 View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Points: 617
Post Options Post Options   Quote try67 Quote  Post ReplyReply Direct Link To This Post Posted: 28 May 2017 at 11:09pm
You can't do that, because when the code is executed the stamp object doesn't exist yet.
One possible workaround is to add a time-out that executes a code to rotate the last annotation added to the file some time after the dialog is closed, maybe after 500ms or so.
- Acrobat Expert - Contact me personally at try6767@gmail.com
Check out my custom-made scripts website: http://try67.blogspot.com
Back to Top
pmcnulty View Drop Down
New Member
New Member
Avatar

Joined: 24 May 2017
Points: 2
Post Options Post Options   Quote pmcnulty Quote  Post ReplyReply Direct Link To This Post Posted: 29 May 2017 at 1:22am
Thanks try67
was hoping I would be able to access the underlying stamp object that was being place will have a look at a different approach
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.031 seconds.