3 Replies Latest reply on Jul 30, 2010 8:16 AM by Plstsn

    can you script layers to add art in acrobat

    E_donny


      I’d like to import a small PDF or EPS art file to a page within a big PDF and add a different version of the imported art for different people who will recieve the file. I find I can do this using the import layer feature and then flattening the file before I save it. I'd like to use a script to do this. But I can’t find any scripting information about this under Applescript or Javascript for Acrobat Pro. Is there a way to script the layer feature to add a layer and put some art on it? I guess I should flatten it after this is done to reduce file size.

        • 1. Re: can you script layers to add art in acrobat
          Plstsn Level 3

          You'll have to look for the OCG Object instead of layers in the scripting reference.


          Torben.

           

          PS: If you want to control your layers visibility through scripting I don't think it's a good idea to flatten the layers.

          • 2. Re: can you script layers to add art in acrobat
            E_donny Level 1

            The only OCG object I see references to is watermarks. This works fine but

            you can remove them easily with the remove watermarks feature. Is there a

            way to create or import another PDF as an OCG object that is not a watermark

            so wouldn't be affected by the remove watermarks feature in acrobat?

            • 3. Re: can you script layers to add art in acrobat
              Plstsn Level 3

              Ok.

              Say you have an external pdf with a picture in it called myPDF.

               

              I your navigation pane is closed, open it by hitting F4.

               

              If layers are not visible in the pane, right click and choose Layers.

              Hit the layers Icon in the pane and choose "Import as Layer…"

              layers.jpg

              The next dialog is quite selfexplanatory - you load MyPDF and place it at a new layer.

               

              Let's say you've named the new layer myNewLayer.

               

              Here's a quick straight forward example of a function that will turn off that layers visibility:

              function TurnOffMyLayer() {

              var myArray = this.getOCGs();

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

                  if(myArray[i].name == "myNewLayer") {  

                      myArray[i].state = false;

                       }

                   }

              }

               

               

              Hope this makes more sense

               

              Torben.