Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Links to local drive


Level 2

I have seen many posts on this on the internet, but I haven't been able to get a difinitive answer. Is it possible to have a list of links to local files in a pdf form?

I have gotten it to work when using the a hyperlink and the "file://" protocol and when using internet explorer. I essentially put C:/myfolder/ into a textfield and then convert it to a rich text hyperlink with a file:// appended to the front. The link goes through internet explorer and then opens the file or folder in windows explorer, but it doesn't seem to always work and has issues with links with spaces.

I want to essentially have a pdf form with important links that can be sent to somebody else on the network to have access to.

Does anybody have a good way of making this work without going though a browser and the file:// protocol (I understand that there are security concerns with this)? and if not is there a clean way to get it to work though a browser other than internet explorer?


5 Replies


Level 2

I was hoping to be able to access a directory on a network drive. For example, I want an employee to be able to fill out a form and place a link into a field of where the documents are that they have been working on. I then want a supervisor to be able click a button and access that folder to check the work.

I noticed that this link had a work around: http://forums.adobe.com/message/1359940#1359940

I would be okay using a work around but I'm unsure how to actually create a trusted function as the person explains in that post.

Do you know how to make that workaround around work?


Level 10

Not sure if that's doable or not, hopefully someone who knows more will pop into the thread.

I've not tried using the trusted function method for accessing files but you could check the following post from Radzmar, it's for saving a file but there might be something there you can use.



Level 2

Finally figured this out using the work around located here: http://forums.adobe.com/message/1359940#1359940

I used the simplest form of this to get it to work.

You need to create a openFolder.js file in a text editor like notepad++ and then copy the text below into it:

var openFolder = app.trustedFunction(function (sURL)



                    var nDoc = app.launchURL("file:///" + sURL, true);



You then save this file in the javascripts folder in either Acrobat or Reader.

You then create a TextField1 and a Button, within that buttons click event place the following javascript:

var myPath = TextField1.rawValue;


You should now be able to place a path in the text field and press the button to follow it. This only works for paths that have forward slashes in them (/). This means if you paste a path from windows you will need to manually convert the backslahes to forward slashes. Or you can do some string editing when you call the function to replace all \ with /.

This method also works with files.

You can add

var myPath = myPath.replace(/\134/g,"/");

to convert backslahes to forward slashes

Currently this will not handle paths with spaces in them... Does anybody have an idea on how to make it work with spaces?



Level 2

This code does work on paths with spaces, as long as it has a file at the end. But if you want to open the directory that the file is held in it will fail...

Basically it can open a folder if there are no spaces, and a file if there are spaces or not.

Anyone have any ideas on why?