2 Replies Latest reply on Jun 14, 2016 6:33 AM by joet082964

    Export single page PDF with an InDesign Data Merge


      Hello All!



      This has been driving me crazy! I'm doing a data merge on InDesign CS6, I am creating certificates and am importing the names from a CSV file. But now I need to save each page as individual PDf documents with the file names corresponding to the name on the certificate.


      I've seen threads about running a script that will export the InDesign pages and name the files to an allocated column in the CSV file, in my case is "NAME" I would also like the text "certificate" afterwards if possible.

      The Indesign files has 100+ certificates that I need to separate out and I don't fancy going through them all and renaming each file (I know I can separate out the files in Acrobat Reader)


      I did try a script below:


      var CSV = function(data) {

          var _data = data.split('\r\n');

          for(var i in _data) {

              if(_data[i].length > 0) {

                  console.println(i + ' ' + _data[i]);

                  _data[i] = _data[i].split(',');




          var _head = _data.shift();

          return {

              length: function() {

                  return _data.length - 1;


              getRow: function(row) {

                  return _data[row];


              getRowAndColumn: function(row, col) {

                  if(typeof col !== 'string') {

                      return _data[row][col];

                  } else {

                      col = col.toLowerCase();

                      for(var i in _head) {

                          if(_head[i].toLowerCase() === col) {

                              return _data[row][i];








      this.importDataObject("CSV Data");

      var dataObject = this.getDataObjectContents("CSV Data");

      var csvData = new CSV(util.stringFromStream(dataObject));

      if(this.numPages != csvData.length()) {

          app.alert("Number of pages & CSV row count inconsistent");

      } else {

          for(var i = 0; i < this.numPages; i++) {

              this.extractPages({nStart: i, cPath: csvData.getRowAndColumn(i, 'NAME') + '.pdf'});





      but got the message : this.importDataObject is not a function


      Thank you in advance!