Skip to main content
jontyhunter
Participant
December 18, 2018
Question

Open a file in another application from within a PDF

  • December 18, 2018
  • 2 replies
  • 714 views

Hello,

Apologies if this has been asked before, but I have searched with no luck.

I want to assign a button in my PDF to open up an .ai file in Illustrator. Now, I know I can use the Open File action, navigate within Finder to find my file to link to. That works fine.

But I need a bit more flexibility than that, as I want to be able to manually type in a file path (reason, my PDF will be shared with three offices, each of which will have their own file paths. I don't want to have to travel to the other office just to relink a new file, should something change. If I can type in manually I can set the file path remotely)

So I thought to use app.openDoc....

app.openDoc("/Users/produser/Desktop/testfile.ai")

However, all that does is open up the file in a new window within Acrobat.

Is there a way to tell Acrobat that the target application for the file is Illustrator, not Acrobat?

Thanks

JTH

This topic has been closed for replies.

2 replies

Thom Parker
Community Expert
Community Expert
December 18, 2018

Well actually, Acrobat can tell the OS to open an attachment in whatever program matches the file extension.

Here's the JavaScript reference entry (note the nLaunch parameter, and the security restrictions):

Acrobat DC SDK Documentation

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
try67
Community Expert
Community Expert
December 18, 2018

This can only be used for files that are actually attached to the PDF file

itself, though.

Thom Parker
Community Expert
Community Expert
December 18, 2018

True, and files can be imported manually or through a privileged script in Acrobat Pro, or with a 3rd party viewer/pdf tool. So it's a viable strategy. There are just some requirements.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
try67
Community Expert
Community Expert
December 18, 2018

No, that would be a huge security risk.

jontyhunter
Participant
December 18, 2018

OK, granted I clearly need to learn more about this, but please explain why.

How is what i am trying to do different to using the Open File action?

try67
Community Expert
Community Expert
December 18, 2018

A malicious code could then execute any file, including executables, on the computer. It could use trial-and-error methods to locate sensitive files, find vulnerabilities in the system, etc. The Open File command can only open specific file types and can't perform "tests". It must know the full file path in advance.