Link to home
Start Free TrialLog in
Avatar of skatz
skatz

asked on

Launching a PDF in Acrobat from Internet Explorer

I tried the solution offered in this discussion but it didn’t work:

PDFs: How to launch Adobe Reader INSTEAD of displaying in browser

<html>

<head><script LANGUAGE="vbscript">
<!--
Dim WshSHell
set WshShell = CreateObject("WScript.Shell")
Sub calctxt_onclick
WshShell.Run("AcroRd32.exe w3.pdf")
End Sub
-->
</script>

<title></title>
</head>

<body>
<a href="#" NAME="calctxt">
<p>Run Acrobat file</a></p>
</body>
</html>
******************************************************
We have Acrobat 8 at my company so I substituted “Acrobat.exe” for “AcroRd32.exe” in the script, but didn’t know how to tell it which file to run. I substituted “http://....[filename.pdf]” for the “#”, but that only got me the file opened in the IE browser, which is what I had before. Can someone please help?
ASKER CERTIFIED SOLUTION
Avatar of TName
TName

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of skatz
skatz

ASKER

I'm sorry, I probably wasn't clear enough in my question. I need the PDF to open in *Acrobat*, not the IE browser. The solution here just lauches the plug-in and opens the file in the browser. I've tried using the Shell method with VBScript and creating an ActiveX object with Javascript, and am not able to launch any *.exe file from a webpage.

The reason I need to do this is that our users need to be able to modify the document permissions we set on the PDFs from the Acrobat app. We restrict them from printing or editing the documents, but if they have the proper authority, they can change the permissions. They need to work with the document in the Acrobat GUI because the IE browser doesn't let them change permissions.
No, you were very clear, I understood you perfectly -  and yes, when I click on the link, Acrobat (the application, not a plug-in) will start and open the .pdf document, outside of IE...

Avatar of skatz

ASKER

You know what, it works! Thank you. I have one more question---can you tell me how to modify the code so that I can pass the file name as a variable when I call the script? (I'll be using this for many different files)
Avatar of skatz

ASKER

Actually I have an additional question, which might potentially be a big problem. Now that I have that code added to the site, any time I open it, I get a warning message that says "An ActiveX control on this page might be unsafe to interact with other parts of the page. Do you want to allow this interaction?". If I click Yes, the page opens and everything is fine. This will be very confusing for our users, however. Is there a way to make the code work without generating the warning message?
Add this comment text at the start of the file:

<!-- saved from url=(0014)about:internet -->

This is the so-called "Mark of the web" solution (makes IE treat the locally stored page like a web page)
See here:
http://www.phdcc.com/xpsp2.htm#markoftheweb


http://www.phdcc.com/xpsp2.htm
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/motw.asp
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q216434&ID=KB;EN-US;Q216434&sd=msdn&
Ok, I see that this won't work - there'll be no error message, but the link won't launch the application either (the file is trar´ted like a page on the web, after all).
Have a look at the other solutions suggested on the pages linked above...
trar´ted=treated  :-/
To get around the warning message problem, you will have to change the security settings under Security->My Computer->Initialize and script ActiveX Controls not marked as safe->Enable.

This is really a security risk. But will work in your case.

::Pranav::
Forced accept.

Computer101
EE Admin