Solved

Launching a PDF in Acrobat from Internet Explorer

Posted on 2007-04-09
11
356 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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
 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

837 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