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

constant.states Security Issue

Community Beginner ,
Dec 11, 2018 Dec 11, 2018

Copy link to clipboard

Copied

I'm working in Acrobat X, but users are using a variety of Acrobat and Reader of every version. A client needed a PDF to ship with layers turned off, but be returned with layers turned on. After I added this to the script that displays the PDF results, then saved the PDF with Reader Extended PDF>Enable Additional Features:

if (layers.state == true){

layers.initState = layers.constants.states.on;

}else{

layers.initState = layers.constants.states.off;

}

...the regular PDF worked fine in Acrobat, but the Reader Extended version stops execution with the message:

Acrobat EScript Built-in Functions Version 10.0

Acrobat SOAP 10.0

NotAllowedError: Security settings prevent access to this property or method.

OCG.initState:11:Field Finalizar:Mouse Up

The error message tells us nothing, but when I comment out the lines that switch the constant.states status, the error goes away. But then the layers are not visible when the head office gets the PDF back.

I've looked this up in the Acrobat SDK, but constants.states does not seem to be a high-security command. Does anyone have an idea how to avoid the security problem, or how to change the layer visiblity without having to install a folder-level script on every damn user's computer? Thanks for any help.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

469

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

correct answers 1 Correct answer

Community Expert , Dec 15, 2018 Dec 15, 2018

Votes

Translate

Translate
LEGEND ,
Dec 11, 2018 Dec 11, 2018

Copy link to clipboard

Copied

The initState property is read-only in Reader, so it's not able to set it. Reader-enabling document results in other restrictions that would normally work in Acrobat as well, template spawning for example, so it's probably the same type of thing. This is one reason why I'll typically use buttons instead of OCGs since there are fewer restrictions in Reader.

Votes

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 ,
Dec 14, 2018 Dec 14, 2018

Copy link to clipboard

Copied

Thanks for the information. Is is possible for Reader to run a folder-level script that will overcome this?

Votes

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 ,
Dec 15, 2018 Dec 15, 2018

Copy link to clipboard

Copied

No.

Votes

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 ,
Dec 15, 2018 Dec 15, 2018

Copy link to clipboard

Copied

Votes

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 ,
Dec 16, 2018 Dec 16, 2018

Copy link to clipboard

Copied

LATEST

Thanks to everyone for all the helpful information. In the end, the form already had scripts to show and hide the layers. I just had to re-read the selected dropdown data to reconstitute the form appearance. I wrote a folder-level script for the form administrator that makes the layers visible on her computer.

Votes

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