Hi:
Is there a way to access any "system" variables with Acrobat JavaScript? I haven't been able to find anything (other than Date()) in the references. This is outside the scope of core JavaScript, as far as I know.
In particular, I want to be able to pluck the workstation name string and insert it in a footer.
Thank you in advance.
-- Roy Zider
Maybe, but unlikely. 'path' itself is a misnomer, since it delivers both path and filename. And fails to report the drive.
It occurs to me that maybe a better approach to this whole thing is to do the pdf manipulation from Windows Scripting Host. Then at least all the file and system information will be available.
I haven't looked at LiveCycle or xfa or SOAP or other possible technologies. I understand ADBC was dropped from Adobe X. It would have provided a simple way to read or import an external file with the information of interest, that could then be added to a header/footer.
-- Roy Zider
I'm not talking about path, which returns the full path of a file
(including the drive letter, by the way), but about app.getPath() which can
return various system- and user-level folders used by Acrobat. Many times
these contain the name of the currently logged-in user, as well as some
other information.
Maybe you can be a bit more specific about what exactly you want to get?
With Acrobat JS not the workstation ID. File paths and URL for a PDF stored on a network drive is possible:
console.println("\nthis.URL:\n" + this.URL);
console.println("\nthis.path:\n" + this.path)
this.URL:
file:///H|/My%20DocumentsISR/Adobe/Console.pdf
this.path:
/ORDHOME.CHICAGO.ISRWORLDWIDE.COM/GEORGE$/My DocumentsISR/Adobe/Console.pdf
true
You could use additional Acrobat JS to extract the path or remove the file name and extension.
try67:
I'd be interested in seeing how you get the drive letter from 'this.path'. I've not been able to do it.
The function app.getPath() returns the dpath (drive-path) of various folders created during installation. I didn't see any reference in the API to any system information.
What I'm trying to do is very simple: in a footer, I want to post the workstation name of the host that's stamping the pdf. So, '[MPX2] D/My Documents/test logs.pdf' and '[K7N] D/My Documents/test logs.pdf' for workstations MPX2 and K7N, bzw.
-- Roy Zider
try67:
You are so right. Substring not necessary (but good reminder of another method). I misread my own system.
I've got three workstations active; on one of them[MPX2] the drive assignments are simple: C: and D; on another [K7N] the directories are treed: D:\D, D:\E, D:\F, and so forth. I read /D/MyDox/<filename> as being on the K7N workstation with the 'virtual' sub-drive directory structure, when in fact I was on the other workstation (MPX2) I had lost track of which system I was woking with.
Sorry for any inconvenience, and thank you for bucking this back to me.
-- Roy Zider
North America
Europe, Middle East and Africa
Asia Pacific