hello
i work on acrobat pro
my goal to send a request http through my pdf file
i took classic example:
i put javascript code in programmes/acrobat/......../javascript/
ajax = function(curl) {
var params =
{
cverb: "get",
curl: curl,
ohandler:
{
response: function(msg, uri, e,h){
var stream = msg;
var string = "";
string = soap.stringfromstream( stream );
app.alert( string );
}
}
};
net.http.request(params);
}
app.addmenuitem({ cname: "go php", cparent: "file",
cexec: 'ajax( "http://localhost/mypage.php");',
cenable: "event.rc = (event.target != null);",
npos: 0
});
but when go "file/go php" acrobat says is an internal error
what problem?
thanks
wrap ajax() function in trust block it's not executed in context of event target (i.e. open document):
ajax = app.trustedfunction(function(furl) {
app.beginpriv();
var params = { cverb:"get", curl:furl, ohandler:{
response:function(msg,uri,e,h){
var stream = msg;
var string = "";
string = soap.stringfromstream( stream );
app.alert( string );}}};
net.http.request(params);
app.endpriv();
});
app.addmenuitem({
cname: "go php", cparent: "file",
cexec: 'ajax("http://localhost/mypage.php");',
cenable: "event.rc = (event.target != null);",
npos: 0});
More discussions in JavaScript
adobe
Comments
Post a Comment