2

Is it possible to get the "device id" to identify the user's PC/mobile phone with javascript in a PDF file?

I intend to send this device id to the server for simple authentication, after I open the file (sending to server is not an issue).

user3774630
  • 256
  • 2
  • 10
  • Not all PDF viewers (especially those on mobile devices!) support Javascript. (And if they do, they may have an option to switch it off, thereby easily circumventing your check.) – Jongware Aug 17 '14 at 01:17
  • thanks Jongware, I realised what I would have to do is to by-default block off most of the PDF. Then only upon simple authentication remove the covering blocks... not the best solution but its a simple one. – user3774630 Aug 17 '14 at 19:12

2 Answers2

2

Using Acrobat JavaScript (the JavaScript version for PDF), you will not be able to get the user ID or anything from the machine. And, as it has been said, only a few PDF viewers for mobile devices do support (Acrobat) JavaScript to some extent, and none of them (as far as I know) supports the identity object (that's where some user information is accessible).

However, there are severe restrictions on when some of the identity object's properties (such as user's login name) can be accessed. In fact, the only time is when the application (Acrobat) starts up. In order to make this information accessible to documents etc. you would have to install an application-level JavaScript which reads out the information and makes it available as global variables. This does require an active installation of the JavaScript at specific places. (and again, none of the mobile PDF viewers supports that).

In short, the answer is "no".

Max Wyss
  • 3,549
  • 2
  • 20
  • 26
0

I answered this question or a similar question to it that should solve your problem, I wont post the code i will link the answer, if this is not what you need, please use comment.

Identify local PC with JQuery

The answer uses native js, you don't need jquery.

Community
  • 1
  • 1
MartinWebb
  • 1,998
  • 1
  • 13
  • 15
  • 1
    Note that the code on that answer will not work inside a PDF file without modifications, since the DOM in PDF is different from the one you find in web browsers, for example there might not be a "window" object in a PDF file. – yms Aug 17 '14 at 02:40
  • Thanks Martin. It is very very close, but as yms pointed out - the reason for PDF js silently failing - the DOM seems different? I'll be trying to tweak this! – user3774630 Aug 17 '14 at 19:17