I often have to modify pdf files and show them in stages. Like this:


enter image description here


enter image description here


enter image description here

I'm currently doing it by separating each part of the plot into layers and then hiding some of them, and exporting them to as image files. Is there a more convenient way to do this? I don't want to duplicate objects into different layers because if further along I want to make changes, I'd have to them on every layer.


4 Answers 4


A simpler way to do it would be to make one in an artboard, shift+o to switch to the artboard tool, then alt drag to create a copy of that artboard. Repeat for as many repetitions of that graph that you need, alter as needed, then click into individual artboards and you can export them as individual files.


You can do this with scripting. Unfortunately your usecase dont really fit the suggested scripts. Also artboards will work very badly on account of the requirement of your only one copy of things. They could still be used as a basis for a custom script. The floor plan script i linked in my comment is very close to your usecase though.

This is quite trivial to script. But we might as well make something that is flexible for any future case. I wont bother with a super complicated GUI so you must bear with me. This is a programming scaffold delete the export options you dont need.

var outpath = "d:\\temp\\test";
var doc = app.activeDocument;

// array of layer names to export in each pass
// last name in array is file name. Modify to
// suit your need.

var layers_to_export = [
    ["ebola_k","ebola_gp_il6", "ebola_gp_rest", "all_layers"],
    ["ebola_k", "ebola_gp_il6", "two_layers"],
    ["ebola_k", "one_layer"]

var layers = doc.layers;
var state = Array();
for(var i=0;i<layers.length;i++){
    layers[i].visible = false;

for(var i=0; i < layers_to_export.length; i++){
    for(var j=0; j < layers_to_export[i].length-1; j++){
        layers.getByName(layers_to_export[i][j]).visible = true;
    var fname = outpath+layers_to_export[i][layers_to_export[i].length-1];

    // delete the export you dont want

    //save as ai
    var f = new File(fname+'.ai');
    doc.saveAs( f );

    //save as eps
    f = new File(fname+'.eps');
    var saveOpts = new EPSSaveOptions();
    saveOpts.cmykPostScript = true;
    doc.saveAs( f, saveOpts );

    var f = new File(fname+'.pdf');
    saveOpts = new PDFSaveOptions();
    saveOpts.compatibility = PDFCompatibility.ACROBAT5;
    saveOpts.generateThumbnails = true;
    saveOpts.preserveEditability = false;
    saveOpts.viewAfterSaving = false;
    doc.saveAs( f, saveOpts );

    var f = new File(fname+'.png');
    var exportOptions = new ExportOptionsPNG8(); // or PNG24
    exportOptions.colorCount = 200;
    exportOptions.transparency = false;
    app.activeDocument.exportFile( f, ExportType.PNG8, exportOptions );    

    for(var j=0; j < layers_to_export[i].length-1; j++){
        layers.getByName(layers_to_export[i][j]).visible = false;


for(var i=0;i<layers.length;i++){
    layers[i].visible = state[i];

I have to wonder though is your workflow optimal? What about using a graphing application? Like Mathematica, Matlab or some free alternative like Python/IPython + matplotlib/pylab, R, Octave, Open Modellica etc.


I've found this script and accompanying article to be super helpful in saving out pngs and svgs from Illustrator. Since your document is already organized into different layers, you should be able to export a series of images with this script. You can specify that the script export images based on layer, grouping, and/or artboard, so you'll have some options to be able to organize the different chart views so that they export the best way for your uses.

Do be warned though, depending on the number of files you're exporting with this script, your computer may become almost unresponsive while the script is running. There may be some optimization issues, but this tool is still way better than exporting them all manually.


I often have to do this also.

In your example, I would select all those charts because they have a clear bounding frame, and after selecting them go to OBJECT > SLICE > MAKE. This will make a series of sliced up cells for you to be able to export. Now use the SAVE FOR WEB feature to output your PNGs or JPGs. It helps if you align all your objects first into a nice little grid. Hope that helps.

  • Can you please add one or more screenshots? And can you please add which version you use?
    – Mensch
    Jan 22, 2016 at 0:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.