Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Add link to external file

Avatar

Former Community Member
Hi,



i want to add a link to an external file in my document.

like "-a href=file://local path ... in html.



regards

Johannes
9 Replies

Avatar

Former Community Member
You can use the command:



app.launchURL("http://www.adobe.com", true)



where the second parameter is a boolean that says whether to launch the URL in a new window or not. The default is false.



Hope that helps

Avatar

Former Community Member
Thx Paul,



but I don't want to open a http URL, I want to open a doc file that is located on a public folder or on my local disk.



app.launchURL("file://c:/temp/t.txt", true);



does not work.



regards

Johannes

Avatar

Former Community Member
I tried it here and found that it gave a security error. I do not think that the launchURL command allows you to get to a file on file system.



You could try certifying the document.

Avatar

Former Community Member
I had the same security problem.



But if I thing of importing an Word-doc that includes hyperlinks to files, how would this work?



Isn't it quiet common to include hyperlinks to files and not only to the web into forms?

Avatar

Former Community Member
If you import a word file into designer then those links would be ignored. If you create a PDF from the word file (in Acrobat) then the links would be maintained.

Avatar

Former Community Member
Ok

but the feature which enables me to open a file via a hyperlink is not provided in the LC Designer?

Avatar

Former Community Member
That is why we cannot support them when we import the word file.

Avatar

Level 7
You would need to do your forms in Acrobat to have such features.



Aandi Inston

Avatar

Former Community Member
Adobe does have a secruity feature built in that keeps you from opening files or folders on the file system, but there is a way around this. First on your form you would put something like this on the click event of a button for your link:



var myPath = "o|/Network Folder/FileName";

openNetworkFolder(myPath);



Next you need to set up a JavaScript file that you will save as a trusted function for Reader. This js file should have the following code:



openNetworkFolder = app.trustedFunction(function (sURL) {

app.beginPriv();

try {

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

} catch (err) {

app.alert('Error: ' + err);

}

app.endPriv();

});



This js file will need to be saved on each users local machine in their javascripts folder for reader. Also if you are pointing to a shared network folder, each user will need to have the same drive mapped for this to work properly for each user. This workaround allows you to bypass the built in Adobe security without having to sign the document.