6 Replies Latest reply on May 21, 2010 1:19 AM by TonKuypers

    Exporting each layers as separate PDF

    vikash_k85

      Hello,

       

      I am trying to export each layer in an ID cs3 document as a PDF file.  Any help is welcome.

       

      What i have done so far is creating a temporary document for each layer, copy/paste the layer contents to that temp doc and exporting the document as pdf.  But i am having problem with big layers when copy/paste due to the size limit of the clipboard.  Is there a way to simply export each layers to a separate pdf file without copy/pasting. Thanks

       

      var targetDocument = app.documents[0];
      activeDocument = targetDocument;
      layerCount = targetDocument.layers.length;
      var myPDFExportPreset = app.pdfExportPresets.item("myPDFpreset");
      for (var ii = layerCount - 1; ii>=0; ii--) {
              var myObjectList = new Array;
              targetLayer = targetDocument.layers[ii];

       

              for(var myCounter = 0; myCounter < targetLayer.pageItems.length; myCounter++){

       

                myObjectList.push(targetLayer.pageItems.item(myCounter));
             
              }

       

             
              app.select(myObjectList);
             
              app.copy();

       

              var myDoc = app.documents.add();
              app.paste();
             
              myDoc.exportFile(ExportFormat.pdfType, File("c:/" + ii + ".pdf"),false);

       

              myDoc.close(SaveOptions.no);
         
          }