1 Reply Latest reply on Mar 21, 2013 2:37 PM by pkrk

    Placed PDF Layer visibility options

    pkrk Level 1

      Screen Shot 2013-03-21 at 2.24.06 PM.png

       

      How do I access the layers in a linked PDF. Basically I need to turn on certain ones at a time when placing the PDF.

       

      Below I believe is basically Kasyan's(?) (sorry if this is the wrong person, maybe Jongware's) script from another site for dealing with images.

       

       

       

      Main();

      function Main() {

          var page, placedFile, graphics, i, j,

          doc = app.activeDocument,

          pages = doc.pages;

          for (i = 0; i < pages.length; i++) {

              page = pages[i];

              var graphics = page.allGraphics;

              for (j = graphics.length-1; j >= 0; j--) {

                  placedFile = page.allGraphics[j];

                 // if (placedFile.constructor.name == "ImportedPage" && placedFile.itemLink.linkType == "InDesign Format Name") {

                      try {

                       

                        / /placedFile.graphicLayerOptions.graphicLayers.item("Frames").currentVisibility = false;

                         //alert(placedFile.constructor.name);

                          alert(placedFile.graphicLayerOptions.graphicLayers[0].name);   // this line tells me "untitled - 3" but I can't seem to access or see how to loop throught the rest of the layers.

                         

                         

                      }

                      catch (err) {}

                  }

             // }

          }

          alert("Done");

      }

       

       

      Thank you in advance!!