Solved

Launching a PDF in Acrobat from Internet Explorer

Posted on 2007-04-09
11
349 Views
Last Modified: 2013-11-25
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?
0
Comment
Question by:skatz
11 Comments
 
LVL 28

Accepted Solution

by:
TName earned 500 total points
ID: 18881230

This works for me (path to the file!)


<html>
<head><script LANGUAGE="vbscript">
<!--
Dim WshSHell
set WshShell = CreateObject("WScript.Shell")

Sub calctxt_onclick
  WshShell.Run("AcroRd32.exe c:\test.pdf")
End Sub
-->
</script>

<title></title>
</head>

<body>
<a href="#" NAME="calctxt">
<p>Run Acrobat file</a></p>
</body>
</html>
0
 

Author Comment

by:skatz
ID: 18882131
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.
0
 
LVL 28

Expert Comment

by:TName
ID: 18882179
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...

0
 

Author Comment

by:skatz
ID: 18882243
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)
0
 

Author Comment

by:skatz
ID: 18882334
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?
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 28

Expert Comment

by:TName
ID: 18882803
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&
0
 
LVL 28

Expert Comment

by:TName
ID: 18882848
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...
0
 
LVL 28

Expert Comment

by:TName
ID: 18882851
trar´ted=treated  :-/
0
 
LVL 2

Expert Comment

by:cyberpranav
ID: 18896310
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::
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20649452
Forced accept.

Computer101
EE Admin
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
We often encounter PDF files that are pure images, that is, they do not have text characters, but instead contain only raster graphics. The most common causes of this are document scanning software and faxing software/services that create image-only…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now