Allowing insertpages Function as trusted (Folder Level)

New Here ,
Mar 30, 2021 Mar 30, 2021

Copy link to clipboard

Copied

Hi All,

 

I am new to the forum, I am trying to allow the insertpages functions as  a Folder Level trusted function. I want to able to have a check box or drop down (yes or no) as to whether the end user wants to add "remotepage.pdf" to the document or not.

 

Using the debugger I have succsssfully used the below simple script to inset the page at No.5 in the document.

this.insertPages( 4, "RemotePage.pdf");

 

Obviously this works as I am typing it in and therefore it is default trusted. 

 

What I am trying to do is the below, but I know it is wrong (I am not an expert by any degree)

I don't know what arguments to use as the debugger is saying I need to add them.

 

// Page Addition Function
function AddRemotePage()
{
app.beginPriv();
this.insertPages( 4, "RemoteIntelligencePage.pdf");
app.endPriv();
}
var Trusted_AddRemotePage = app.trustedFunction();

 

Any help will be so welcome thanks.

TOPICS
General troubleshooting, JavaScript, PDF forms

Views

165

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
New Here ,
Mar 30, 2021 Mar 30, 2021

Copy link to clipboard

Copied

Sorry Correction bleow, I changed the pdf name a while ago.

// Page Addition Function
function AddRemotePage()
{
app.beginPriv();
this.insertPages( 4, "RemotePage.pdf");
app.endPriv();
}
var Trusted_AddRemotePage = app.trustedFunction();

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
Adobe Community Professional ,
Mar 30, 2021 Mar 30, 2021

Copy link to clipboard

Copied

Look at the documentation of trustedFunction.

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
Adobe Community Professional ,
Mar 30, 2021 Mar 30, 2021

Copy link to clipboard

Copied

Hi,

 

How are you making the code available to the user as it can only be used in batch,console and application initialization events

(From the docs) -

Note: This method is available only during batch, console and application initialization events

 

This means that if you want access to it from your form, it needs to be installed as a application startup script.

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
New Here ,
Mar 30, 2021 Mar 30, 2021

Copy link to clipboard

Copied

Hi,

 

Thanks for getting back to me, the plan was to drop this as a Config.js file in the Acrobat Javascripts Folder on each of the end users laptops.

 

From reading the information available this is the only way that the function can be made trusted for each user. 

 

Cheers.

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
New Here ,
Mar 30, 2021 Mar 30, 2021

Copy link to clipboard

Copied

I have managed to do it with the below.

 

// Page Addition Function
function AddRemotePage()
{
app.beginPriv();
this.insertPages( 4, "RemotePage.pdf");
app.endPriv();
}
app.trustedFunction(AddRemotePage);

 

No works on a button press. (Providing the .js file is within the App directory.)

 

Thanks for help.

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
Adobe Community Professional ,
Apr 01, 2021 Apr 01, 2021

Copy link to clipboard

Copied

LATEST

Hi,

 

And how are you calling you function from the button?

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