ReferenceError
The JavaScript error occurs in the Adobe Reader when a document link is clicked in a PDF file (Disk Archive)


Last updated
Was this helpful?
The JavaScript error occurs in the Adobe Reader when a document link is clicked in a PDF file (Disk Archive)


Last updated
Was this helpful?
Was this helpful?
var openLinkPriv = app.trustedFunction( function(dbId, docUnid) {
app.beginPriv();
try {
var depth = 50;
try {
depth = this.path.split("/").length;
}
catch(e) {
}
var dirUp = "../";
var xmlRoot = "";
var xmlFile = "doclinks.xml";
var xmlStream = null;
var count = 0;
do {
try {
xmlStream = util.readFileIntoStream(xmlFile);
} catch(e) {
xmlStream = null;
}
if(xmlStream == null) {
xmlRoot = dirUp.concat(xmlRoot);
xmlFile = dirUp.concat(xmlFile);
}
count++;
} while(xmlStream == null && count < depth);
if (xmlStream == null) {
app.alert("XML not found");
return;
}
var xml = XMLData.parse(util.stringFromStream(xmlStream), false);
var xPath = "string(//data/element[@id = '";
xPath = xPath.concat(dbId);
xPath = xPath.concat("-");
xPath = xPath.concat(docUnid);
xPath = xPath.concat("']/location)");
var location = XMLData.applyXPath(xml, xPath);
location = xmlRoot.concat(location);
app.openDoc(location);
} catch(e) {
app.alert("Linked document could not be found: " + location);
}
app.endPriv();
});