Copy link to clipboard
Copied
how do you make app.openDoc() a trusted function in Reader DC. My function works if i have Preferences - >Security ->"Enabled protected view" unchecked.I would rather keep this checked and and just make openDoc trusted function.
function OpenToPrint(filePath, numCopies) {
var doc = app.openDoc(filePath);
if (doc!=null) {
var pp = doc.getPrintParams();
pp.NumCopies = numCopies;
pp.interactive = pp.constants.interactionLevel.automatic;
doc.print(pp);
doc.closeDoc(true);
}}
function printSets(filePath, numCopies)
{
var cResponse = app.response({
cQuestion: "Enter the Number of Documents",
cTitle: "Enter the Number of Documents",
});
var cResponse1 = app.response({
cQuestion: "Enter the Number of Copies",
cTitle: "Enter the Number of Copies",
});
for (var i=1; i<=cResponse1; i++){
for (var p=1; p<=cResponse; p++){
var path =(("/C/folder/folder/")+String(p)+(".pdf"));
(path)
OpenToPrint(path, 1);}
}}
Copy link to clipboard
Copied
This tutorial should help: https://acrobatusers.com/tutorials/using_trusted_functions
Copy link to clipboard
Copied
I have read and tried to set up accordingly multiple times. I am able to set up the trusted function but i run into "ReferenceError: filePath is not defined"
myTrustedFunction = app.trustedFunction(function(odoc)
{
app.beginPriv();
app.openDoc(filePath);
app.endPriv();
});
Copy link to clipboard
Copied
Replace "doc" in the function definition with "filePath"...