2 Replies Latest reply on Dec 25, 2016 3:37 PM by saratogacoach

    Document Cloud JavaScript not working

    saratogacoach Level 1

      Hi,

       

      Been trying to change layer visibility using script: PDF is created as interactive PDF in InDesign cs6 with 3 layers, with the first set in InDesign to visible, second layer default set in InDesign to not visible, third layer which in InDesign when exporting as interactive PDF automatically is exported with no control over it (Guides and Grids), can in Acrobat Pro DC be set to not visible. Using a script from Try67 from this forum (Can I remove a layer using Javascript? ) I modify to name the second layer "background" to become visible instead of the default first layer, and all else to be hidden.

       

      var ocgs = this.getOCGs();

      for (var i in ocgs) {

          if (ocgs[i].name=="background")

              ocgs[i].state = true;

          else ocgs[i].state = false;

      }

       

      If I open the PDF on a Windows desktop, works perfectly. Upon opening, the first layer and third layers are not visible, and the second layer ("background") is visible.

       

      The problem:

      If I upload same PDF to Adobe Document Cloud, run it online as web preview, doesn't run correctly like on the desktop: first layer stays visible and other layers remain hidden.

       

      Any way to get this JavaScript to work in Document Cloud to allow the user viewing the PDF in the cloud (not downloaded)?

       

      Thank you for you help.