4 Replies Latest reply on Sep 19, 2017 4:21 AM by JR_Boulay

    determine if pdf has layers

    four80eastfan Level 1

      I'm trying to determine if a pdf has layers (I'm very new to Javascript and this API). Below is the function that I've written for this:

       

      var check_flat = function()
      {
          for(var page = 0; page < this.numPages; page++){
              var ocgArray = this.getOCGs(page);
              if(ocgArray != null){
                  console.println(page + " has layers");
              } else{
                  console.println("no layers on this page");
              }
          }
      };
      

       

      When I try this on a pdf that I'm certain has layers, I only get 'no layers on this page'. Your help is very much appreciated!