Skip to main content
alargroove
Participant
October 2, 2018
Question

How do you make app.openDoc() a trusted function in Reader

  • October 2, 2018
  • 1 reply
  • 1701 views

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);}

}}

This topic has been closed for replies.

1 reply

Inspiring
October 2, 2018
alargroove
Participant
October 2, 2018

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();

});

try67
Community Expert
Community Expert
October 2, 2018

Replace "doc" in the function definition with "filePath"...