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

how to make new view using Javascript

Community Beginner ,
Apr 06, 2016 Apr 06, 2016

Based on a given condition, I want to change what nodes are visible in a given view and then save this as a new view.

var viewIndex = 0;

var pageIndex = 0;

var a3d = this.getAnnots3D(pageIndex)[0];

var aRuntime = a3d.context3D.runtime;

var aScene = a3d.context3D.scene;

var aView = aRuntime.getView(viewIndex);

var i=0;

for (i=0; i < aScene.nodes.count; i++){

     var aNode = aScene.nodes.getByIndex(i);

     if ( ... check condition ...) {

          aNode.visible = false;

     }

}

... how to save this change to visible nodes to a new view? ...

Interactively I can go to Views>>Manage Views...>>New View>>Ok

I can't seem to find anything in the documentation or in internet searches on how to do this programmatically.

TOPICS
Acrobat SDK and JavaScript
785
Translate
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

Engaged , Apr 06, 2016 Apr 06, 2016

The short answer is you can't.

However, you can add a list field or drop down to the page or create a menu in the 3D runtime that can display a list of named views as well as "views" that you "save" through your code. If I were doing this, I'd use a hidden field that contains a JSON string that stores the original view name and the modifications your code makes. Then when one of those "views" is selected, got to the original view and then replay the conditions you captured in your if statement.

Th

...
Translate
Engaged ,
Apr 06, 2016 Apr 06, 2016

The short answer is you can't.

However, you can add a list field or drop down to the page or create a menu in the 3D runtime that can display a list of named views as well as "views" that you "save" through your code. If I were doing this, I'd use a hidden field that contains a JSON string that stores the original view name and the modifications your code makes. Then when one of those "views" is selected, got to the original view and then replay the conditions you captured in your if statement.

These , of course, wouldn't show up in the model tree but would be visible in your list box.

J-

Translate
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 ,
Apr 07, 2016 Apr 07, 2016
LATEST

Thanks. I'll have to go with your solution.

Translate
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