Open excel file with a click of a button in PDF
Copy link to clipboard
Copied
Hi, I have created a button, to trigger it to run a javascript code, to launch excel file.
My java code as below:
var filePath = "file:///C:/Path/To/Your/File.xlsx";
app.launchURL(filePath, true);
The problem is, it wont open the excel file.
Is my code is correct? Anything that I miss out?
Thanks in advance
Copy link to clipboard
Copied
No, it won't work. Did you look in the Console Window (Ctrl-J) to see the reported error?
Acrobat is sandboxed. Meaning that scripts in a PDF operate only in the PDF/Acrobat enviroment, NO touching things on the users local system, unless specific security measures are taken. And even then, there are limitations in the API.
Read this:
https://www.pdfscripting.com/public/Trust-and-Privilege-in-Acrobat-Scripts.cfm
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
To be able to do it you must attach the Excel file to the PDF, then use a script to open it.

