Skip to main content
Participant
May 18, 2010
Question

Exporting each layers as separate PDF

  • May 18, 2010
  • 3 replies
  • 2718 views

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);
   
    }

This topic has been closed for replies.

3 replies

Participant
May 21, 2010

Hi, i need to make a change to the script so that each layer is exported in the same pdf file but on separate pages.  Is it possible? I tried to search a lot but didnot get it.  Thanks

Participating Frequently
May 21, 2010

That's because it is not just a script that is sent, you are not able to change the functionality yourself.

The new version of the app will have dropfolder support, will work with InDesign CS5 and will have this as an option.

Met vriendelijke groeten,

Warm Regards,

Ton Kuypers

+32 (0) 477 739 530

Aardbemden 11 • B-2400 • Mol • Belgium

www.publishingtools4u.com

Participating Frequently
May 18, 2010

I've created a small app that allows you to do just what you ask... If you're working on a Mac, send me a mail at tkuypers@publishingtools4u.com and I'll send the app to you in reply...

tomaxxi
Inspiring
May 18, 2010

Hey!

Well, have you tried to just hide other layers and then export just visible direct without copying to another document?

tomaxxi

Participant
May 18, 2010

Hi, hey that didnt come into my mind, i think that will solve my problem, thank you

tomaxxi
Inspiring
May 18, 2010

Hey!

Yeah, I think that too

First run trough all layers and hide them,

and then start again from first layer, show it, export it, and then hide it.

And it will be much faster too...

One thing more you can do is to name file according to your layer name if you have to...

tomaxxi