Copy link to clipboard
Copied
Hi,
I've got the following situation: I have an MS Excel file that I print/save as an Adobe PDF. In that PDF I need three signature fields. So I open that PDF and create the form and place the three fields by scratch.
The pity: I have about 300 Excel files per month that I have to handle like that.
Is there any possibility to handle that automatically?
Thanks
L
Copy link to clipboard
Copied
Do they always need to be at the same spot on the same page? If so, then yes, it's possible to create a script that will add those fields. If you have Acrobat Pro then it's even possible to run this script as a part of an Action on multiple files...
Copy link to clipboard
Copied
Yes! How do I do this? I never used scripts in Acrobat before. I only have Acrobat Standard.
Copy link to clipboard
Copied
(Edited)
OK, then the next step is to identify the field's location. To do that create the field manually and then open the JS-Console and run the following command (let's say it's called "Sig1"):
console.println(this.getField("Sig1").rect);
This will print out a bunch of numbers, which represent the locations of those fields. This information can be used in the addField method to create the field, like this:
this.addField("Sig1", "signature", 0, [149.29299926757812,733.9965209960938,396.62530517578125,717.973876953125]);
The numbers at the end are the ones you need to insert. The first parameter is the field name, the second is its type and the third is the page number (0 being the first page). That's it, pretty much. You can run this code from the Console itself, or even from a button or a menu item (although the latter will require adding a bit more code and placing it in a .js file in a specific folder on the computer).
Copy link to clipboard
Copied
Thanks a lot! But where do I find the Java Script Console?
Actually the best would be to have a menu item (or at least a shortcut?). Could you help me to do this?
Thanks!
Copy link to clipboard
Copied
Hi,
JavaScript console - Ctrl+J (or Cmd+j mac).
Regards
Malcolm
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Yes, except for the fourth parameter (rect) of the addField method. That array must contain four numbers, not two.
Copy link to clipboard
Copied
Now I'm at work and do have a few problems.
First: I cannot open the console. Ctrl + J does not work. I found in the web that Ctrl + J generally does not work with Adobe Standard...
Second: I createt a subfolder-path "Privileged\DC\Javascripts" in the path "C:\Users\<username>\AppData\Roaming\Adobe\Acrobat\" and put there the following js-file for testing, named "buttons.js":
app.addToolButton({
cName: "Open Console",
cLabel: "Cons",
cExec: "openConsole()",
cTooltext: "open console",
cEnable: true,
nPos: -1
});
function openConsole(){
console.show();
};
How can I see whether it worked or not? Where is the toolbar the button is supposed to be?
Third: Even if I change the content of the js-file only to "console.show();", nothing happened when I start Adobe.
Copy link to clipboard
Copied
Edit:
Second: Adobe Reader does find the js-file and the button! But: In Adobe Acrobat Standard DC I don't see the "Add-On Tools"-toolbar. It seems like I have no possibility to see the toolbar!
Any idea?
Copy link to clipboard
Copied
Now I reached to get the console in Adobe Standard. If I put "app.getPath("user","javascript");" I will get the following
GeneralError: Vorgang fehlgeschlagen.
App.getPath:1:Console undefined:Exec
2
What does that mean?
Copy link to clipboard
Copied
That the path is not defined. Replace "user" with "app" in the code and try again.
Copy link to clipboard
Copied
I don't have access to the app-folder (no Admin permissions), so I have to use the user-path.
I use Adobe Acrobat Standard DC Verison 2015.006 -> which path is the right one?
Copy link to clipboard
Copied
You should try the path you found. If it doesn't exist then you can create it yourself.
Copy link to clipboard
Copied
Solution: It was "Privileged\2015\Javascripts" instead of "Privileged\DC\Javascripts"
Copy link to clipboard
Copied
Thanks for posting what worked for you! This could help others in the future...