Need help with HTTP Calls in Adobe Reader
Here is what I want to do:
I want to Do HTTP Get Calls and HTTP Post Calls From my PDF and Im facing the issue where it says
Request error: NotAllowedError: Security settings prevent access to this property or method.
My privilaged function:
~/Library/Application\ Support/Adobe/Acrobat/DC/JavaScripts/trustedNet.js
var trustedNetRequest = app.trustedFunction(function(cURL) {
app.beginPriv();
try {
Net.HTTP.request({
cURL: cURL,
cMethod: "GET",
oHandler: {
response: function(msg) {
console.println("Response: " + msg);
app.alert("API Response: " + msg);
},
error: function(e) {
console.println("Error: " + e);
app.alert("Error: " + e);
}
}
});
} catch (e) {
console.println("Request error: " + e);
app.alert("Request error: " + e);
}
app.endPriv();
});
In PDF:
function testAPI() {
try {
trustedNetRequest("https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd");
} catch (e) {
app.alert("Unable to call privileged function: " + e);
}
}
I tried it with folder-level privileged javascript function, with all Enhanced security off and I still get this error. Need help asap.Thanks!
