• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

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

Community Beginner ,
Oct 02, 2018 Oct 02, 2018

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

}}

TOPICS
Acrobat SDK and JavaScript

Views

857

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 02, 2018 Oct 02, 2018

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 02, 2018 Oct 02, 2018

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

});

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 02, 2018 Oct 02, 2018

Copy link to clipboard

Copied

LATEST

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines