最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Get username using javascript in pdf - Stack Overflow

programmeradmin1浏览0评论

I was wondering if it was possible to grab the username of the account logged into the puter. 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.

I was wondering if it was possible to grab the username of the account logged into the puter. 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.

Share Improve this question asked May 28, 2009 at 15:28 Kevin KaskeKevin Kaske 1,1392 gold badges12 silver badges18 bronze badges 0
Add a ment  | 

3 Answers 3

Reset to default 4

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.

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

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.

发布评论

评论列表(0)

  1. 暂无评论