Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - How to bind codes with customized menuitems?
  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.

How to bind codes with customized menuitems?

 Post Reply Post Reply
Author
oald View Drop Down
Member
Member


Joined: 16 Sep 2011
Points: 42
Post Options Post Options   Quote oald Quote  Post ReplyReply Direct Link To This Post Topic: How to bind codes with customized menuitems?
    Posted: 28 Sep 2011 at 9:18am
Hi BAlheit,
 
It works, thanks so much for your prompt help which is so timely!
 
Have a good day!
Back to Top
BAlheit View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Points: 1113
Post Options Post Options   Quote BAlheit Quote  Post ReplyReply Direct Link To This Post Posted: 27 Sep 2011 at 4:16pm
Put your code in a function:

function crop()
{
...
}

and use this function:

app.addMenuItem ({ ... , cExec: "crop()" });


Back to Top
oald View Drop Down
Member
Member


Joined: 16 Sep 2011
Points: 42
Post Options Post Options   Quote oald Quote  Post ReplyReply Direct Link To This Post Posted: 27 Sep 2011 at 2:43pm
I want to develop a folder level JavaScript to automate the cropping of PDF documents, I refer to "Developing Acrobat Applications Using JavaScript" and find the sample codes as below, the reference indicates that I save the codes to config.js and  place it under C:\Documents and Settings\user ID\Application Data\Adobe\Acrobat\8.0\JavaScripts:
 
app.addSubMenu({ cName: "New", cParent: "File", nPos: 0 })
app.addMenuItem({ cName: "A4", cParent: "New", cExec: "app.newDoc(420,595)"});
 
I wonder how I can replace the "app.newDoc(420,595)" in the sample code with my codes as following:
 
for (var i = this.numPages - 1; i >= 0; i--)
{
 var rCrop = this.getPageBox("Crop",i);
 rCrop[0] += 72; // Adjust Left Side
 rCrop[1] -= 72; // Adjust Top Side
 rCrop[2] -= 72; // Adjust Right Side
 rCrop[3] += 72; // Adjust Bottom Side
 this.setPageBoxes("Crop",i,i,rCrop);
}
 
Need I create a function for my codes and use the methods apply or call to execute the function? Or I need to create a separate JS file and put it under my user foler then use some method to execute it?
 
Your suggestion and guidance are really appreciated!
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.063 seconds.