Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Open a file

Avatar

Level 3

LCD gurus: what is the script to open an external file?  I have yet to find anything concrete that will do this via Acrobat 9 - we cannot use Acrobat X.

The situation I have is I need to enforce that a procedure document is open on the screen while a user fills out the PDF.  I would like to create a checkbox that the user must click to open that procedure document.  If the the checkbox is clicked, then the PDF areas become "open".  Else the PDF areas are "protected".  I can do all the code with the checkbox to protect the PDF areas, but cannot find any code snippet that will cause that procedure document to open...

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 5

Hi,

It doesn't auto complete because it is a Acrobat JavaScript function and this is passed through to the Acrobat application when it is called, therefore to find the documentation you need to check the Acrobat SDK JavaScript guide document.

http://www.adobe.com/devnet/acrobat

Because of this the function is only available in the PDF files ( not HTML)  and just because it doesn't autocomplete does not mean that the code is not valid, it just means that it is not included in the Desginers autocomplete lists.

And the path is written in a JavaScript string which is a cross platform.

Windows path := C:\myFolder\myFile.pdf

the equivalent Acrobat  JavaScript path  := /c/myFolder/myFile.pdf

Hope this helps

Malcolm

View solution in original post

4 Replies

Avatar

Level 5

Hi,

you should be able to use

var otherDoc = app.openDoc("/c/temp/myDoc.pdf");

and you could also look at

event.target.path

to get you the path of the current file if you want to use a relative path.

Regards

Malcolm

Avatar

Level 3

Malcolm -

Thanks, I have that script as well, but I cannot see that app.openDoc works.  I cannot find that referenced in the LCD script manual, it does not auto-complete like every other valid code when typing it into LCD, and the sample code that comes with LCD that uses that code does not work either.  I am wondering if it is due to using Acrobat 9?  Or is it some weird thing with the path structure?  I have tried most combinations of pathing structre I can think of, and nothing.

Avatar

Correct answer by
Level 5

Hi,

It doesn't auto complete because it is a Acrobat JavaScript function and this is passed through to the Acrobat application when it is called, therefore to find the documentation you need to check the Acrobat SDK JavaScript guide document.

http://www.adobe.com/devnet/acrobat

Because of this the function is only available in the PDF files ( not HTML)  and just because it doesn't autocomplete does not mean that the code is not valid, it just means that it is not included in the Desginers autocomplete lists.

And the path is written in a JavaScript string which is a cross platform.

Windows path := C:\myFolder\myFile.pdf

the equivalent Acrobat  JavaScript path  := /c/myFolder/myFile.pdf

Hope this helps

Malcolm

Avatar

Level 3

Ahhh...it ONLY opens a PDF.  I was trying to open a test txt file, and was stumped why this would not work.  When I tried to open a PDF it works fine.  SO now I will see if I can hard code a path name in and use my checkbox routine....

Thanks,