Hi,
I have an intranet site that I'm building and some pages have links to various documents on the local machine, for PDFs I'd like to be able to load the Adobe Reader application then display the PDF external from IE with javascript.
I'm running it off XP, IE, Adobe Reader 8.
The following code is the javascript I use when I click from document link. It loads Adobe Reader then produces the error "There was an error opening the document. This file cannot be found".
I'm trying to find a way to define the document path to load.
If some one can give me some pointers I would greatly appreciate it!
try
{
control_text = "AcroExch.PDDoc";
control = new ActiveXObject(control_text);
pdfDoc = control.Open("C:\documents\trial.pdf")
//It loads Accrobat here but fails to to find document.
}
catch (e)
{
alert("Fail on load.");
}
The correct WebPage method for loading a file is demonstrated on this page:
http://www.windjack.com/WindJack/Browser2PDF/brwsr2acroJS.htm
Look at the source for the top frame. There is also a simple example in the Acrobat 8 SDK, which you can download from here:
http://www.adobe.com/devnet/acrobat/
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script