tags:

views:

703

answers:

3

I was wondering if it was possible to grab the username of the account logged into the computer. I wanted to print the username of the person that is printing out the pdf file.

I was thinking about trying to grab the %username% environment variable. Does not seem to be possible.

A: 

This may be possible to some extent server-side. Here's an NTLM auth module for Apache/Unix, and here's one for Apache/Windows.

ceejayoz
A: 

take a look a the identity object.


   name = identity.name; //gives you the user name that the user entered in the Identity preferences panel
   userName = identity.loginName; //login name as registered by the operating system
Emmanuel
+2  A: 

In Acrobat JavaScript, many local system parameters are considered privileged. The user's login name is one of these. In order to access the "identity" object the JavaScript code has to be executed from a trusted context. Code inside a PDF doesn't qualify. Or at least it doesn't normally. If the local system user has given explicit permission to the PDF, then it can access privileged data. But obviously this isn't a general purpose solution. Typically the "identity" object is only accessible to Folder Level Automation scripts.

Thom Parker www.pdfscripting.com