Hi,
I'm attempting to use the Adobe Acrobat hostContainer object to create a simple interface to allow my Adobe Air application to move between pages of an embedded pdf doc. However the output I get indicates that the hostContainer object is undefined. The script works correctly when the pdf is embedded in a stand-alone html file, but not in Air.
I have Adobe Acrobat 9.0 and Adobe Reader 9.0 installed. It does not seem to be an issue with on machines with Adobe 8.0.
My code in the document javascripts of the pdf is as follows:
this.disclosed = true;
if(this.external && this.hostContainer){
try{
this.hostContainer.messageHandler={
myDoc:this,
onDisclose:function(){return true;},
onMessage:function(stringArray){
var cmd=stringArray[0];
try{
if(cmd=="nextPage" && this.myDoc.pageNum<this.myDoc.numPages){ this.myDoc.pageNum++; }else if(cmd=="previousPage" && this.myDoc.pageNum>0){
this.myDoc.pageNum--;
}
}catch(e){
this.hostContainer.postMessage(
["error thrown in onMessage:",e.message]);
}
},
onError:function(e){
this.hostContainer.postMessage(["onError: ",e.message]);
}
}
}catch(e){
this.hostContainer.postMessage(["Error thrown in setup:",e.message]);
}
}else{
app.alert("unable to set up hostContainer: this.hostContainer="
+this.hostContainer+" this.external="+this.external);
}
The output is that the pdf displays correctly then the alert box pops up with [...]this.hostContainer=undefined this.external=true.
If anyone has seen this issue or has any ideas it would be much appreciated.
I've also posted about this problem in the Acrobat Scripting forum with no solution as yet.
Thanks,
Simon Kelly
I'm attempting to use the Adobe Acrobat hostContainer object to create a simple interface to allow my Adobe Air application to move between pages of an embedded pdf doc. However the output I get indicates that the hostContainer object is undefined. The script works correctly when the pdf is embedded in a stand-alone html file, but not in Air.
I have Adobe Acrobat 9.0 and Adobe Reader 9.0 installed. It does not seem to be an issue with on machines with Adobe 8.0.
My code in the document javascripts of the pdf is as follows:
this.disclosed = true;
if(this.external && this.hostContainer){
try{
this.hostContainer.messageHandler={
myDoc:this,
onDisclose:function(){return true;},
onMessage:function(stringArray){
var cmd=stringArray[0];
try{
if(cmd=="nextPage" && this.myDoc.pageNum<this.myDoc.numPages){ this.myDoc.pageNum++; }else if(cmd=="previousPage" && this.myDoc.pageNum>0){
this.myDoc.pageNum--;
}
}catch(e){
this.hostContainer.postMessage(
["error thrown in onMessage:",e.message]);
}
},
onError:function(e){
this.hostContainer.postMessage(["onError: ",e.message]);
}
}
}catch(e){
this.hostContainer.postMessage(["Error thrown in setup:",e.message]);
}
}else{
app.alert("unable to set up hostContainer: this.hostContainer="
+this.hostContainer+" this.external="+this.external);
}
The output is that the pdf displays correctly then the alert box pops up with [...]this.hostContainer=undefined this.external=true.
If anyone has seen this issue or has any ideas it would be much appreciated.
I've also posted about this problem in the Acrobat Scripting forum with no solution as yet.
Thanks,
Simon Kelly