Copy link to clipboard
Copied
I want to find the Java that will allow to add the user ID on the document when they print and a time stamp on the side.
Copy link to clipboard
Copied
Don't look for Java code. Acrobat uses Javascript.
Copy link to clipboard
Copied
Correction Im looking for the Java Script
Copy link to clipboard
Copied
No, JavaScript. Not Java Script. It's important: if you don't spell it exactly that way you won't find the right stuff in Google.
Copy link to clipboard
Copied
You can't access the login name of the user directly. It requires a special context, such as a script installed on the local machine. Is that something you can do for each user who is going to use this file?
Copy link to clipboard
Copied
I was thinking using this:
userName = identity.loginName;
Will that work?
Copy link to clipboard
Copied
No. It will yield this error message:
NotAllowedError: Security settings prevent access to this property or method.
Copy link to clipboard
Copied
Well that will not be usefull. I guess I should settle witha time-stamp. like a date and time it was printed. how that will work? Sorry for the random questions. Im new to this
Copy link to clipboard
Copied
No, that's fine. And yes, that is much easier to do. You can create a text field (let's call it "PrintText") and set it as "Hidden, but printable". Then under Tools - JavaScript - Set Document Actions - Document Will Print enter the following code:
this.getField("PrintText").value = "Printed on " + util.printd("mm/dd/yyyy HH:MM", new Date());
Copy link to clipboard
Copied
1 last question. how do I add a print button on the doc?
Copy link to clipboard
Copied
You can add a button that executes the File - Print menu item, or the following code:
this.print();
Copy link to clipboard
Copied
can somebody help me with this please.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more