In a folder-level script I'm using app.openDoc to open an existing PDF and extract an icon from it. The following code works in Acrobat 11 but in Reader X I get a NotAllowedError: Security settings prevent access to this property or method error.
this.disclosed = true;
myIcon = app.trustedFunction(function (oArgs) {
app.beginPriv();
var pluginPath = app.getPath({ cCategory: "app", cFolder: "javascript" });
var myDoc = app.openDoc({ cPath: pluginPath + "/MyImages.pdf", bHidden: true }); // <----- error happens on this line
var oIcon = util.iconStreamFromIcon(myDoc.getIcon("myIcon"));
app.endPriv();
return oIcon;
});
The MyImages.pdf exists in the same Javascripts folder as the javascript file. I created MyImages.pdf manually via the console and set disclosed=true before saving it.
I've also tried modifying the call to app.openDoc to set oDoc:this (as recommended in other discussions) but that only caused the same NotAllowedError in both Acrobat and Reader.
Any ideas?