Send a document to Java Servlet using JavaScript - Security Issue
Hello,
I need create new option in Adobe Menu to "export/send" current/opened document to Java Servlet.
I using free Adobe Reader DC.
First my idea was to use http method in adobe java script api, but I still fighting with security permission.
My java script code is in User folder:
C:\Users\insys\AppData\Roaming\Adobe\Acrobat\Privileged\DC\Javascripts\
Below there is a code for http method:
var runExtract = app.trustedFunction(function(doc) {
app.beginPriv();
try {
var params =
{
cVerb: "POST",
cURL: "http://10.179.13.16:8088/ppap/uploadFile",
aHeaders: [{ name: "fileName", value: doc.documentFileName }],
oRequest: Collab.documentToStream(doc)
};
var responseStream = Net.HTTP.request(params);
}
catch (e) {
app.alert({ cMsg: e.message, cTitle: "Exception" });
}
app.endPriv();
});
Code for menu item:
app.addMenuItem({
cName: "ExportPPAP",
cUser: "Export to PPAP",
cParent: "File",
nPos: 7,
cEnable: "event.rc = (event.target != null);",
cExec: "runExtract(event.target)"
});
But when I want to export this file I receiving:
NotAllowedError: Security settings prevent access to this property or method
Even when I created simply function just to save file (again as separate javascript file in User folder):
Script below:
var myTrustedSaveAs = app.trustedFunction( function ()
{
app.beginPriv();
var myTrustedRetn = this.saveAs("/c/MyDocs/" + this.documentFileName);
app.endPriv();
return myTrustedRetn;
});
I still receiving:
NotAllowedError: Security settings prevent access to this property or method
Can someone help me how to achive my goa using free version? Maybe someone has other idea, using different function?
