I build data-driven graphics in Illustrator and am able to run a batch "Save to PDF" action on these graphics.

Can I do the batch "Save to PDF" action with a script instead? My thinking is that the script will have to loop through the datasets somehow, but unsure where to start.

1 Answer 1


here's a sample showing how to loop thru the Datasets

var idoc = app.activeDocument;
var ds = idoc.dataSets;
var activeds = idoc.activeDataSet; // save the current dataset

for (i=0; i<ds.length; i++) {

    ds[i].display(); // this is the same as clicking the dataset arrows in the UI
    app.redraw(); // we don't need to redraw, it's here so you can see as they change

    doyourthing ();

    alert('data set: ' + i);

activeds.display(); // display the original active dataset

function doyourthing() {
    // save to pdf here

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.