Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

Open PDF file locally + on web server with Javascript for all browsers

$
0
0

Dear,

 

I have the following code that needs to open an image (PDF file) that is located in a folder above my PDF from which it is called. My code is associated to a 3D annotation object in my PDF file.

 

var openImage = function() {

if((strImagePath.indexOf('http://')!==0) && (strImagePath.indexOf('https://')!==0)){

if (strImagePath.indexOf('file://') === 0) {

strImagePath = host.decodeURI(strImagePath);

strImagePath = strImagePath.replace("file://", "");

strImagePath = strImagePath.replace(":/", "/");

strImagePath = strImagePath.replace("|/", "/");

}

  1. host.app.openDoc(strImagePath);

            } else {

host.getURL(strImagePath)

}

};

 

The PDF should be opened from a HTML page that is hosted on a web server, but also can be opened from the harddrive.

This code works when the PDF file is opened from a hosted website. It also works when the PDF is opened local in Chrome, Firefox and Internet Explorer. But to make it work in Safari on OSX I need to change host.app.openDoc(strImagePath) to host.getURL(strImagePath). But then it only works local in Safari and Firefox.

Does anyone know how I can make this work for all these webbrowsers?


Thanks a lot for your help !

Tom


Viewing all articles
Browse latest Browse all 12130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>