2 Replies Latest reply on Aug 29, 2016 1:55 AM by lxwar

    Printing pages with additional layers – page by page

    lxwar Level 1

      Already posted this in the prepress section:

      Printing pages with additional layers – page by page (DUPLICATE)

       

      But maybe the Javascript pros are faster by giving a helpful answer:

       

      Hello,  we would need a script to get a print of a two layer document.
      The layer "A" is the basic one, layer "B" can be activated by clicking a button on layer “A“ and gives additional informations.
      The layers ("A" and "B") should be printed in the Following order: A1, B1, A2, B2 … n1, n2


      Wether the printing should be fixed that way for the regular printing command or can be implemented by a button.
      There are no limitations for that within the document.

       

      Hope I gave a clear statement about the challenge.  Thanks in advance.

        • 1. Re: Printing pages with additional layers – page by page
          try67 MVP & Adobe Community Professional

          So you want to print each page twice, showing layer A and then layer B each time?

          In that case you can use something like this (but the user might need to manually click the Print button each time...):

           

          for (var p=0; p<this.numPages; p++) {
              var ocgs = this.getOCGs(p);
              
              // Print the A layer
              for (var i in ocgs) {
                  if (ocgs[i].name=="A") ocgs[i].state = true;
                  else if (ocgs[i].name=="B") ocgs[i].state = false;
              }
              this.print({bUI: false, nStart: p});
             
              // Print the B layer
              for (var i in ocgs) {
                  if (ocgs[i].name=="A") ocgs[i].state = false;
                  else if (ocgs[i].name=="B") ocgs[i].state = true;
              }
              this.print({bUI: false, nStart: p});
          }
          
          • 2. Re: Printing pages with additional layers – page by page
            lxwar Level 1

            Hi try67,

             

            the script is working well.

            Printing the whole document in the required order.

             

            Thanks a lot.